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

#include <MemoryInputStream.h>

Inheritance diagram for MemoryInputStream:
InputStream

Public Member Functions

 MemoryInputStream ()
 
 MemoryInputStream (const void *data, size_t size, std::string_view displayPath={})
 
virtual ~MemoryInputStream ()
 
void reset (const void *data, size_t size, std::string_view displayPath={})
 
virtual size_t read (void *data, size_t size) override
 
virtual size_t skip (size_t size) override
 
virtual void close () override
 
std::string displayPath () const override
 
void seek (ssize_t pos)
 
ssize_t position () const
 
ssize_t size () const
 
- 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 Attributes

const char * _begin = nullptr
 
const char * _pos = nullptr
 
const char * _end = nullptr
 
std::string _displayPath
 

Constructor & Destructor Documentation

◆ MemoryInputStream() [1/2]

MemoryInputStream::MemoryInputStream ( )

◆ MemoryInputStream() [2/2]

MemoryInputStream::MemoryInputStream ( const void *  data,
size_t  size,
std::string_view  displayPath = {} 
)

◆ ~MemoryInputStream()

MemoryInputStream::~MemoryInputStream ( )
virtual

Member Function Documentation

◆ close()

void MemoryInputStream::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.

◆ displayPath()

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

Implements InputStream.

◆ position()

ssize_t MemoryInputStream::position ( ) const

◆ read()

size_t MemoryInputStream::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.

◆ reset()

void MemoryInputStream::reset ( const void *  data,
size_t  size,
std::string_view  displayPath = {} 
)

◆ seek()

void MemoryInputStream::seek ( ssize_t  pos)

◆ size()

ssize_t MemoryInputStream::size ( ) const

◆ skip()

size_t MemoryInputStream::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

◆ _begin

const char* MemoryInputStream::_begin = nullptr
private

◆ _displayPath

std::string MemoryInputStream::_displayPath
private

◆ _end

const char* MemoryInputStream::_end = nullptr
private

◆ _pos

const char* MemoryInputStream::_pos = nullptr
private

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