This represents a stream to a file on disk using the C++ file stream API. More...
#include <filestream.h>
Public Member Functions | |
FileStream (std::fstream *Stream, const UInt16 Flags=DataStream::SF_Read) | |
Class constructor. More... | |
FileStream (const String &FileName, const String &Path, const UInt16 Flags=DataStream::SF_Read) | |
Self loading constructor. More... | |
virtual | ~FileStream () |
Class destructor. | |
virtual void | Advance (const StreamOff Count) |
Advances the position in the stream. More... | |
virtual void | Close () |
Closes the stream to the resource. More... | |
virtual bool | EoF () const |
Gets whether or not the current position is at the end of the file/stream. More... | |
virtual StreamPos | GetStreamPosition (bool Read=true) |
Gets the current position in this stream. (bool Read = true) More... | |
virtual size_t | Read (void *Buffer, const size_t &Count) |
Reads data from the stream, copying to a buffer. 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 size_t | Write (const void *Buffer, const size_t &Count) |
Writes data from the stream, copying from the provided buffer. More... | |
Public Member Functions inherited from Mezzanine::Resource::DataStream | |
DataStream (const UInt16 Flags=SF_Read) | |
Class constructor. More... | |
virtual | ~DataStream () |
Class destructor. | |
virtual String | GetAsString () |
Gets the contents of the stream as a string. More... | |
virtual String | GetLine (bool Trim=true) |
Gets the contents of the current line in the stream. More... | |
virtual StreamSize | GetSize () const |
Gets the size of the stream. More... | |
virtual bool | IsReadable () const |
Gets whether this stream can be read. More... | |
virtual bool | IsWriteable () const |
Gets whether this stream can be written to. More... | |
virtual size_t | ReadLine (Char8 *Buffer, size_t MaxCount, const String &Delim="\n") |
Reads a single line from a string. More... | |
virtual size_t | SkipLine (const String &Delim="\n") |
Moves the current position to the start of the next line. More... | |
Protected Attributes | |
std::fstream * | StandardStream |
Protected Attributes inherited from Mezzanine::Resource::DataStream | |
UInt16 | SFlags |
The type of access this stream has to the resource. | |
StreamSize | Size |
The size of the stream. | |
Additional Inherited Members | |
Public Types inherited from Mezzanine::Resource::DataStream | |
enum | SeekOrigin { SO_Beginning = std::ios_base::beg, SO_Current = std::ios_base::cur, SO_End = std::ios_base::end } |
An enum describing which position should be considered the origin for changing the current position in a stream. More... | |
enum | StreamFlags { SF_None = 0, SF_Read = 1, SF_Write = 2, SF_Append = 4, SF_AtEnd = 8, SF_Binary = 16, SF_Truncate = 32 } |
This enum describes the flags that control certain behaviors of a stream. More... | |
This represents a stream to a file on disk using the C++ file stream API.
Definition at line 70 of file filestream.h.
Mezzanine::Resource::FileStream::FileStream | ( | std::fstream * | Stream, |
const UInt16 | Flags = DataStream::SF_Read |
||
) |
Class constructor.
Stream | The stream to the file being streamed to/from. |
Mode | The flags to use when initializing the stream. |
Definition at line 57 of file filestream.cpp.
Mezzanine::Resource::FileStream::FileStream | ( | const String & | FileName, |
const String & | Path, | ||
const UInt16 | Flags = DataStream::SF_Read |
||
) |
Self loading constructor.
FileName | The name of the file to be loaded. This will also become the name of the stream. |
Path | The path to the file being loaded. |
Mode | The flags to use when initializing the stream. |
Definition at line 67 of file filestream.cpp.
|
virtual |
Advances the position in the stream.
Count | The number of bytes to skip/advance in the stream from the current position. |
Implements Mezzanine::Resource::DataStream.
Definition at line 138 of file filestream.cpp.
|
virtual |
Closes the stream to the resource.
Implements Mezzanine::Resource::DataStream.
Definition at line 169 of file filestream.cpp.
|
virtual |
Gets whether or not the current position is at the end of the file/stream.
Implements Mezzanine::Resource::DataStream.
Definition at line 164 of file filestream.cpp.
|
virtual |
Gets the current position in this stream. (bool Read = true)
Read | Whether or not to get the Read position. If false this will get the write position instead. |
(bool Read = true)
Implements Mezzanine::Resource::DataStream.
Definition at line 158 of file filestream.cpp.
|
virtual |
Reads data from the stream, copying to a buffer.
Buffer | The buffer to place data from the stream. |
Count | The number of bytes to read from the stream. |
Implements Mezzanine::Resource::DataStream.
Definition at line 114 of file filestream.cpp.
|
virtual |
Sets the position of the read and write cursors explicitly.
Position | The position to be set. |
Implements Mezzanine::Resource::DataStream.
Definition at line 144 of file filestream.cpp.
|
virtual |
Sets the position of the read and write cursors.
Offset | The number of bytes to move the cursors back(if negative) or forward(if positive). |
Origin | The starting point to be considered for the offset. |
Implements Mezzanine::Resource::DataStream.
Definition at line 151 of file filestream.cpp.
|
virtual |
Writes data from the stream, copying from the provided buffer.
Buffer | The buffer of data to be written. |
Count | The number of bytes to write from the buffer to the stream. |
Implements Mezzanine::Resource::DataStream.
Definition at line 126 of file filestream.cpp.