#include <inetstl/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 |
Public Types | |
Member Types | |
typedef C | char_type |
The character type. | |
typedef size_t | size_type |
The size type. | |
typedef is_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 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 DWORD | error_type |
The type of system error codes. | |
Static Public Member Functions | |
General string handling | |
static char_type * | char_copy (char_type *dest, char_type const *src, size_type n) |
Copies a specific number of characters from the source to the destination. | |
static char_type * | str_copy (char_type *dest, char_type const *src) |
Copies the contents of src to dest . | |
static char_type * | str_n_copy (char_type *dest, char_type const *src, size_t cch) |
Copies the contents of src to dest , up to cch characters . | |
static char_type * | str_cat (char_type *dest, char_type const *src) |
Appends the contents of src to dest . | |
static int_type | str_compare (char_type const *s1, char_type const *s2) |
Comparies the contents of src and dest . | |
static int_type | str_compare_no_case (char_type const *s1, char_type const *s2) |
Comparies the contents of src and dest in a case-insensitive fashion. | |
static int_type | str_n_compare (char_type const *s1, char_type const *s2, size_type cch) |
Comparies the contents of src and dest up to cch characters. | |
static size_type | str_len (char_type const *src) |
Evaluates the length of src . | |
static char_type * | str_chr (char_type const *s, char_type ch) |
Finds the given character ch in s . | |
static char_type * | str_rchr (char_type const *s, char_type ch) |
Finds the rightmost instance ch in s . | |
static char_type * | str_str (char_type const *s, char_type const *sub) |
Finds the given substring sub in s . | |
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_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 | get_full_path_name (HINTERNET hconn, 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 (HINTERNET hconn, char_type const *fileName, size_type cchBuffer, char_type *buffer) |
Gets the full path name into the given buffer. | |
Internet connectivity | |
static HINTERNET | internet_open (char_type const *agent, is_dword_t accessType, char_type const *proxy, char_type const *proxyBypass, is_dword_t flags) |
Opens a WinInet session. | |
static HINTERNET | internet_connect (HINTERNET hsess, char_type const *server, INTERNET_PORT port, char_type const *userName, char_type const *password, is_dword_t service, is_dword_t flags, is_dword_t context) |
Makes a connection to a FTP or HTTP site. | |
static void | close_connection (HINTERNET hconn) |
Closes the connection to the FTP or HTTP site. | |
File-system enumeration | |
static HINTERNET | find_first_file (HINTERNET hconn, char_type const *spec, find_data_type *findData, is_dword_t flags=0, is_dword_t context=0) |
Initiate a file-system search. | |
static bool_type | find_next_file (HANDLE h, find_data_type *findData) |
Advance a given file-system search. | |
static void | find_close (HINTERNET hfind) |
Closes the file-search. | |
File-system state | |
static bool_type | set_current_directory (HINTERNET hconn, char_type const *dir) |
Sets the current directory to dir . | |
static bool_type | get_current_directory (HINTERNET hconn, size_t &cchBuffer, char_type *buffer) |
Retrieves the name of the current directory into buffer up to a maximum of cchBuffer characters. | |
static bool_type | file_exists (HINTERNET hconn, char_type const *fileName) |
Returns whether a file exists or not. | |
static bool_type | is_file (HINTERNET hconn, char_type const *path) |
Returns whether the given path represents a file. | |
static bool_type | is_directory (HINTERNET hconn, char_type const *path) |
Returns whether the given path represents a directory. | |
static bool_type | stat (HINTERNET hconn, char_type const *path, stat_data_type *stat_data) |
Gets the information for a particular file system entry. | |
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 (HINTERNET hconn, char_type const *dir) |
Creates a directory. | |
static bool_type | remove_directory (HINTERNET hconn, char_type const *dir) |
Deletes a directory. | |
static bool_type | delete_file (HINTERNET hconn, char_type const *file) |
Delete a file. | |
static bool_type | rename_file (HINTERNET hconn, char_type const *currentName, char_type const *newName) |
Rename a file. |
typedef C char_type |
The character type.
typedef size_t size_type |
The size type.
typedef is_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 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 DWORD error_type |
The type of system error codes.
Copies a specific number of characters from the source to the destination.
Copies the contents of src
to dest
.
Copies the contents of src
to dest
, up to cch characters
.
Appends the contents of src
to dest
.
Comparies the contents of src
and dest
.
Comparies the contents of src
and dest
in a case-insensitive fashion.
static int_type str_n_compare | ( | char_type const * | s1, | |
char_type const * | s2, | |||
size_type | cch | |||
) | [static] |
Comparies the contents of src
and dest
up to cch
characters.
Finds the given character ch
in s
.
Finds the rightmost instance ch
in s
.
Finds the given substring sub
in s
.
Returns true
if path is an absolute path.
Returns true
if the character is a path-name separator.
/
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.
static size_type get_full_path_name | ( | HINTERNET | hconn, | |
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 | ( | HINTERNET | hconn, | |
char_type const * | fileName, | |||
size_type | cchBuffer, | |||
char_type * | buffer | |||
) | [static] |
Gets the full path name into the given buffer.
static HINTERNET internet_open | ( | char_type const * | agent, | |
is_dword_t | accessType, | |||
char_type const * | proxy, | |||
char_type const * | proxyBypass, | |||
is_dword_t | flags | |||
) | [static] |
Opens a WinInet session.
static HINTERNET internet_connect | ( | HINTERNET | hsess, | |
char_type const * | server, | |||
INTERNET_PORT | port, | |||
char_type const * | userName, | |||
char_type const * | password, | |||
is_dword_t | service, | |||
is_dword_t | flags, | |||
is_dword_t | context | |||
) | [static] |
Makes a connection to a FTP or HTTP site.
static void close_connection | ( | HINTERNET | hconn | ) | [static] |
Closes the connection to the FTP or HTTP site.
static HINTERNET find_first_file | ( | HINTERNET | hconn, | |
char_type const * | spec, | |||
find_data_type * | findData, | |||
is_dword_t | flags = 0 , |
|||
is_dword_t | context = 0 | |||
) | [static] |
Initiate a file-system search.
static bool_type find_next_file | ( | HANDLE | h, | |
find_data_type * | findData | |||
) | [static] |
Advance a given file-system search.
static void find_close | ( | HINTERNET | hfind | ) | [static] |
Closes the file-search.
Sets the current directory to dir
.
static bool_type get_current_directory | ( | HINTERNET | hconn, | |
size_t & | cchBuffer, | |||
char_type * | buffer | |||
) | [static] |
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 | ( | HINTERNET | hconn, | |
char_type const * | path, | |||
stat_data_type * | stat_data | |||
) | [static] |
Gets the information for a particular file system entry.
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.
Creates a directory.
Deletes a directory.
static bool_type rename_file | ( | HINTERNET | hconn, | |
char_type const * | currentName, | |||
char_type const * | newName | |||
) | [static] |
Rename a file.