Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Core class that represents a file. More...
Public Member Functions | |
File () | |
Constructs a File object by default. | |
File (const String &filePath) | |
Constructs a File object with a file path. More... | |
File (const String &filePath, OpenModeFlags openMode) | |
Constructs a File object with a file path and flags. More... | |
File (const File &)=delete | |
File (File &&file) noexcept=default | |
~File () | |
Destructs the object and calls Close. More... | |
bool | Copy (const String &newFilePath) |
Copies this file to a new file path. More... | |
void | Close () |
Closes the file. | |
bool | Delete () |
Deletes the file. More... | |
bool | EndOfFile () const |
Checks whether the file has reached the end. More... | |
bool | EndOfStream () const override |
Checks whether the file has reached the end of the stream. More... | |
bool | Exists () const |
Checks whether the file exists. More... | |
time_t | GetCreationTime () const |
Gets the creation time of the file. More... | |
UInt64 | GetCursorPos () const override |
Gets the position of the cursor in the file. More... | |
String | GetDirectory () const override |
Gets the directory of the file. More... | |
String | GetFileName () const |
Gets the name of the file. More... | |
time_t | GetLastAccessTime () const |
Gets the last time the file was accessed. More... | |
time_t | GetLastWriteTime () const |
Gets the last time the file was written. More... | |
String | GetPath () const override |
Gets the path of the file. More... | |
UInt64 | GetSize () const override |
Gets the size of the file. More... | |
bool | IsOpen () const |
Checks whether the file is open. More... | |
bool | Open (OpenModeFlags openMode=OpenMode_NotOpen) |
Opens the file with flags. More... | |
bool | Open (const String &filePath, OpenModeFlags openMode=OpenMode_NotOpen) |
Opens the file with file path and flags. More... | |
bool | Rename (const String &newFilePath) |
Renames the file with a new name. More... | |
bool | SetCursorPos (CursorPosition pos, Int64 offset=0) |
Sets the position of the cursor. More... | |
bool | SetCursorPos (UInt64 offset) override |
Sets the position of the cursor. More... | |
bool | SetFile (const String &filePath) |
Sets the file path. More... | |
bool | SetSize (UInt64 size) |
Sets the size of the file. More... | |
File & | operator= (const String &filePath) |
Sets the file path. More... | |
File & | operator= (const File &)=delete |
File & | operator= (File &&file) noexcept=default |
Public Member Functions inherited from Nz::Stream | |
Stream (const Stream &)=default | |
Stream (Stream &&)=default | |
virtual | ~Stream () |
Destructs the object. | |
void | EnableTextMode (bool textMode) |
Enables the text mode. More... | |
void | Flush () |
Flushes the stream. More... | |
OpenModeFlags | GetOpenMode () const |
Gets the open mode of the stream. More... | |
StreamOptionFlags | GetStreamOptions () const |
Gets the options of the stream. More... | |
std::size_t | Read (void *buffer, std::size_t size) |
Reads the stream and puts the result in a buffer. More... | |
virtual String | ReadLine (unsigned int lineSize=0) |
Reads a line from the stream. More... | |
bool | IsReadable () const |
Checks whether the stream is readable. More... | |
bool | IsSequential () const |
Checks whether the stream is sequential. More... | |
bool | IsTextModeEnabled () const |
Checks whether the stream has text mode enabled. More... | |
bool | IsWritable () const |
Checks whether the stream can be written. More... | |
bool | Write (const ByteArray &byteArray) |
Writes a ByteArray into the stream. More... | |
bool | Write (const String &string) |
Writes a String into the stream. More... | |
std::size_t | Write (const void *buffer, std::size_t size) |
Writes in the stream the content of a buffer. More... | |
Stream & | operator= (const Stream &)=default |
Stream & | operator= (Stream &&)=default |
Static Public Member Functions | |
static String | AbsolutePath (const String &filePath) |
Gets the absolute path of the file. More... | |
static ByteArray | ComputeHash (HashType hash, const String &filePath) |
Computes the hash for the file. More... | |
static ByteArray | ComputeHash (AbstractHash *hash, const String &filePath) |
Computes the hash for the file. More... | |
static bool | Copy (const String &sourcePath, const String &targetPath) |
Copies the first file to a new file path. More... | |
static bool | Delete (const String &filePath) |
Deletes the file. More... | |
static bool | Exists (const String &filePath) |
Checks whether the file exists. More... | |
static time_t | GetCreationTime (const String &filePath) |
Gets the creation time of the file. More... | |
static String | GetDirectory (const String &filePath) |
Gets the directory of the file. More... | |
static time_t | GetLastAccessTime (const String &filePath) |
Gets the last time the file was accessed. More... | |
static time_t | GetLastWriteTime (const String &filePath) |
Gets the last time the file was written. More... | |
static UInt64 | GetSize (const String &filePath) |
Gets the size of the file. More... | |
static bool | IsAbsolute (const String &filePath) |
Checks whether the file path is absolute. More... | |
static String | NormalizePath (const String &filePath) |
Normalizes the file path. More... | |
static String | NormalizeSeparators (const String &filePath) |
Normalizes the path separator. More... | |
static bool | Rename (const String &sourcePath, const String &targetPath) |
Renames the file with a new name. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Nz::Stream | |
Stream (StreamOptionFlags streamOptions=StreamOption_None, OpenModeFlags openMode=OpenMode_NotOpen) | |
Constructs a Stream object with options. More... | |
virtual void | FlushStream ()=0 |
Protected Attributes inherited from Nz::Stream | |
OpenModeFlags | m_openMode |
StreamOptionFlags | m_streamOptions |
Core class that represents a file.
Nz::File::File | ( | const String & | filePath | ) |
Constructs a File object with a file path.
filePath | Path to the file |
Nz::File::File | ( | const String & | filePath, |
OpenModeFlags | openMode | ||
) |
Constructs a File object with a file path and flags.
filePath | Path to the file |
openMode | Flag of the file |
Nz::File::~File | ( | ) |
Destructs the object and calls Close.
Gets the absolute path of the file.
filePath | Path of the file |
Computes the hash for the file.
hash | Hash to execute |
filePath | Path for the file |
|
inlinestatic |
Computes the hash for the file.
hash | Hash to execute |
filePath | Path for the file |
bool Nz::File::Copy | ( | const String & | newFilePath | ) |
Copies this file to a new file path.
newFilePath | Path of the new file |
Copies the first file to a new file path.
sourcePath | Path of the original file |
targetPath | Path of the copied file |
bool Nz::File::Delete | ( | ) |
Deletes the file.
|
static |
Deletes the file.
filePath | Path of the file |
bool Nz::File::EndOfFile | ( | ) | const |
Checks whether the file has reached the end.
|
overridevirtual |
Checks whether the file has reached the end of the stream.
Implements Nz::Stream.
bool Nz::File::Exists | ( | ) | const |
Checks whether the file exists.
|
static |
Checks whether the file exists.
filePath | Path of the file |
time_t Nz::File::GetCreationTime | ( | ) | const |
Gets the creation time of the file.
|
static |
Gets the creation time of the file.
filePath | Path of the file |
|
overridevirtual |
Gets the position of the cursor in the file.
Implements Nz::Stream.
|
overridevirtual |
String Nz::File::GetFileName | ( | ) | const |
Gets the name of the file.
time_t Nz::File::GetLastAccessTime | ( | ) | const |
Gets the last time the file was accessed.
|
static |
Gets the last time the file was accessed.
filePath | Path of the file |
time_t Nz::File::GetLastWriteTime | ( | ) | const |
Gets the last time the file was written.
|
static |
Gets the last time the file was written.
filePath | Path of the file |
|
overridevirtual |
|
overridevirtual |
|
static |
Gets the size of the file.
filePath | Path of the file |
|
static |
Checks whether the file path is absolute.
filePath | Path to test |
bool Nz::File::IsOpen | ( | ) | const |
Checks whether the file is open.
Normalizes the file path.
filePath | Path to normalize |
Normalizes the path separator.
filePath | Path to normalize |
bool Nz::File::Open | ( | OpenModeFlags | openMode = OpenMode_NotOpen | ) |
Opens the file with flags.
openMode | Flag for file |
bool Nz::File::Open | ( | const String & | filePath, |
OpenModeFlags | openMode = OpenMode_NotOpen |
||
) |
Opens the file with file path and flags.
filePath | Path to the file |
openMode | Flag for file |
Sets the file path.
bool Nz::File::Rename | ( | const String & | newFilePath | ) |
Renames the file with a new name.
Renames the file with a new name.
sourcePath | Path of the original file |
targetPath | Path of the renamed file |
bool Nz::File::SetCursorPos | ( | CursorPosition | pos, |
Int64 | offset = 0 |
||
) |
Sets the position of the cursor.
pos | Position of the cursor |
offset | Offset according to the cursor position |
|
overridevirtual |
Sets the position of the cursor.
offset | Offset according to the cursor begin position |
Implements Nz::Stream.
bool Nz::File::SetFile | ( | const String & | filePath | ) |
Sets the file path.
bool Nz::File::SetSize | ( | UInt64 | size | ) |
Sets the size of the file.
size | The size the file should have after this call |