Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | List of all members
Mezzanine::Resource::IStream Class Reference

Base class for input (read) streams with minimal implementation. More...

#include <datastream.h>

+ Inheritance diagram for Mezzanine::Resource::IStream:
+ Collaboration diagram for Mezzanine::Resource::IStream:

Public Member Functions

 IStream (std::streambuf *Buf)
 Class constructor. More...
 
virtual ~IStream ()
 Class destructor.
 
virtual Boole Bad () const
 Gets whether or not a critical error was detected in a previous operation in the stream. More...
 
virtual void ClearErrors ()
 Clears any stored error state on the stream. More...
 
virtual Boole EoF () const
 Gets whether or not the current position is at the end of the stream. More...
 
virtual Boole Fail () const
 Gets whether or not an otherwise silent and recoverable error was detected in a previous operation in the stream. More...
 
virtual StreamPos GetReadPosition ()
 Gets the current read position in this stream. More...
 
virtual Boole IsValid () const
 Gets whether or not this stream is intact and ready for operations. More...
 
virtual size_t Read (void *Buffer, StreamSize Size)
 Reads from the stream and copies that data to a buffer. More...
 
virtual void SetReadPosition (StreamPos Position)
 Sets the position of the read cursor explicitly. More...
 
virtual void SetReadPosition (StreamOff Offset, SeekOrigin Origin)
 Sets the position of the read cursor. More...
 
- Public Member Functions inherited from Mezzanine::Resource::iInStream
 iInStream ()
 Class constructor.
 
virtual ~iInStream ()
 Class destructor.
 
- Public Member Functions inherited from Mezzanine::Resource::iStreamBase
 iStreamBase ()
 Class constructor.
 
virtual ~iStreamBase ()
 Class destructor.
 
virtual StreamSize GetSize () const =0
 Gets the size of the stream. More...
 

Detailed Description

Base class for input (read) streams with minimal implementation.

Definition at line 181 of file datastream.h.

Constructor & Destructor Documentation

Mezzanine::Resource::IStream::IStream ( std::streambuf *  Buf)

Class constructor.

Parameters
BufA pointer to the buffer that will be streamed.

Definition at line 60 of file datastream.cpp.

Member Function Documentation

Boole Mezzanine::Resource::IStream::Bad ( ) const
virtual

Gets whether or not a critical error was detected in a previous operation in the stream.

Returns
Returns true if a critical error has occurred and the stream integrity may be invalid, false otherwise.

Implements Mezzanine::Resource::iStreamBase.

Definition at line 73 of file datastream.cpp.

void Mezzanine::Resource::IStream::ClearErrors ( )
virtual

Clears any stored error state on the stream.

Remarks
This is useful for non-critical errors such as ones that cause "EoF()" or "Fail()" to return true but not "Bad()". Using this to clear critical errors is not advised.

Implements Mezzanine::Resource::iStreamBase.

Definition at line 82 of file datastream.cpp.

Boole Mezzanine::Resource::IStream::EoF ( ) const
virtual

Gets whether or not the current position is at the end of the stream.

Returns
Returns true if the current position has reached the end of the stream, false otherwise.

Implements Mezzanine::Resource::iStreamBase.

Definition at line 70 of file datastream.cpp.

Boole Mezzanine::Resource::IStream::Fail ( ) const
virtual

Gets whether or not an otherwise silent and recoverable error was detected in a previous operation in the stream.

Returns
Returns true if a non-critical operation failed (such as seek), false otherwise.

Implements Mezzanine::Resource::iStreamBase.

Definition at line 76 of file datastream.cpp.

StreamPos Mezzanine::Resource::IStream::GetReadPosition ( )
virtual

Gets the current read position in this stream.

Returns
Returns a StreamPos representing the current read position.

Implements Mezzanine::Resource::iInStream.

Definition at line 100 of file datastream.cpp.

Boole Mezzanine::Resource::IStream::IsValid ( ) const
virtual

Gets whether or not this stream is intact and ready for operations.

Returns
Returns true if no failures have been detected, false otherwise.

Implements Mezzanine::Resource::iStreamBase.

Definition at line 79 of file datastream.cpp.

size_t Mezzanine::Resource::IStream::Read ( void *  Buffer,
StreamSize  Size 
)
virtual

Reads from the stream and copies that data to a buffer.

Parameters
BufferThe buffer to be populated with the read data.
SizeThe number of bytes to read from the stream.
Returns
Returns the number of bytes successfully read.

Implements Mezzanine::Resource::iInStream.

Definition at line 88 of file datastream.cpp.

void Mezzanine::Resource::IStream::SetReadPosition ( StreamPos  Position)
virtual

Sets the position of the read cursor explicitly.

Parameters
PositionThe position to be set.

Implements Mezzanine::Resource::iInStream.

Definition at line 94 of file datastream.cpp.

void Mezzanine::Resource::IStream::SetReadPosition ( StreamOff  Offset,
SeekOrigin  Origin 
)
virtual

Sets the position of the read cursor.

Parameters
OffsetThe number of bytes to move the read cursor back(if negative) or forward(if positive).
OriginThe starting point to be considered for the offset.

Implements Mezzanine::Resource::iInStream.

Definition at line 97 of file datastream.cpp.


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