#include <unixstl/filesystem/filesystem_traits.hpp>
filesystem_traits is a traits class for determining the correct file-system structures and functions for a given character type.
C | The character type (e.g. char , wchar_t ) |
Types | |
typedef C | char_type |
The character type. | |
typedef size_t | size_type |
The size type. | |
typedef us_ptrdiff_t | difference_type |
The difference type. | |
typedef struct stat | stat_data_type |
The stat data type. | |
typedef struct stat | fstat_data_type |
The fstat data type. | |
typedef filesystem_traits< C > | class_type |
The current instantion of the type. | |
typedef int | int_type |
The (signed) integer type. | |
typedef bool | bool_type |
The Boolean type. | |
typedef int | file_handle_type |
The type of a system file handle. | |
typedef void * | module_type |
The type of a handle to a dynamically loaded module. | |
typedef int | error_type |
The type of system error codes. | |
typedef mode_t | mode_type |
The mode type. | |
Static Public Member Functions | |
File-system entry names | |
static char_type * | ensure_dir_end (char_type *dir) |
Appends a path name separator to dir if one does not exist. | |
static char_type * | remove_dir_end (char_type *dir) |
Removes the path name separator from the end of dir , if it has it. | |
static bool_type | has_dir_end (char_type const *dir) |
Returns true if dir has trailing path name separator. | |
static bool_type | is_dots (char_type const *dir) |
Returns true if dir is "." or ".." . | |
static bool_type | is_path_rooted (char_type const *path) |
Returns true if path is rooted. | |
static bool_type | is_path_absolute (char_type const *path) |
Returns true if path is an absolute path. | |
static bool_type | is_path_UNC (char_type const *path) |
Returns true if path is a UNC path. | |
static bool_type | is_root_designator (char_type const *path) |
Indicates whether the given path is the root designator. | |
static bool_type | is_path_name_separator (char_type ch) |
Returns true if the character is a path-name separator. | |
static char_type | path_separator () |
Returns the path separator. | |
static char_type | path_name_separator () |
Returns the path name separator. | |
static char_type const * | pattern_all () |
Returns the wildcard pattern that represents all possible matches. | |
static size_type | path_max () |
The maximum length of a path on the file-system. | |
static size_type | get_full_path_name (char_type const *fileName, size_type cchBuffer, char_type *buffer, char_type **ppFile) |
Gets the full path name into the given buffer, returning a pointer to the file-part. | |
static size_type | get_full_path_name (char_type const *fileName, char_type *buffer, size_type cchBuffer) |
Gets the full path name into the given buffer. | |
static size_type | get_full_path_name (char_type const *fileName, size_type cchBuffer, char_type *buffer) |
Gets the full path name into the given buffer. | |
static size_type | get_short_path_name (char_type const *fileName, size_type cchBuffer, char_type *buffer) |
Gets the short path name into the given buffer. | |
File-system enumeration | |
static DIR * | open_dir (char_type const *dir) |
Initiate a file-system search. | |
static struct dirent const * | read_dir (DIR *h) |
Read an entry from the file-system search. | |
static void | close_dir (DIR *h) |
Closes the handle of the file-system search. | |
File-system control | |
static bool_type | set_current_directory (char_type const *dir) |
Sets the current directory to dir . | |
static size_type | get_current_directory (size_type cchBuffer, char_type *buffer) |
Retrieves the name of the current directory into buffer up to a maximum of cchBuffer characters. | |
static size_type | get_current_directory (char_type *buffer, size_type cchBuffer) |
Retrieves the name of the current directory into buffer up to a maximum of cchBuffer characters. | |
File-system state | |
static bool_type | file_exists (char_type const *path) |
Returns whether a file exists or not. | |
static bool_type | is_file (char_type const *path) |
Returns whether the given path represents a file. | |
static bool_type | is_directory (char_type const *path) |
Returns whether the given path represents a directory. | |
static bool_type | stat (char_type const *path, stat_data_type *stat_data) |
Gets the information for a particular file system entry. | |
static bool_type | lstat (char_type const *path, stat_data_type *stat_data) |
Gets the information for a particular file system entry. | |
static bool_type | fstat (file_handle_type fd, fstat_data_type *fstat_data) |
Gets the information for a particular open file. | |
static bool_type | is_file (stat_data_type const *stat_data) |
Returns whether the given stat info represents a file. | |
static bool_type | is_directory (stat_data_type const *stat_data) |
Returns whether the given stat info represents a directory. | |
static bool_type | is_link (stat_data_type const *stat_data) |
Returns whether the given stat info represents a link. | |
static bool_type | is_readonly (stat_data_type const *stat_data) |
Returns whether the given stat info represents a read-only entry. | |
File-system control | |
static bool_type | create_directory (char_type const *dir) |
Creates a directory. | |
static bool_type | remove_directory (char_type const *dir) |
Deletes a directory. | |
static bool_type | unlink_file (char_type const *file) |
Delete a file. | |
static bool_type | delete_file (char_type const *file) |
Delete a file. | |
static bool_type | rename_file (char_type const *currentName, char_type const *newName) |
Rename a file. | |
static file_handle_type | open_file (char_type const *fileName, int oflag, int pmode) |
Copy a file. | |
static bool_type | close_file (file_handle_type fd) |
Closes the given operating system handle. | |
static file_handle_type | open (char_type const *fileName, int oflag, int pmode) |
Create / open a file. | |
static bool_type | close (file_handle_type fd) |
Closes the given operating system handle. |
typedef C char_type |
typedef size_t size_type |
typedef us_ptrdiff_t difference_type |
typedef struct stat stat_data_type [read] |
The stat data type.
typedef struct stat fstat_data_type [read] |
The fstat data type.
typedef filesystem_traits<C> class_type |
typedef int int_type |
typedef bool bool_type |
typedef int file_handle_type |
The type of a system file handle.
typedef void* module_type |
typedef int error_type |
typedef mode_t mode_type |
The mode type.
Returns true
if path is rooted.
path
as are necessary to detect the presence or absence of the operating system's root character sequence(s).
Returns true
if path is an absolute path.
path
as are necessary to detect the presence or absence of the operating system's absolute path character sequence(s).
Returns true
if path is a UNC path.
path
as are necessary to detect the presence or absence of the UNC character sequence(s). Indicates whether the given path is the root designator.
The root designator is one of the following:
/
The function returns false if the path contains any part of a file name (or extension), directory, or share.
Returns true
if the character is a path-name separator.
static char_type path_separator | ( | ) | [static] |
Returns the path separator.
This is the separator that is used to separate multiple paths on the operating system. On UNIX it is ':'
static char_type path_name_separator | ( | ) | [static] |
Returns the path name separator.
This is the separator that is used to separate parts of a path on the operating system. On UNIX it is '/'
static char_type const* pattern_all | ( | ) | [static] |
Returns the wildcard pattern that represents all possible matches.
static size_type path_max | ( | ) | [static] |
The maximum length of a path on the file-system.
static size_type get_full_path_name | ( | char_type const * | fileName, | |
size_type | cchBuffer, | |||
char_type * | buffer, | |||
char_type ** | ppFile | |||
) | [static] |
Gets the full path name into the given buffer, returning a pointer to the file-part.
static size_type get_full_path_name | ( | char_type const * | fileName, | |
char_type * | buffer, | |||
size_type | cchBuffer | |||
) | [static] |
Gets the full path name into the given buffer.
static size_type get_full_path_name | ( | char_type const * | fileName, | |
size_type | cchBuffer, | |||
char_type * | buffer | |||
) | [static] |
Gets the full path name into the given buffer.
static size_type get_short_path_name | ( | char_type const * | fileName, | |
size_type | cchBuffer, | |||
char_type * | buffer | |||
) | [static] |
Gets the short path name into the given buffer.
static DIR* open_dir | ( | char_type const * | dir | ) | [static] |
Initiate a file-system search.
static struct dirent const* read_dir | ( | DIR * | h | ) | [static, read] |
Read an entry from the file-system search.
static void close_dir | ( | DIR * | h | ) | [static] |
Closes the handle of the file-system search.
Sets the current directory to dir
.
Retrieves the name of the current directory into buffer
up to a maximum of cchBuffer
characters.
Retrieves the name of the current directory into buffer
up to a maximum of cchBuffer
characters.
Returns whether a file exists or not.
Returns whether the given path represents a file.
Returns whether the given path represents a directory.
static bool_type stat | ( | char_type const * | path, | |
stat_data_type * | stat_data | |||
) | [static] |
Gets the information for a particular file system entry.
static bool_type lstat | ( | char_type const * | path, | |
stat_data_type * | stat_data | |||
) | [static] |
Gets the information for a particular file system entry.
static bool_type fstat | ( | file_handle_type | fd, | |
fstat_data_type * | fstat_data | |||
) | [static] |
Gets the information for a particular open file.
static bool_type is_file | ( | stat_data_type const * | stat_data | ) | [static] |
Returns whether the given stat info represents a file.
static bool_type is_directory | ( | stat_data_type const * | stat_data | ) | [static] |
Returns whether the given stat info represents a directory.
static bool_type is_link | ( | stat_data_type const * | stat_data | ) | [static] |
Returns whether the given stat info represents a link.
static bool_type is_readonly | ( | stat_data_type const * | stat_data | ) | [static] |
Returns whether the given stat info represents a read-only entry.
Rename a file.
static file_handle_type open_file | ( | char_type const * | fileName, | |
int | oflag, | |||
int | pmode | |||
) | [static] |
Copy a file.
Create / open a file
static bool_type close_file | ( | file_handle_type | fd | ) | [static] |
Closes the given operating system handle.
static file_handle_type open | ( | char_type const * | fileName, | |
int | oflag, | |||
int | pmode | |||
) | [static] |
static bool_type close | ( | file_handle_type | fd | ) | [static] |