Helper class that hands out input streams to a file. More...
#include <FileInputStream.h>
Public Member Functions | |
FileInputStream (const std::string &filename) | |
virtual std::shared_ptr< std::istream > | get () const override final |
Gets an input stream to the underlying stream. More... | |
virtual std::optional< std::filesystem::path > | getFilename () const override final |
Gets the underlying filename, if any. More... | |
bool | inUse () const |
Whether or not anything is still using this stream. More... | |
Protected Member Functions | |
void | addSharedStream (const std::weak_ptr< std::istream > stream) const |
Internal method to be called by derived classes to add a shared stream to _shared_streams (so that it can be tracked). More... | |
Protected Attributes | |
const std::filesystem::path | _filename |
The name of the file. More... | |
Helper class that hands out input streams to a file.
Definition at line 17 of file FileInputStream.h.
FileInputStream::FileInputStream | ( | const std::string & | filename | ) |
Definition at line 16 of file FileInputStream.C.
|
protectedinherited |
Internal method to be called by derived classes to add a shared stream to _shared_streams (so that it can be tracked).
Should be called in the overridden get() by derived classes.
Definition at line 21 of file InputStream.C.
Referenced by get(), and StringInputStream::get().
|
finaloverridevirtual |
Gets an input stream to the underlying stream.
This is returned as a shared_ptr so that this class can tell whether or not another object is still using the stream.
Implements InputStream.
Definition at line 21 of file FileInputStream.C.
|
finaloverridevirtual |
Gets the underlying filename, if any.
Reimplemented from InputStream.
Definition at line 35 of file FileInputStream.C.
|
inherited |
Whether or not anything is still using this stream.
This is checked by seeing whether or not the use count of any of the streams handed out by get() is > 1 (with the only use count being the one stored in _shared_streams)
Definition at line 35 of file InputStream.C.
Referenced by StringInputStream::release(), and InputStream::~InputStream().
|
protected |
The name of the file.
Definition at line 28 of file FileInputStream.h.
Referenced by get(), and getFilename().