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

This represents a stream to a file on disk using the C++ file stream API. More...

#include <filestream.h>

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

Public Member Functions

 FileStream ()
 Blank constructor.
 
 FileStream (const String &File, const Whole Mode=Resource::SF_Read|Resource::SF_Write)
 Open constructor. More...
 
 FileStream (const String &FileName, const String &FilePath, const Whole Mode=Resource::SF_Read|Resource::SF_Write)
 Split Open constructor. More...
 
virtual ~FileStream ()
 Class destructor.
 
void CloseFile ()
 Closes the file that is currently opened.
 
const StringGetFilePathAndName () const
 Gets the path and name of the file that this stream is currently open to. More...
 
virtual StreamSize GetSize () const
 
Whole GetSteamFlags () const
 Gets the flags that were used to open the file. More...
 
Boole IsOpenToFile () const
 Gets whether or not this stream is currently open to a file. More...
 
void OpenFile (const String &File, const Whole Mode=Resource::SF_Read|Resource::SF_Write)
 Opens this stream to a file.

Exceptions
Ifthe stream fails to open the file specified, a IO_FILE_NOT_FOUND_EXCEPTION will be thrown.
More...
 
void OpenFile (const String &FileName, const String &FilePath, const Whole Mode=Resource::SF_Read|Resource::SF_Write)
 Opens this stream to a file.

Exceptions
Ifthe stream fails to open the file specified, a IO_FILE_NOT_FOUND_EXCEPTION will be thrown.
More...
 
- Public Member Functions inherited from Mezzanine::Resource::IOStream
 IOStream (std::streambuf *Buf)
 Class constructor. More...
 
virtual ~IOStream ()
 Class destructor.
 
virtual void Advance (const StreamOff Count)
 Advances the position in the stream. More...
 
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 String GetAsString ()
 Gets the contents of the stream as a string. More...
 
virtual String GetLine (Boole Trim=true)
 Gets the contents of the current line in the stream. More...
 
virtual StreamPos GetReadPosition ()
 Gets the current read position in this stream. More...
 
virtual StreamPos GetStreamPosition (const Boole Read=true)
 Gets the current position in this 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 size_t Read (void *Buffer, StreamSize Size)
 Reads from the stream and copies that data to a buffer. More...
 
virtual size_t ReadLine (Char8 *Buffer, size_t MaxCount, const String &Delim="\n")
 Reads a single line from a string. 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...
 
virtual void SetStreamPosition (StreamPos Position)
 Sets the position of the read and write cursors explicitly. More...
 
virtual void SetStreamPosition (StreamOff Offset, SeekOrigin Origin)
 Sets the position of the read and write cursors. 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 SkipLine (const String &Delim="\n")
 Moves the current position to the start of the next line. More...
 
virtual size_t Write (const void *Buffer, StreamSize Size)
 Writes data to the stream. 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.
 
- Public Member Functions inherited from Mezzanine::Resource::iOutStream
 iOutStream ()
 Class constructor.
 
virtual ~iOutStream ()
 Class destructor.
 

Protected Attributes

std::filebuf FileBuffer
 The buffer object containing most or all of the functionality for this stream. More...
 
Whole Flags
 The type of access this stream has to the file. More...
 
String OpenFileName
 The path and name of the file this stream is currently open to. More...
 
StreamSize Size
 The size of the stream. More...
 

Detailed Description

This represents a stream to a file on disk using the C++ file stream API.

Definition at line 56 of file filestream.h.

Constructor & Destructor Documentation

Mezzanine::Resource::FileStream::FileStream ( const String File,
const Whole  Mode = Resource::SF_Read | Resource::SF_Write 
)

Open constructor.

Parameters
FileThe combined name and path to the file to be opened.
ModeThe configuration to open the file with.

Definition at line 58 of file filestream.cpp.

Mezzanine::Resource::FileStream::FileStream ( const String FileName,
const String FilePath,
const Whole  Mode = Resource::SF_Read | Resource::SF_Write 
)

Split Open constructor.

Parameters
FileNameThe name of the file to be opened.
FilePathThe path to the file to be opened.
ModeThe configuration to open the file with.

Definition at line 62 of file filestream.cpp.

Member Function Documentation

const String & Mezzanine::Resource::FileStream::GetFilePathAndName ( ) const

Gets the path and name of the file that this stream is currently open to.

Returns
Returns a const String reference containing the path and name of the currently open file.

Definition at line 125 of file filestream.cpp.

StreamSize Mezzanine::Resource::FileStream::GetSize ( ) const
virtual

Implements Mezzanine::Resource::iStreamBase.

Definition at line 134 of file filestream.cpp.

Whole Mezzanine::Resource::FileStream::GetSteamFlags ( ) const

Gets the flags that were used to open the file.

Returns
Returns a bitfield describing the flags used to open the file. If this stream is not open to a file it will return Resource::SF_None.

Definition at line 128 of file filestream.cpp.

Boole Mezzanine::Resource::FileStream::IsOpenToFile ( ) const

Gets whether or not this stream is currently open to a file.

Returns
Returns true if this is streaming to/from a file. False otherwise.

Definition at line 109 of file filestream.cpp.

void Mezzanine::Resource::FileStream::OpenFile ( const String File,
const Whole  Mode = Resource::SF_Read | Resource::SF_Write 
)

Opens this stream to a file.

Exceptions
Ifthe stream fails to open the file specified, a IO_FILE_NOT_FOUND_EXCEPTION will be thrown.

Parameters
FileThe combined name and path to the file to be opened.
ModeThe configuration to open the file with.

Definition at line 72 of file filestream.cpp.

void Mezzanine::Resource::FileStream::OpenFile ( const String FileName,
const String FilePath,
const Whole  Mode = Resource::SF_Read | Resource::SF_Write 
)

Opens this stream to a file.

Exceptions
Ifthe stream fails to open the file specified, a IO_FILE_NOT_FOUND_EXCEPTION will be thrown.

Parameters
FileNameThe name of the file to be opened.
FilePathThe path to the file to be opened.
ModeThe configuration to open the file with.

Definition at line 91 of file filestream.cpp.

Member Data Documentation

std::filebuf Mezzanine::Resource::FileStream::FileBuffer
protected

The buffer object containing most or all of the functionality for this stream.

Definition at line 61 of file filestream.h.

Whole Mezzanine::Resource::FileStream::Flags
protected

The type of access this stream has to the file.

Definition at line 68 of file filestream.h.

String Mezzanine::Resource::FileStream::OpenFileName
protected

The path and name of the file this stream is currently open to.

Definition at line 65 of file filestream.h.

StreamSize Mezzanine::Resource::FileStream::Size
protected

The size of the stream.

Definition at line 71 of file filestream.h.


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