MP4v2

Static Public Member Functions | Static Public Attributes | List of all members
mp4v2::platform::io::FileSystem Class Reference

General file-system abstraction. More...

`#include <FileSystem.h>`

## Static Public Member Functions
static bool | exists (const std::string &name)
| Query file presence. More...
static bool | isDirectory (const std::string &name)
| Query directory type. More...
static bool | isFile (const std::string &name)
| Query file type. More...
static bool | getFileSize (const std::string &name, File::Size &size)
| Query file size. More...
static bool | rename (const std::string &oldname, const std::string &newname)
| Rename file or directory. More...
static void | pathnameTemp (string &name, const std::string &dir=".", const std::string &prefix="tmp", const std::string &suffix="")
| Generate temporary pathname. More...
static void | pathnameCleanup (string &name)
| Cleanup pathname. More...
static void | pathnameOnlyExtension (string &name)
| Remove everything except file extension. More...
static void | pathnameStripExtension (string &name)
| Remove file extension from pathname. More...

## Static Public Attributes
static string | DIR_SEPARATOR
| separator string used in file pathnames
static string | PATH_SEPARATOR
| separator string used in search-paths

## Detailed Description

General file-system abstraction.

FileSystem abstracts operations on files and directories.

## Member Function Documentation

## ◆ 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

  name | filename to query.

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

  name | pathname to modify.

## ◆ 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

  name | pathname to modify.

## ◆ 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

  name | pathname to modify.

## ◆ 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.