#include <DiskFile.h>
Inherits MCore::File.
Public Types | |
| enum | { TYPE_ID = 0x0000001 } |
| enum | EMode { READ = 0 , WRITE = 1 , READWRITE = 2 , READWRITECREATE = 3 , APPEND = 4 , READWRITEAPPEND = 5 } |
Public Member Functions | |
| DiskFile () | |
| virtual | ~DiskFile () |
| uint32 | GetType () const override |
| virtual bool | Open (const char *fileName, EMode mode) |
| void | Close () override |
| void | Flush () override |
| bool | GetIsEOF () const override |
| uint8 | GetNextByte () override |
| size_t | GetPos () const override |
| bool | WriteByte (uint8 value) override |
| bool | Forward (size_t numBytes) override |
| bool | Seek (size_t offset) override |
| size_t | Write (const void *data, size_t length) override |
| size_t | Read (void *data, size_t length) override |
| bool | GetIsOpen () const override |
| size_t | GetFileSize () const override |
| EMode | GetFileMode () const |
| const AZStd::string & | GetFileName () const |
Public Member Functions inherited from MCore::File | |
| File () | |
| virtual | ~File () |
Public Member Functions inherited from MCore::Stream | |
| Stream () | |
| virtual | ~Stream () |
| virtual Stream & | operator<< (bool b) |
| virtual Stream & | operator<< (char ch) |
| virtual Stream & | operator<< (uint8 ch) |
| virtual Stream & | operator<< (int16 number) |
| virtual Stream & | operator<< (uint16 number) |
| virtual Stream & | operator<< (int32 number) |
| virtual Stream & | operator<< (uint32 number) |
| virtual Stream & | operator<< (uint64 number) |
| virtual Stream & | operator<< (int64 number) |
| virtual Stream & | operator<< (float number) |
| virtual Stream & | operator<< (double number) |
| virtual Stream & | operator<< (AZStd::string &text) |
| virtual Stream & | operator<< (const char *text) |
| virtual Stream & | operator>> (bool &b) |
| virtual Stream & | operator>> (char &ch) |
| virtual Stream & | operator>> (uint8 &ch) |
| virtual Stream & | operator>> (int16 &number) |
| virtual Stream & | operator>> (uint16 &number) |
| virtual Stream & | operator>> (int32 &number) |
| virtual Stream & | operator>> (uint32 &number) |
| virtual Stream & | operator>> (int64 &number) |
| virtual Stream & | operator>> (uint64 &number) |
| virtual Stream & | operator>> (float &number) |
| virtual Stream & | operator>> (double &number) |
| virtual Stream & | operator>> (AZStd::string &text) |
Protected Attributes | |
| AZStd::string | m_fileName |
| FILE * | m_file |
| EMode | m_fileMode |
A standard file as we normally think of. In other words, a file stored on the harddisk or a CD or any other comparable medium. This is for binary files only. If you plan to read text files, please use the MCore::DiskTextFile class.
File opening modes. Do not use a combination of these modes. Just pick one.
| MCore::DiskFile::DiskFile | ( | ) |
The constructor.
|
virtual |
The destructor. Automatically closes the file.
|
overridevirtual |
Close the file.
Implements MCore::File.
|
overridevirtual |
Flush the file. All cached (not yet written) data will be forced to written when calling this method.
Implements MCore::File.
|
overridevirtual |
Seek ahead a given number of bytes. This can be used to skip a given number of upcoming bytes in the file.
| numBytes | The number of bytes to seek ahead. |
Implements MCore::File.
| EMode MCore::DiskFile::GetFileMode | ( | ) | const |
Returns the mode the file has been opened with.
| const AZStd::string & MCore::DiskFile::GetFileName | ( | ) | const |
Returns the name of the file as it has been opened.
|
overridevirtual |
|
overridevirtual |
Returns true if we reached the end of this file, otherwise false is returned.
Implements MCore::File.
|
overridevirtual |
Check if the file has been opened already.
Implements MCore::File.
|
overridevirtual |
Reads and returns the next byte/character in the file. So this will increase the position in the file with one.
Implements MCore::File.
|
overridevirtual |
|
overridevirtual |
|
virtual |
Try to open the file, given a filename and open mode. The file is always opened in binary mode. If you want to load text files, use MCore::DiskTextFile.
| fileName | The filename on disk. |
| mode | The file open mode. See enum EMode for more information. Do NOT use a combination of these modes. |
|
overridevirtual |
Read a given amount of data from the file.
| data | The pointer where to store the read data. |
| length | The size in bytes of the data to read. |
Implements MCore::File.
|
overridevirtual |
Seek to a given byte position in the file, where 0 would be the beginning of the file. So we're talking about the absolute position in the file. After successfully executing this method the method GetPos will return the given offset.
| offset | The offset in bytes (the position) in the file to seek to. |
Implements MCore::File.
|
overridevirtual |
Writes a given amount of data to the file.
| data | The pointer to the data to write. |
| length | The size in bytes of the data to write. |
Implements MCore::File.
|
overridevirtual |
Write a character or byte in the file.
| value | The character or byte to write. |
Implements MCore::File.
|
protected |
The file handle.
|
protected |
The mode we opened the file with.
|
protected |
The filename