40 #ifndef _resourcefilestream_cpp
41 #define _resourcefilestream_cpp
44 #include "stringtool.h"
64 { this->
OpenFile(FileName,FilePath,Mode); }
75 if( !this->
FileBuffer.open(File.c_str(),
static_cast<const std::ios_base::openmode
>(Mode)) ) {
76 this->setstate(ios_base::failbit);
94 char Check = FilePath.at(FilePath.size() - 1);
100 if( SysSlash != Check ) {
101 FullPath = FilePath + SysSlash + FileName;
103 FullPath = FilePath + FileName;
121 this->setstate(std::ios_base::failbit);
129 {
return this->
Flags; }
135 {
return this->
Size; }
void OpenFile(const String &File, const Whole Mode=Resource::SF_Read|Resource::SF_Write)
Opens this stream to a file. the stream fails to open the file specified, a IO_FILE_NOT_FOUND_EXCEPTI...
StreamSize Size
The size of the stream.
bool Boole
Generally acts a single bit, true or false.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Declaration of FileStream.
Whole Flags
The type of access this stream has to the file.
Thrown when a file was expected to be there, but was not.
Base class for streams that support both read and write operations.
This implements the exception hiearchy for Mezzanine.
virtual StreamPos GetReadPosition()
Gets the current read position in this stream.
virtual void SetReadPosition(StreamPos Position)
Sets the position of the read cursor explicitly.
String OpenFileName
The path and name of the file this stream is currently open to.
void CloseFile()
Closes the file that is currently opened.
const String & GetFilePathAndName() const
Gets the path and name of the file that this stream is currently open to.
Boole IsOpenToFile() const
Gets whether or not this stream is currently open to a file.
virtual ~FileStream()
Class destructor.
FileStream()
Blank constructor.
virtual StreamSize GetSize() const
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
std::streamsize StreamSize
Convenience define for the stream size datatype.
std::filebuf FileBuffer
The buffer object containing most or all of the functionality for this stream.
virtual void SetStreamPosition(StreamPos Position)
Sets the position of the read and write cursors explicitly.
Error/no special initialization.
std::string String
A datatype used to a series of characters.
Whole GetSteamFlags() const
Gets the flags that were used to open the file.