General file-system abstraction.
More...
General file-system abstraction.
FileSystem abstracts operations on files and directories.
◆ exists()
static bool mp4v2::platform::io::FileSystem::exists |
( |
const std::string & |
name | ) |
|
|
static |
Query file presence.
Check if name exists.
- Parameters
-
name | filename to query. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
- Returns
- true if present, false otherwise.
◆ getFileSize()
static bool mp4v2::platform::io::FileSystem::getFileSize |
( |
const std::string & |
name, |
|
|
File::Size & |
size |
|
) |
| |
|
static |
Query file size.
Check if name exists and is a file.
- Parameters
-
name | filename to query. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
size | output indicating file size in bytes. |
- Returns
- true on failure, false on success.
◆ isDirectory()
static bool mp4v2::platform::io::FileSystem::isDirectory |
( |
const std::string & |
name | ) |
|
|
static |
Query directory type.
Check if name exists and is a directory.
- Parameters
-
name | pathname to query. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
- Returns
- true if directory, false otherwise.
◆ isFile()
static bool mp4v2::platform::io::FileSystem::isFile |
( |
const std::string & |
name | ) |
|
|
static |
Query file type.
Check if name exists and is a file. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible).
- Parameters
-
- Returns
- true if file, false otherwise.
◆ pathnameCleanup()
static void mp4v2::platform::io::FileSystem::pathnameCleanup |
( |
string & |
name | ) |
|
|
static |
Cleanup pathname.
Redundant (repeating) directory-separators are folded into a single directory-separator.
Redundant /./ are folded into a single directory-separator.
- Parameters
-
◆ pathnameOnlyExtension()
static void mp4v2::platform::io::FileSystem::pathnameOnlyExtension |
( |
string & |
name | ) |
|
|
static |
Remove everything except file extension.
A pathname cleanup is always performed. See pathnameCleanup(). A file extension is considered to everything after the last '.' in the file component of a pathname. If no file extension exists then an empty-string is output.
- Parameters
-
◆ pathnameStripExtension()
static void mp4v2::platform::io::FileSystem::pathnameStripExtension |
( |
string & |
name | ) |
|
|
static |
Remove file extension from pathname.
A pathname cleanup is always performed. See pathnameCleanup(). A file extension is considered to everything after the last '.' in the file component of a pathname. The last '.' is also removed.
- Parameters
-
◆ pathnameTemp()
static void mp4v2::platform::io::FileSystem::pathnameTemp |
( |
string & |
name, |
|
|
const std::string & |
dir = "." , |
|
|
const std::string & |
prefix = "tmp" , |
|
|
const std::string & |
suffix = "" |
|
) |
| |
|
static |
Generate temporary pathname.
- Parameters
-
name | output containing generated pathname. |
dir | relative or absolute directory of pathname. |
prefix | text prepended to base pathname. |
suffix | text appended to base pathname. |
◆ rename()
static bool mp4v2::platform::io::FileSystem::rename |
( |
const std::string & |
oldname, |
|
|
const std::string & |
newname |
|
) |
| |
|
static |
Rename file or directory.
Rename oldname to newname. If newname exists, it is first removed. Both oldname and newname must be of the same type; that is, both must be either files or directories and must reside on the same filesystem.
- Parameters
-
oldname | existing pathname to rename. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
newname | new pathname. On Windows, this should be a UTF-8 encoded string. On other platforms, it should be an 8-bit encoding that is appropriate for the platform, locale, file system, etc. (prefer to use UTF-8 when possible). |
- Returns
- true on failure, false on success.