#include <StdInputStream.h>
|
| StdInputStream ()=default |
|
| StdInputStream (std::unique_ptr< std::istream > stream) |
|
| StdInputStream (StdInputStream &&other) noexcept |
|
void | read (std::size_t numBytes, std::byte *out_bytes) override |
| Read specific number of raw bytes in one go. The method does not return before finishing the reading process.
|
|
void | readString (std::string *out_string, char delimiter) override |
| Read a string in one go. Note the EOF is also considered a delimiter (the final one).
|
|
void | seekGet (std::size_t pos) override |
| Set the input position of the stream. The unit of the position is defined by the implementation.
|
|
std::optional< std::size_t > | tellGet () override |
| Get the current input position of the stream. The unit of the position is defined by the implementation.
|
|
| operator bool () const override |
|
std::size_t | readSome (std::size_t numBytes, std::byte *out_bytes) override |
| Read some data in the form of raw bytes. The method may return before finish reading all bytes. In such case, the method returns how many bytes were actually read.
|
|
std::istream * | getStream () const |
|
StdInputStream & | operator= (StdInputStream &&rhs) noexcept |
|
void | readLine (std::string *out_string) |
| Read a line. Equivalent to calling readString(std::string*, char) with '
' as the delimiter.
|
|
virtual | ~IDataStream ()=default |
|
virtual std::string | acquireName () const |
| Access to the stream's name. This method is not meant to be used in a high performance context, unless otherwise stated by the overridder. Stream name is not always available.
|
|
◆ StdInputStream() [1/3]
ph::StdInputStream::StdInputStream |
( |
| ) |
|
|
inlinedefault |
◆ StdInputStream() [2/3]
ph::StdInputStream::StdInputStream |
( |
std::unique_ptr< std::istream > | stream | ) |
|
|
explicit |
◆ StdInputStream() [3/3]
◆ ensureStreamIsGoodForRead()
void ph::StdInputStream::ensureStreamIsGoodForRead |
( |
| ) |
const |
|
protected |
Check if the stream has any error.
- Exceptions
-
IOException | If there is any error. |
◆ getReasonForError()
std::string ph::StdInputStream::getReasonForError |
( |
| ) |
const |
|
protected |
A description for why the stream is not in a good state.
◆ getStream()
std::istream * ph::StdInputStream::getStream |
( |
| ) |
const |
|
inline |
◆ isStreamGoodForRead()
bool ph::StdInputStream::isStreamGoodForRead |
( |
| ) |
const |
|
inlineprotected |
◆ operator bool()
ph::StdInputStream::operator bool |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ operator=()
◆ read()
void ph::StdInputStream::read |
( |
std::size_t | numBytes, |
|
|
std::byte * | out_bytes ) |
|
overridevirtual |
Read specific number of raw bytes in one go. The method does not return before finishing the reading process.
- Parameters
-
| numBytes | Number of bytes to read. |
[out] | out_bytes | The read bytes. Must contain storage for at least numBytes bytes. |
- Exceptions
-
IOException | If the read operation failed. |
Implements ph::IInputStream.
◆ readSome()
std::size_t ph::StdInputStream::readSome |
( |
std::size_t | numBytes, |
|
|
std::byte * | out_bytes ) |
|
overridevirtual |
Read some data in the form of raw bytes. The method may return before finish reading all bytes. In such case, the method returns how many bytes were actually read.
- Parameters
-
| numBytes | Maximum number of bytes to read. |
[out] | out_bytes | The read bytes. Must contain storage for at least numBytes bytes. |
- Returns
- How many bytes were actually read.
- Exceptions
-
IOException | If the read operation failed. |
Reimplemented from ph::IInputStream.
◆ readString()
void ph::StdInputStream::readString |
( |
std::string * | out_string, |
|
|
char | delimiter ) |
|
overridevirtual |
Read a string in one go. Note the EOF is also considered a delimiter (the final one).
- Parameters
-
out_string | The read string. Does not include the delimiter . |
delimiter | The character that denotes the ending of a line. |
- Exceptions
-
IOException | If the read operation failed. |
Implements ph::IInputStream.
◆ seekGet()
void ph::StdInputStream::seekGet |
( |
std::size_t | pos | ) |
|
|
overridevirtual |
Set the input position of the stream. The unit of the position is defined by the implementation.
- Parameters
-
pos | The position to set to. |
- Exceptions
-
IOException | If the seeking process failed. |
Implements ph::IInputStream.
◆ tellGet()
std::optional< std::size_t > ph::StdInputStream::tellGet |
( |
| ) |
|
|
overridevirtual |
Get the current input position of the stream. The unit of the position is defined by the implementation.
- Returns
- Current input position. Empty if the position is unavailable.
Implements ph::IInputStream.
The documentation for this class was generated from the following files: