filesystem_traits Struct Template Reference
[File System Library]

#include <unixstl/filesystem/filesystem_traits.hpp>

Inheritance diagram for filesystem_traits:

system_traits

List of all members.


Detailed Description

template<typename C>
struct unixstl::filesystem_traits< C >

Traits class for file-system operations.

filesystem_traits is a traits class for determining the correct file-system structures and functions for a given character type.

Parameters:
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_typeensure_dir_end (char_type *dir)
 Appends a path name separator to dir if one does not exist.
static char_typeremove_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.

Member Typedef Documentation

typedef C char_type

The character type.

Reimplemented from system_traits.

typedef size_t size_type

The size type.

Reimplemented from system_traits.

typedef us_ptrdiff_t difference_type

The difference type.

Reimplemented from system_traits.

typedef struct stat stat_data_type [read]

The stat data type.

typedef struct stat fstat_data_type [read]

The fstat data type.

The current instantion of the type.

Reimplemented from system_traits.

typedef int int_type

The (signed) integer type.

Reimplemented from system_traits.

typedef bool bool_type

The Boolean type.

Reimplemented from system_traits.

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.

Reimplemented from system_traits.

typedef int error_type

The type of system error codes.

Reimplemented from system_traits.

typedef mode_t mode_type

The mode type.


Member Function Documentation

static char_type* ensure_dir_end ( char_type dir  )  [static]

Appends a path name separator to dir if one does not exist.

See also:
path_name_separator()

static char_type* remove_dir_end ( char_type dir  )  [static]

Removes the path name separator from the end of dir, if it has it.

See also:
path_name_separator()

static bool_type has_dir_end ( char_type const *  dir  )  [static]

Returns true if dir has trailing path name separator.

See also:
path_name_separator()

static bool_type is_dots ( char_type const *  dir  )  [static]

Returns true if dir is "." or "..".

static bool_type is_path_rooted ( char_type const *  path  )  [static]

Returns true if path is rooted.

Note:
Only enough characters of the path pointed to by path as are necessary to detect the presence or absence of the operating system's root character sequence(s).

static bool_type is_path_absolute ( char_type const *  path  )  [static]

Returns true if path is an absolute path.

Note:
Only enough characters of the path pointed to by path as are necessary to detect the presence or absence of the operating system's absolute path character sequence(s).

static bool_type is_path_UNC ( char_type const *  path  )  [static]

Returns true if path is a UNC path.

Note:
Only enough characters of the path pointed to by path as are necessary to detect the presence or absence of the UNC character sequence(s).

static bool_type is_root_designator ( char_type const *  path  )  [static]

Indicates whether the given path is the root designator.

The root designator is one of the following:

  • the slash character /

The function returns false if the path contains any part of a file name (or extension), directory, or share.

static bool_type is_path_name_separator ( char_type  ch  )  [static]

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.

Note:
On UNIX it is '*'

static size_type path_max (  )  [static]

The maximum length of a path on the file-system.

Note:
Because not all systems support fixed maximum path lengths, the value of this function is notionally dynamic

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.

Deprecated:
The other overload is now the preferred form

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.

static bool_type set_current_directory ( char_type const *  dir  )  [static]

Sets the current directory to dir.

static size_type get_current_directory ( size_type  cchBuffer,
char_type buffer 
) [static]

Retrieves the name of the current directory into buffer up to a maximum of cchBuffer characters.

Deprecated:
The other overload is now the preferred form

static size_type get_current_directory ( char_type buffer,
size_type  cchBuffer 
) [static]

Retrieves the name of the current directory into buffer up to a maximum of cchBuffer characters.

static bool_type file_exists ( char_type const *  path  )  [static]

Returns whether a file exists or not.

static bool_type is_file ( char_type const *  path  )  [static]

Returns whether the given path represents a file.

static bool_type is_directory ( char_type const *  path  )  [static]

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.

static bool_type create_directory ( char_type const *  dir  )  [static]

Creates a directory.

static bool_type remove_directory ( char_type const *  dir  )  [static]

Deletes a directory.

static bool_type unlink_file ( char_type const *  file  )  [static]

Delete a file.

static bool_type delete_file ( char_type const *  file  )  [static]

Delete a file.

Deprecated:
Users should use unlink_file()

static bool_type rename_file ( char_type const *  currentName,
char_type const *  newName 
) [static]

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]

Create / open a file.

Deprecated:
Users should use open_file()

static bool_type close ( file_handle_type  fd  )  [static]

Closes the given operating system handle.

Deprecated:
Users should use close_file()


The documentation for this struct was generated from the following file:

Generated on Thu Jun 10 08:59:07 2010 for STLSoft by  doxygen 1.5.6