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

Base class for output (write) streams with minimal implementation. More...

#include <datastream.h>

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

Public Member Functions

 OStream (std::streambuf *Buf)
 Class constructor. More...
 
virtual ~OStream ()
 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 GetWritePosition ()
 Gets the current write position in this stream. More...
 
virtual Boole IsValid () const
 Gets whether or not this stream is intact and ready for operations. More...
 
virtual void SetWritePosition (StreamPos Position)
 Sets the position of the write cursor explicitly. More...
 
virtual void SetWritePosition (StreamOff Offset, SeekOrigin Origin)
 Sets the position of the write cursor. More...
 
virtual size_t Write (const void *Buffer, StreamSize Size)
 Writes data to the stream. More...
 
- Public Member Functions inherited from Mezzanine::Resource::iOutStream
 iOutStream ()
 Class constructor.
 
virtual ~iOutStream ()
 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 output (write) streams with minimal implementation.

Definition at line 222 of file datastream.h.

Constructor & Destructor Documentation

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

Class constructor.

Parameters
BufA pointer to the buffer that will be streamed.

Definition at line 106 of file datastream.cpp.

Member Function Documentation

Boole Mezzanine::Resource::OStream::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 119 of file datastream.cpp.

void Mezzanine::Resource::OStream::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 128 of file datastream.cpp.

Boole Mezzanine::Resource::OStream::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 116 of file datastream.cpp.

Boole Mezzanine::Resource::OStream::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 122 of file datastream.cpp.

StreamPos Mezzanine::Resource::OStream::GetWritePosition ( )
virtual

Gets the current write position in this stream.

Returns
Returns a StreamPos representing the current write position.

Implements Mezzanine::Resource::iOutStream.

Definition at line 146 of file datastream.cpp.

Boole Mezzanine::Resource::OStream::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 125 of file datastream.cpp.

void Mezzanine::Resource::OStream::SetWritePosition ( StreamPos  Position)
virtual

Sets the position of the write cursor explicitly.

Parameters
PositionThe position to be set.

Implements Mezzanine::Resource::iOutStream.

Definition at line 140 of file datastream.cpp.

void Mezzanine::Resource::OStream::SetWritePosition ( StreamOff  Offset,
SeekOrigin  Origin 
)
virtual

Sets the position of the write cursor.

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

Implements Mezzanine::Resource::iOutStream.

Definition at line 143 of file datastream.cpp.

size_t Mezzanine::Resource::OStream::Write ( const void *  Buffer,
StreamSize  Size 
)
virtual

Writes data to the stream.

Parameters
BufferThe memory buffer to write to this stream.
SizeThe size of the buffer being passed in.
Returns
Returns the number of bytes successfully written.

Implements Mezzanine::Resource::iOutStream.

Definition at line 134 of file datastream.cpp.


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