|
MxEngine
|
#include <File.h>
Public Types | |
| enum | FileMode { READ = 0x1, WRITE = 0x2, BINARY = 0x4 } |
| using | FileData = MxString |
Public Member Functions | |
| File ()=default | |
| File (const FilePath &path, int mode=FileMode::READ) | |
| File (const MxString &path, int mode=FileMode::READ) | |
| File (const char *path, int mode=FileMode::READ) | |
| File (const File &)=default | |
| File (File &&)=default | |
| File & | operator= (const File &)=default |
| File & | operator= (File &&)=default |
| FileStream & | GetStream () |
| bool | IsOpen () const |
| void | Open (FilePath path, int mode=FileMode::READ) |
| void | Open (const MxString &path, int mode=FileMode::READ) |
| void | Open (const char *path, int mode=FileMode::READ) |
| void | Close () |
| FileData | ReadAllText () |
| const FilePath & | GetPath () const |
| template<typename T > | |
| File & | operator>> (T &&value) |
| template<typename T > | |
| File & | operator<< (T &&value) |
| void | WriteBytes (const uint8_t *bytes, size_t size) |
Static Public Member Functions | |
| static FileData | ReadAllText (const FilePath &path) |
| static FileData | ReadAllText (const MxString &path) |
| static FileData | ReadAllText (const char *path) |
| static bool | Exists (const FilePath &path) |
| static bool | Exists (const MxString &path) |
| static bool | Exists (const char *path) |
| static bool | IsFile (const MxString &path) |
| static bool | IsFile (const FilePath &path) |
| static bool | IsFile (const char *path) |
| static bool | IsDirectory (const MxString &path) |
| static bool | IsDirectory (const FilePath &path) |
| static bool | IsDirectory (const char *path) |
| static FileSystemTime | LastModifiedTime (const FilePath &path) |
| static FileSystemTime | LastModifiedTime (const MxString &path) |
| static FileSystemTime | LastModifiedTime (const char *path) |
| static void | CreateDirectory (const FilePath &path) |
| static void | CreateDirectory (const MxString &path) |
| static void | CreateDirectory (const char *path) |
File is an abstraction over std::fstream object and std::filesystem::path. It caches data, searches files and used for reading/writing binat and text data. Note: consider using Script class for files which are frequently updated by user
mode is used to specify how to treat opened file. Use binary OR ( | ) to compine mods
|
default |
creates empty file object (empty stream, empty path)
| MxEngine::File::File | ( | const FilePath & | path, |
| int | mode = FileMode::READ |
||
| ) |
creates file object and opens fstream
| path | path to a file |
| mode | how to treat file (see FileMode documentation) |
| MxEngine::File::File | ( | const MxString & | path, |
| int | mode = FileMode::READ |
||
| ) |
creates file object and opens fstream
| path | path to a file (absolute or relative to executable directory) |
| mode | how to treat file (see FileMode documentation) |
| MxEngine::File::File | ( | const char * | path, |
| int | mode = FileMode::READ |
||
| ) |
creates file object and opens fstream
| path | path to a file (absolute or relative to executable directory) |
| mode | how to treat file (see FileMode documentation) |
|
static |
checks if file exists
| path | path of file to search for |
|
static |
checks if file exists
| path | path of file to search for |
|
static |
checks if file exists
| path | path of file to search for |
| const FilePath & MxEngine::File::GetPath | ( | ) | const |
gets current path associated with File object
| FileStream & MxEngine::File::GetStream | ( | ) |
fileStream member getter
|
static |
checks if path is directory
| path | path to search for |
|
static |
checks if path is directory
| path | path to search for |
|
static |
checks if path is directory
| path | path to search for |
|
static |
checks if path is regular file
| path | path of file to search for |
|
static |
checks if path is regular file
| path | path of file to search for |
|
static |
checks if path is regular file
| path | path of file to search for |
| bool MxEngine::File::IsOpen | ( | ) | const |
checks if current file is open or not
|
static |
gets file last modified time
| path | path to a file to check for |
|
static |
gets file last modified time
| path | path to a file to check for |
|
static |
gets file last modified time
| path | path to a file to check for |
| void MxEngine::File::Open | ( | FilePath | path, |
| int | mode = FileMode::READ |
||
| ) |
opens new file, old file associated with File is closed automatically
| path | path to a file |
| mode | how to treat file (see FileMode documentation) |
| void MxEngine::File::Open | ( | const MxString & | path, |
| int | mode = FileMode::READ |
||
| ) |
opens new file, old file associated with File is closed automatically
| path | path to a file (absolute or relative to executable directory) |
| mode | how to treat file (see FileMode documentation) |
| void MxEngine::File::Open | ( | const char * | path, |
| int | mode = FileMode::READ |
||
| ) |
opens new file, old file associated with File is closed automatically
| path | path to a file (absolute or relative to executable directory) |
| mode | how to treat file (see FileMode documentation) |
|
inline |
writes data of type T to a file
| value | value to write to |
|
inline |
reads data from a file and treats it as T type
| value | value to read to |
| File::FileData MxEngine::File::ReadAllText | ( | ) |
reads all data from file into string object. File must be opened for read and NOT binary
|
static |
creates temporary File object and reads its data into string.
| path | path to a file |
|
static |
creates temporary File object and reads its data into string.
| path | path to a file (absolute or relative to executable directory) |
|
static |
creates temporary File object and reads its data into string.
| path | path to a file (absolute or relative to executable directory) |
1.8.12