EHS
|
A cross-platform wrapper class that handles native file input/output. More...
#include <BaseFile.h>
Public Member Functions | |
virtual | ~BaseFile ()=default |
Frees all native handles. More... | |
BaseFile () | |
Default members initialization. More... | |
BaseFile (const Str_8 &filePath, const Mode mode, const Disposition disposition) | |
BaseFile (BaseFile &&file) noexcept | |
BaseFile (const BaseFile &file)=default | |
BaseFile & | operator= (BaseFile &&file) noexcept |
BaseFile & | operator= (const BaseFile &file)=default |
virtual | operator const Byte * () const =0 |
virtual | operator Byte * ()=0 |
virtual void | Release ()=0 |
virtual bool | IsMapped () const =0 |
virtual UInt_64 | MapSize () const =0 |
virtual void | Map (const UInt_64 offset, const UInt_64 size)=0 |
virtual void | Unmap ()=0 |
virtual void | FlushMap ()=0 |
virtual UInt_64 | Write (const Byte *const data, const UInt_64 size)=0 |
void | WriteStr_32 (const Char_32 *const str, const UInt_64 size) |
void | WriteStr_32 (const Str_32 &str) |
void | WriteStr_16 (const Char_16 *const str, const UInt_64 size) |
void | WriteStr_16 (const Str_16 &str) |
void | WriteStr_8 (const Char_8 *const str, const UInt_64 size) |
void | WriteStr_8 (const Str_8 &str) |
void | WriteVector (const Vector< Byte, UInt_64 > &vec) |
void | WriteArray (const Array< Byte, UInt_64 > &arr) |
void | WriteSerializer_64 (const Serializer< UInt_64 > &ser) |
void | WriteSerializer_32 (const Serializer< UInt_32 > &ser) |
virtual UInt_64 | Read (Byte *const buffer, const UInt_64 size)=0 |
void | ReadStr_32 (Char_32 *const buffer, UInt_64 &size) |
Str_32 | ReadStr_32 (const UInt_64 size) |
void | ReadStr_16 (Char_16 *const buffer, UInt_64 &size) |
Str_16 | ReadStr_16 (const UInt_64 size) |
void | ReadStr_8 (Char_8 *const buffer, UInt_64 &size) |
Str_8 | ReadStr_8 (const UInt_64 size) |
Vector< Byte, UInt_64 > | ReadVector (const UInt_64 size) |
Array< Byte, UInt_64 > | ReadArray (const UInt_64 size) |
Serializer< UInt_64 > | ReadSerializer_64 (const Endianness end, const UInt_64 size) |
Serializer< UInt_32 > | ReadSerializer_32 (const Endianness end, const UInt_32 size) |
virtual void | Seek (UInt_64 index)=0 |
virtual void | SeekBeginning ()=0 |
virtual void | SeekEnd ()=0 |
virtual void | Truncate (const UInt_64 size)=0 |
virtual UInt_64 | Size () const =0 |
Str_8 | GetPath () const |
Str_8 | GetFullName () const |
Str_8 | GetName () const |
Str_8 | GetExtension () const |
virtual bool | IsValid () const =0 |
Static Public Member Functions | |
static void | Rename_32 (const Str_32 &filePath, const Str_32 &newName) |
static void | Rename_16 (const Str_16 &filePath, const Str_16 &newName) |
static void | Rename_8 (const Str_8 &filePath, const Str_8 &newName) |
static Str_32 | ParseFullName_32 (const Str_32 &filePath) |
static Str_16 | ParseFullName_16 (const Str_16 &filePath) |
static Str_8 | ParseFullName_8 (const Str_8 &filePath) |
static Str_32 | ParseName_32 (const Str_32 &filePath) |
static Str_16 | ParseName_16 (const Str_16 &filePath) |
static Str_8 | ParseName_8 (const Str_8 &filePath) |
static Str_32 | ParseExt_32 (const Str_32 &filePath) |
static Str_16 | ParseExt_16 (const Str_16 &filePath) |
static Str_8 | ParseExt_8 (const Str_8 &filePath) |
Protected Attributes | |
Str_8 | path |
Str_8 | fullName |
Str_8 | name |
Str_8 | extension |
Mode | mode |
Disposition | disposition |
A cross-platform wrapper class that handles native file input/output.
|
virtualdefault |
Frees all native handles.
ehs::BaseFile::BaseFile | ( | ) |
Default members initialization.
ehs::BaseFile::BaseFile | ( | const Str_8 & | filePath, |
const Mode | mode, | ||
const Disposition | disposition | ||
) |
Initializes members with the given data.
[in] | filePath | The file path to read or write to. |
[in] | mode | The mode when accessing the file. |
[in] | disposition | How to handle the file. |
|
noexcept |
|
default |
Copy constructor.
[in] | file | The file object to copy from. |
Str_8 ehs::BaseFile::GetExtension | ( | ) | const |
Str_8 ehs::BaseFile::GetFullName | ( | ) | const |
Str_8 ehs::BaseFile::GetName | ( | ) | const |
Str_8 ehs::BaseFile::GetPath | ( | ) | const |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Copy operator.
[in] | file | The file object to copy from. |
|
pure virtual |
Reads data from the file as an array.
N | The data type to use for numbers. |
[in] | size | The size of the buffer and how much data to read. |
Serializer< UInt_32 > ehs::BaseFile::ReadSerializer_32 | ( | const Endianness | end, |
const UInt_32 | size | ||
) |
Reads data from the file as a serializer.
N | The data type to use for numbers. |
[in] | end | The Endianness of the data in the file. |
[in] | size | The size of the buffer and how much data to read. |
Serializer< UInt_64 > ehs::BaseFile::ReadSerializer_64 | ( | const Endianness | end, |
const UInt_64 | size | ||
) |
Reads data from the file as a serializer.
N | The data type to use for numbers. |
[in] | end | The Endianness of the data in the file. |
[in] | size | The size of the buffer and how much data to read. |
void ehs::BaseFile::ReadStr_16 | ( | Char_16 *const | buffer, |
UInt_64 & | size | ||
) |
Reads data from the file as a C-style string.
T | The character data type to use. |
[out] | buffer | The buffer to store the data read from the file. |
[in] | size | The size of the given buffer and how much data to read. |
Str_16 ehs::BaseFile::ReadStr_16 | ( | const UInt_64 | size | ) |
Reads data from the file as a string.
T | The character data type to use. |
N | The data type to use for numbers. |
[in] | size | The size of the buffer and how much data to read. |
void ehs::BaseFile::ReadStr_32 | ( | Char_32 *const | buffer, |
UInt_64 & | size | ||
) |
Reads data from the file as a C-style string.
T | The character data type to use. |
[out] | buffer | The buffer to store the data read from the file. |
[in] | size | The size of the given buffer and how much data to read. |
Str_32 ehs::BaseFile::ReadStr_32 | ( | const UInt_64 | size | ) |
Reads data from the file as a string.
T | The character data type to use. |
N | The data type to use for numbers. |
[in] | size | The size of the buffer and how much data to read. |
void ehs::BaseFile::ReadStr_8 | ( | Char_8 *const | buffer, |
UInt_64 & | size | ||
) |
Reads data from the file as a C-style string.
T | The character data type to use. |
[out] | buffer | The buffer to store the data read from the file. |
[in] | size | The size of the given buffer and how much data to read. |
Str_8 ehs::BaseFile::ReadStr_8 | ( | const UInt_64 | size | ) |
Reads data from the file as a string.
T | The character data type to use. |
N | The data type to use for numbers. |
[in] | size | The size of the buffer and how much data to read. |
Reads data from the file as a vector.
N | The data type to use for numbers. |
[in] | size | The size of the buffer and how much data to read. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Writes an array to the file.
N | The data type to use for numbers. |
[in] | arr | The array to write to the file. |
void ehs::BaseFile::WriteSerializer_32 | ( | const Serializer< UInt_32 > & | ser | ) |
Writes a serializer to the file.
N | The data type to use for numbers. |
[in] | ser | The serializer to write to the file. |
void ehs::BaseFile::WriteSerializer_64 | ( | const Serializer< UInt_64 > & | ser | ) |
Writes a serializer to the file.
N | The data type to use for numbers. |
[in] | ser | The serializer to write to the file. |
void ehs::BaseFile::WriteStr_16 | ( | const Char_16 *const | str, |
const UInt_64 | size | ||
) |
Writes a C-style string to the file.
T | The character data type to use. |
[in] | str | The C-style string to write to the file. |
[in] | size | The size of the given C-style string. |
void ehs::BaseFile::WriteStr_16 | ( | const Str_16 & | str | ) |
Writes a string to the file.
T | The character data type to use. |
N | The data type to use for numbers. |
[in] | str | The string to write to the file. |
void ehs::BaseFile::WriteStr_32 | ( | const Char_32 *const | str, |
const UInt_64 | size | ||
) |
Writes a C-style string to the file.
T | The character data type to use. |
[in] | str | The C-style string to write to the file. |
[in] | size | The size of the given C-style string. |
void ehs::BaseFile::WriteStr_32 | ( | const Str_32 & | str | ) |
Writes a string to the file.
T | The character data type to use. |
N | The data type to use for numbers. |
[in] | str | The string to write to the file. |
void ehs::BaseFile::WriteStr_8 | ( | const Char_8 *const | str, |
const UInt_64 | size | ||
) |
Writes a C-style string to the file.
T | The character data type to use. |
[in] | str | The C-style string to write to the file. |
[in] | size | The size of the given C-style string. |
void ehs::BaseFile::WriteStr_8 | ( | const Str_8 & | str | ) |
Writes a string to the file.
T | The character data type to use. |
N | The data type to use for numbers. |
[in] | str | The string to write to the file. |
Writes a vector to the file.
N | The data type to use for numbers. |
[in] | vec | The vector to write to the file. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |