filesystem_traits Struct Template Reference
[File System Library]

#include <winstl/filesystem/filesystem_traits.hpp>

Inheritance diagram for filesystem_traits:

system_traits

List of all members.


Detailed Description

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

Traits for accessing the correct file-system functions for a given character type.

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 ws_ptrdiff_t difference_type
 The difference type.
typedef WIN32_FIND_DATA find_data_type
 The find data type.
typedef WIN32_FIND_DATA stat_data_type
 The stat data type.
typedef BY_HANDLE_FILE_INFORMATION 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 HANDLE file_handle_type
 The type of a system file handle.
typedef HINSTANCE module_type
 The type of a handle to a dynamically loaded module.
typedef DWORD error_type
 The type of system error codes.

File-system control

static bool_type create_directory (char_type const *dir)
 Creates a directory.
static bool_type create_directory (char_type const *dir, LPSECURITY_ATTRIBUTES lpsa)
 Creates a directory, with the given security attributes.
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 bool_type copy_file (char_type const *sourceName, char_type const *newName, bool_type bFailIfExists=false)
 Copy a file.
static file_handle_type create_file (char_type const *fileName, size_type desiredAccess, size_type shareMode, LPSECURITY_ATTRIBUTES sa, size_type creationDisposition, size_type flagAndAttributes, HANDLE hTemplateFile)
 Create / open a file.
static bool_type close_file (file_handle_type h)
 Closes the given file handle.

Public Types

Member Constants
enum  { maxPathLength = 1 + WINSTL_CONST_MAX_PATH }

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, i.e.
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.
static size_type get_short_path_name (char_type const *fileName, char_type *buffer, size_type cchBuffer)
 Gets the short path name into the given buffer.
File-system enumeration
static HANDLE find_first_file (char_type const *spec, find_data_type *findData)
 Initiate a file-system search.
static HANDLE find_first_file_ex (char_type const *spec, FINDEX_SEARCH_OPS flags, find_data_type *findData)
 Initiate a file-system search - NT4+-only.
static bool_type find_next_file (HANDLE h, find_data_type *findData)
 Advance a given file-system search.
static void find_file_close (HANDLE h)
 Closes the handle of the file-system search.
static HANDLE find_first_volume (char_type *volume_name, size_type cch_volume_name)
 Initiate a file-system volume search.
static bool_type find_next_volume (HANDLE h, char_type *volume_name, size_type cch_volume_name)
 Advance a given file-system volume search.
static void find_volume_close (HANDLE h)
 Closes the handle of the file-volume 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 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_file (fstat_data_type const *stat_data)
static bool_type is_directory (stat_data_type const *stat_data)
 Returns whether the given stat info represents a directory.
static bool_type is_directory (fstat_data_type const *stat_data)
static bool_type is_link (stat_data_type const *stat_data)
 Returns whether the given stat info represents a link.
static bool_type is_link (fstat_data_type const *stat_data)
static bool_type is_readonly (stat_data_type const *stat_data)
 Returns whether the given stat info represents a read-only entry.
static bool_type is_readonly (fstat_data_type const *stat_data)
static bool_type drive_exists (char_type driveLetter)
 Indicates whether the given drive currently exists on the system.
static DWORD get_drive_type (char_type driveLetter)
 Returns a status code denoting the type of the drive.

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 ws_ptrdiff_t difference_type

The difference type.

Reimplemented from system_traits.

typedef WIN32_FIND_DATA find_data_type

The find data type.

typedef WIN32_FIND_DATA stat_data_type

The stat data type.

typedef BY_HANDLE_FILE_INFORMATION fstat_data_type

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 HANDLE file_handle_type

The type of a system file handle.

typedef HINSTANCE module_type

The type of a handle to a dynamically loaded module.

Reimplemented from system_traits.

typedef DWORD error_type

The type of system error codes.

Reimplemented from system_traits.


Member Enumeration Documentation

anonymous enum

Enumerator:
maxPathLength  The maximum length of a path for the current file system.


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, i.e.

it begins with root directory

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 backslash character \
  • a drive specification, e.g. H:\ or H:/
  • a UNC host, e.g. H:\\host or H:\\host\

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.

Note:
Both / and \ are interpreted as 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 Win32 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.

Deprecated:
The other overload is now the preferred form

static size_type get_short_path_name ( char_type const *  fileName,
char_type buffer,
size_type  cchBuffer 
) [static]

Gets the short path name into the given buffer.

static HANDLE find_first_file ( char_type const *  spec,
find_data_type findData 
) [static]

Initiate a file-system search.

static HANDLE find_first_file_ex ( char_type const *  spec,
FINDEX_SEARCH_OPS  flags,
find_data_type findData 
) [static]

Initiate a file-system search - NT4+-only.

static bool_type find_next_file ( HANDLE  h,
find_data_type findData 
) [static]

Advance a given file-system search.

static void find_file_close ( HANDLE  h  )  [static]

Closes the handle of the file-system search.

static HANDLE find_first_volume ( char_type volume_name,
size_type  cch_volume_name 
) [static]

Initiate a file-system volume search.

static bool_type find_next_volume ( HANDLE  h,
char_type volume_name,
size_type  cch_volume_name 
) [static]

Advance a given file-system volume search.

static void find_volume_close ( HANDLE  h  )  [static]

Closes the handle of the file-volume 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 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 drive_exists ( char_type  driveLetter  )  [static]

Indicates whether the given drive currently exists on the system.

static DWORD get_drive_type ( char_type  driveLetter  )  [static]

Returns a status code denoting the type of the drive.

Returns:
One of the return codes of the GetDriveType() API function

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

Creates a directory.

static bool_type create_directory ( char_type const *  dir,
LPSECURITY_ATTRIBUTES  lpsa 
) [static]

Creates a directory, with the given security attributes.

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 bool_type copy_file ( char_type const *  sourceName,
char_type const *  newName,
bool_type  bFailIfExists = false 
) [static]

Copy a file.

static file_handle_type create_file ( char_type const *  fileName,
size_type  desiredAccess,
size_type  shareMode,
LPSECURITY_ATTRIBUTES  sa,
size_type  creationDisposition,
size_type  flagAndAttributes,
HANDLE  hTemplateFile 
) [static]

Create / open a file.

static bool_type close_file ( file_handle_type  h  )  [static]

Closes the given file handle.


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

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