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