|
| File () |
| Initialize file with an empty path. More...
|
|
| File (const Path &path) |
| Initialize file with a given path. More...
|
|
| File (const File &file) |
|
| File (File &&file) noexcept |
|
virtual | ~File () |
|
File & | operator= (const Path &path) |
|
File & | operator= (const File &file) |
|
File & | operator= (File &&file) noexcept |
|
| operator bool () const noexcept |
| Check if the file opened. More...
|
|
uint64_t | offset () const |
| Get the current read/write offset of the opened file. More...
|
|
uint64_t | size () const |
| Get the current file size. More...
|
|
bool | IsFileExists () const |
| Is the file exists? More...
|
|
bool | IsFileEmpty () const |
| Is the file empty? More...
|
|
bool | IsFileOpened () const |
| Is the file opened? More...
|
|
bool | IsFileReadOpened () const |
| Is the file opened for reading? More...
|
|
bool | IsFileWriteOpened () const |
| Is the file opened for writing? More...
|
|
void | Create (bool read, bool write, const Flags< FileAttributes > &attributes=File::DEFAULT_ATTRIBUTES, const Flags< FilePermissions > &permissions=File::DEFAULT_PERMISSIONS, size_t buffer=File::DEFAULT_BUFFER) |
| Create a new file. More...
|
|
void | Open (bool read, bool write, bool truncate=false, const Flags< FileAttributes > &attributes=File::DEFAULT_ATTRIBUTES, const Flags< FilePermissions > &permissions=File::DEFAULT_PERMISSIONS, size_t buffer=File::DEFAULT_BUFFER) |
| Open an existing file. More...
|
|
void | OpenOrCreate (bool read, bool write, bool truncate=false, const Flags< FileAttributes > &attributes=File::DEFAULT_ATTRIBUTES, const Flags< FilePermissions > &permissions=File::DEFAULT_PERMISSIONS, size_t buffer=File::DEFAULT_BUFFER) |
| Open or create file. More...
|
|
size_t | Read (void *buffer, size_t size) override |
| Read a bytes buffer from the opened file. More...
|
|
size_t | Write (const void *buffer, size_t size) override |
| Write a byte buffer into the opened file. More...
|
|
void | Seek (uint64_t offset) |
| Seek into the opened file. More...
|
|
void | Resize (uint64_t size) |
| Resize the current file. More...
|
|
void | Flush () override |
| Flush the file. More...
|
|
void | Close () |
| Close the file. More...
|
|
void | swap (File &file) noexcept |
| Swap two instances. More...
|
|
std::vector< uint8_t > | ReadAllBytes () |
| Read all bytes. More...
|
|
std::string | ReadAllText () |
| Read all text. More...
|
|
std::vector< std::string > | ReadAllLines () |
| Read all text lines. More...
|
|
virtual size_t | Write (const void *buffer, size_t size)=0 |
| Write a byte buffer base method. More...
|
|
size_t | Write (const std::string &text) |
| Write a text string. More...
|
|
size_t | Write (const std::vector< std::string > &lines) |
| Write text lines. More...
|
|
| Path () |
| Initialize path with an empty value. More...
|
|
| Path (const char *path) |
| Initialize path with a given C-string value. More...
|
|
| Path (const std::string &path) |
| Initialize path with a given string value. More...
|
|
| Path (const wchar_t *path) |
| Initialize path with a given wide C-string value. More...
|
|
| Path (const std::wstring &path) |
| Initialize path with a given wide string value. More...
|
|
| Path (const Path &)=default |
|
| Path (Path &&)=default |
|
| ~Path ()=default |
|
Path & | operator= (const Path &)=default |
|
Path & | operator= (Path &&)=default |
|
| operator bool () const noexcept |
| Check if the path is not empty. More...
|
|
Path & | operator/= (const Path &path) |
|
Path & | operator+= (const Path &path) |
|
const std::string & | string () const noexcept |
| Get the path value as UTF-8 string. More...
|
|
std::wstring | wstring () const |
| Get the path value as a wide string. More...
|
|
Path | root () const |
| Decompose root path from the current path. More...
|
|
Path | relative () const |
| Decompose relative path from the current path. More...
|
|
Path | parent () const |
| Decompose parent path from the current path. More...
|
|
Path | filename () const |
| Decompose filename from the current path. More...
|
|
Path | stem () const |
| Decompose stem from the current path. More...
|
|
Path | extension () const |
| Decompose extension from the current path. More...
|
|
Path | absolute () const |
| Transform the current path to the real path on a filesystem. More...
|
|
Path | canonical () const |
| Transform the current path and replace all '.' and '..' properly. More...
|
|
Path | validate (char placeholder='_') const |
| Transform the current path and replace all deprecated characters with a given placeholder (default is '_') More...
|
|
FileType | type () const |
| Get the path file type. More...
|
|
Flags< FileAttributes > | attributes () const |
| Get the path file attributes. More...
|
|
Flags< FilePermissions > | permissions () const |
| Get the path file permissions. More...
|
|
UtcTimestamp | created () const |
| Get the path created UTC timestamp. More...
|
|
UtcTimestamp | modified () const |
| Get the path modified UTC timestamp. More...
|
|
size_t | hardlinks () const |
| Get the path count of hardlinks. More...
|
|
SpaceInfo | space () const |
| Get the path space information. More...
|
|
bool | empty () const noexcept |
| Is the path empty? More...
|
|
bool | HasRoot () const |
| Has root path? More...
|
|
bool | HasRelative () const |
| Has relative path? More...
|
|
bool | HasParent () const |
| Has parent path? More...
|
|
bool | HasFilename () const |
| Has filename? More...
|
|
bool | HasStem () const |
| Has stem? More...
|
|
bool | HasExtension () const |
| Has extension? More...
|
|
bool | IsAbsolute () const |
| Is absolute path? More...
|
|
bool | IsRelative () const |
| Is relative path? More...
|
|
bool | IsExists () const |
| Is the path exists? More...
|
|
bool | IsRegularFile () const |
| Is the path points to regular file? More...
|
|
bool | IsDirectory () const |
| Is the path points to directory? More...
|
|
bool | IsSymlink () const |
| Is the path points to symbolic link? More...
|
|
bool | IsOther () const |
| Is the path points to special file (block, character, FIFO, socket)? More...
|
|
bool | IsEquivalent (const Path &path) const |
| Is the current path is equivalent to the given one (points to the same node on a filesystem)? More...
|
|
void | Clear () noexcept |
| Clear the path content. More...
|
|
Path & | Assign (const Path &path) |
| Assign the given path to the current one. More...
|
|
Path & | Append (const Path &path) |
| Append the given path to the current one. More...
|
|
Path & | Concat (const Path &path) |
| Concatenate the given path to the current one. More...
|
|
Path & | MakePreferred () |
| Convert all path separators to system ones ('\' for Windows or '/' for Unix) More...
|
|
Path & | ReplaceFilename (const Path &filename) |
| Replace the current path filename with a given one. More...
|
|
Path & | ReplaceExtension (const Path &extension) |
| Replace the current path extension with a given one. More...
|
|
Path & | RemoveFilename () |
| Remove the current path filename. More...
|
|
Path & | RemoveExtension () |
| Remove the current path extension. More...
|
|
Path & | RemoveTrailingSeparators () |
| Remove all trailing separators form the current path. More...
|
|
void | swap (Path &path) noexcept |
| Swap two instances. More...
|
|
| Reader () noexcept=default |
|
| Reader (const Reader &) noexcept=default |
|
| Reader (Reader &&) noexcept=default |
|
virtual | ~Reader () noexcept=default |
|
Reader & | operator= (const Reader &) noexcept=default |
|
Reader & | operator= (Reader &&) noexcept=default |
|
std::vector< uint8_t > | ReadAllBytes () |
| Read all bytes. More...
|
|
std::string | ReadAllText () |
| Read all text. More...
|
|
std::vector< std::string > | ReadAllLines () |
| Read all text lines. More...
|
|
| Writer () noexcept=default |
|
| Writer (const Writer &) noexcept=default |
|
| Writer (Writer &&) noexcept=default |
|
virtual | ~Writer () noexcept=default |
|
Writer & | operator= (const Writer &) noexcept=default |
|
Writer & | operator= (Writer &&) noexcept=default |
|
size_t | Write (const std::string &text) |
| Write a text string. More...
|
|
size_t | Write (const std::vector< std::string > &lines) |
| Write text lines. More...
|
|
|
static std::vector< uint8_t > | ReadAllBytes (const Path &path) |
| Read all bytes from the given file. More...
|
|
static std::string | ReadAllText (const Path &path) |
| Read all text from the given file. More...
|
|
static std::vector< std::string > | ReadAllLines (const Path &path) |
| Read all text lines from the given file. More...
|
|
static size_t | WriteAllBytes (const Path &path, const void *buffer, size_t size) |
| Write a bytes buffer into the given file. More...
|
|
static size_t | WriteAllText (const Path &path, const std::string &text) |
| Write a text string into the given file. More...
|
|
static size_t | WriteAllLines (const Path &path, const std::vector< std::string > &lines) |
| Write text lines into the given file. More...
|
|
static void | WriteEmpty (const Path &path) |
| Write an empty file. More...
|
|
static bool | deprecated (char character) noexcept |
| Is the given character is deprecated by the filesystem? More...
|
|
static bool | deprecated (wchar_t character) noexcept |
| Is the given wide character is deprecated by the filesystem? More...
|
|
static std::string | deprecated () |
| Get filesystem deprecated characters ('\', '/', '?', '', '*', ':', '|', '"', '<', '>') More...
|
|
static char | separator () noexcept |
| Get the system path separator character ('\' for Windows or '/' for Unix) More...
|
|
static Path | initial () |
| Get the initial path of the process. More...
|
|
static Path | current () |
| Get the current path of the process. More...
|
|
static Path | executable () |
| Get the executable path of the process. More...
|
|
static Path | home () |
| Get the home path of the process. More...
|
|
static Path | temp () |
| Get the temporary path of the process. More...
|
|
static Path | unique () |
| Get the unique filename in UUID format "00000000-0000-0000-0000-000000000000". More...
|
|
static Path | Copy (const Path &src, const Path &dst, bool overwrite=false) |
| Copy the given source path to destination path (file, empty directory, symlink, etc) More...
|
|
static Path | CopyIf (const Path &src, const Path &dst, const std::string &pattern="", bool overwrite=false) |
| Copy all matched files from the the given source path to destination path (files, directories, symlinks, etc) More...
|
|
static Path | CopyAll (const Path &src, const Path &dst, bool overwrite=false) |
| Recursively copy the given source path to destination path (files, directories, symlinks, etc) More...
|
|
static Path | Rename (const Path &src, const Path &dst) |
| Rename the given source path to destination path (file, empty directory, symlink, etc) More...
|
|
static Path | Remove (const Path &path) |
| Remove the given path (file, empty directory, symlink, etc) from the filesystem. More...
|
|
static Path | RemoveAll (const Path &path) |
| Recursively remove the given path (file, empty directory, symlink, etc) from the filesystem. More...
|
|
static Path | RemoveIf (const Path &path, const std::string &pattern="") |
| Recursively remove the given path matched to the given pattern (file, empty directory, symlink, etc) from the filesystem. More...
|
|
static void | SetAttributes (const Path &path, const Flags< FileAttributes > &attributes) |
| Set file attributes for the given path. More...
|
|
static void | SetPermissions (const Path &path, const Flags< FilePermissions > &permissions) |
| Set file permissions for the given path. More...
|
|
static void | SetCreated (const Path &path, const UtcTimestamp ×tamp) |
| Set created UTC timestamp for the given path. More...
|
|
static void | SetModified (const Path &path, const UtcTimestamp ×tamp) |
| Set modified UTC timestamp for the given path. More...
|
|
static void | SetCurrent (const Path &path) |
| Set the given path of the process as a current one. More...
|
|
static void | Touch (const Path &path) |
| Touch the given path and set its modified UTC timestamp to the current value. More...
|
|
Filesystem file.
Filesystem file wraps file management operations (create, open, read, write, flush, close).
Not thread-safe.
- Examples
- filesystem_file.cpp.
Definition at line 27 of file file.h.