OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FileInputStream Class Reference

#include <FileInputStream.h>

Inheritance diagram for FileInputStream:
InputStream

Public Member Functions

 FileInputStream ()=default
 
 FileInputStream (std::string_view path)
 
virtual ~FileInputStream ()
 
void open (std::string_view path)
 
bool isOpen () const
 
virtual size_t read (void *data, size_t size) override
 
virtual size_t skip (size_t size) override
 
virtual void close () override
 
virtual std::string displayPath () const override
 
void seek (ssize_t pos)
 
FILE * handle ()
 
- Public Member Functions inherited from InputStream
virtual ~InputStream ()
 
virtual size_t read (void *data, size_t size)=0
 
void readOrFail (void *data, size_t size)
 
std::string readAll (size_t maxSize=-1)
 
virtual size_t skip (size_t size)=0
 
void skipOrFail (size_t size)
 
virtual void close ()=0
 
virtual std::string displayPath () const =0
 

Private Member Functions

void closeInternal (bool canThrow)
 

Private Attributes

std::string _path
 
FILE * _file = nullptr
 

Constructor & Destructor Documentation

◆ FileInputStream() [1/2]

FileInputStream::FileInputStream ( )
default

◆ FileInputStream() [2/2]

FileInputStream::FileInputStream ( std::string_view  path)
explicit

◆ ~FileInputStream()

FileInputStream::~FileInputStream ( )
virtual

Member Function Documentation

◆ close()

void FileInputStream::close ( )
overridevirtual

Closes this input stream. Reading from a closed stream will result in undefined behavior.

Does nothing if the stream is already closed.

Exceptions
ExceptionOn error.

Implements InputStream.

◆ closeInternal()

void FileInputStream::closeInternal ( bool  canThrow)
private

◆ displayPath()

std::string FileInputStream::displayPath ( ) const
overridevirtual
Returns
Path to the file or resource being read, to be used for debugging and error reporting.

Implements InputStream.

◆ handle()

FILE * FileInputStream::handle ( )
inline

◆ isOpen()

bool FileInputStream::isOpen ( ) const
inline

◆ open()

void FileInputStream::open ( std::string_view  path)

◆ read()

size_t FileInputStream::read ( void *  data,
size_t  size 
)
overridevirtual
Parameters
dataOutput buffer to write read data into.
sizeNumber of bytes to read.
Returns
Number of bytes actually read. A return value that's less than size signals end of stream.
Exceptions
ExceptionOn error.

Implements InputStream.

◆ seek()

void FileInputStream::seek ( ssize_t  pos)

◆ skip()

size_t FileInputStream::skip ( size_t  size)
overridevirtual
Parameters
sizeNumber of bytes to skip.
Returns
Number of bytes actually skipped. A return value that's less than size signals end of stream.
Exceptions
ExceptionOn error.

Implements InputStream.

Member Data Documentation

◆ _file

FILE* FileInputStream::_file = nullptr
private

◆ _path

std::string FileInputStream::_path
private

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