#include <winstl/filesystem/path.hpp>
C | The character type | |
T | The traits type. On translators that support default template arguments, this defaults to filesystem_traits<C> | |
A | The allocator type. On translators that support default template arguments, this defaults to processheap_allocator<C> |
push/pop
-based interface Construction | |
basic_path () | |
Constructs an empty path. | |
basic_path (char_type const *path) | |
Constructs a path from a nul-terminated character string. | |
template<typename S> | |
basic_path (S const &s) | |
Constructs a path from a string object. | |
basic_path (char_type const *path, size_type cch) | |
Constructs a path from a slice of a character string. | |
basic_path (class_type const &rhs) | |
Copies the contents of rhs . | |
class_type & | operator= (class_type const &rhs) |
Copies the contents of rhs . | |
class_type & | operator= (char_type const *rhs) |
Copies the contents of rhs . | |
template<typename S> | |
class_type & | operator= (S const &s) |
Copies the contents of s . | |
static class_type | root (char_type const *s) |
template<typename S> | |
static class_type | root (S const &s) |
Attributes | |
char_type const * | get_file () const |
Returns a pointer to the part of the path after the last path name separator. | |
char_type const * | get_ext () const |
Returns a pointer to the extension, or to the empty string if there is no extension. | |
size_type | length () const |
Returns the length of the converted path. | |
size_type | size () const |
Returns the length of the converted path. | |
bool_type | empty () const |
Determines whether the path is empty. | |
char_type const * | c_str () const |
Conversion to a non-mutable (const) pointer to the path. | |
char_type const & | operator[] (size_type index) const |
Returns a non-mutable (const) reference to the character at the given index. | |
bool_type | exists () const |
Indicates whether the path represents an existing file system entry. | |
bool_type | is_rooted () const |
Indicates whether the path is rooted. | |
bool_type | is_absolute () const |
Indicates whether the path is absolute. | |
bool_type | has_sep () const |
Indicates whether the path has a trailing separator. | |
size_type | copy (char_type *buffer, size_type cchBuffer) const |
Copies the contents into a caller supplied buffer. | |
static size_type | max_size () |
The maximum possible length of a path. | |
Public Types | |
Types | |
typedef C | char_type |
The char type. | |
typedef T | traits_type |
The traits type. | |
typedef A | allocator_type |
The allocator type. | |
typedef basic_path< C, T, A > | class_type |
The current parameterisation of the type. | |
typedef size_t | size_type |
The size type. | |
typedef bool | bool_type |
The Boolean type. | |
Public Member Functions | |
Operations | |
class_type & | push (class_type const &rhs, bool_type bAddPathNameSeparator=false) |
Appends the contents of rhs to the path. | |
class_type & | push (char_type const *rhs, bool_type bAddPathNameSeparator=false) |
Appends the contents of rhs to the path. | |
class_type & | push_ext (class_type const &rhs, bool_type bAddPathNameSeparator=false) |
Appends the contents of rhs to the path as an extension. | |
class_type & | push_ext (char_type const *rhs, bool_type bAddPathNameSeparator=false) |
Appends the contents of rhs to the path as an extension. | |
class_type & | push_sep () |
Ensures that the path has a trailing path name separator. | |
class_type & | pop (bool_type bRemoveTrailingPathNameSeparator=true) |
Pops the last path element from the path. | |
class_type & | pop_sep () throw () |
Ensures that the path does not have a trailing path name separator. | |
class_type & | pop_ext () throw () |
Removes the extension, if any, from the file component of the path. | |
class_type & | operator/= (char_type const *rhs) |
Equivalent to push(). | |
template<typename S> | |
class_type & | operator/= (S const &rhs) |
Equivalent to push(). | |
void | clear () |
Removes all content. | |
class_type & | make_absolute (bool_type bRemoveTrailingPathNameSeparator=true) |
Converts the path to absolute form. | |
class_type & | canonicalise (bool_type bRemoveTrailingPathNameSeparator=true) |
Canonicalises the path. | |
Comparison | |
bool_type | equivalent (char_type const *rhs) const |
Determines whether the instance holds a string that refers to the same file-system entity as the given string. | |
bool_type | equivalent (class_type const &rhs) const |
Evaluates whether the two instances hold strings that refer to the same file-system entity. | |
bool_type | equal (char_type const *rhs) const |
Evaluates whether the instance holds an identical string. | |
bool_type | equal (class_type const &rhs) const |
Evaluates whether the two instances hold identical strings. | |
Classes | |
struct | part_type |
typedef C char_type |
The char type.
typedef T traits_type |
The traits type.
typedef A allocator_type |
The allocator type.
typedef basic_path<C, T, A> class_type |
The current parameterisation of the type.
typedef size_t size_type |
The size type.
typedef bool bool_type |
The Boolean type.
basic_path | ( | ) |
basic_path | ( | char_type const * | path | ) | [explicit] |
Constructs a path from a nul-terminated character string.
winstl::path p("C:\\Windows"); assert(10 == p.size()); assert("C:\\Windows" == p); assert("C:\\WINDOWS" == p); assert("c:\\windows" == p);
basic_path | ( | S const & | s | ) | [inline, explicit] |
Constructs a path from a string object.
std::exception
, std::string
, stlsoft::simple_string
, winstl::error_desc
, and many moreHWND hwndParent = . . . HWND hwnd = winstl::CreateEdit(hwndParent, "C:\\Windows", ES_LEFT, 0, 0, 10, 10, 1001); winstl::path p(hwnd); assert(10 == p.size()); assert("C:\\Windows" == p); assert("C:\\WINDOWS" == p); assert("c:\\windows" == p);
References stlsoft_ns_qual.
basic_path | ( | char_type const * | path, | |
size_type | cch | |||
) |
Constructs a path from a slice of a character string.
winstl::path p("C:\\Windows\\system32", 10);
assert(10 == p.size()); assert("C:\\Windows" == p); assert("C:\\WINDOWS" == p); assert("c:\\windows" == p);
basic_path | ( | class_type const & | rhs | ) |
Copies the contents of rhs
.
class_type& operator= | ( | class_type const & | rhs | ) |
Copies the contents of rhs
.
class_type& operator= | ( | char_type const * | rhs | ) |
Copies the contents of rhs
.
class_type& operator= | ( | S const & | s | ) | [inline] |
class_type& push | ( | class_type const & | rhs, | |
bool_type | bAddPathNameSeparator = false | |||
) |
Appends the contents of rhs
to the path.
class_type& push | ( | char_type const * | rhs, | |
bool_type | bAddPathNameSeparator = false | |||
) |
Appends the contents of rhs
to the path.
class_type& push_ext | ( | class_type const & | rhs, | |
bool_type | bAddPathNameSeparator = false | |||
) |
Appends the contents of rhs
to the path as an extension.
class_type& push_ext | ( | char_type const * | rhs, | |
bool_type | bAddPathNameSeparator = false | |||
) |
Appends the contents of rhs
to the path as an extension.
class_type& push_sep | ( | ) |
Ensures that the path has a trailing path name separator.
class_type& pop | ( | bool_type | bRemoveTrailingPathNameSeparator = true |
) |
Pops the last path element from the path.
class_type& pop_sep | ( | ) | throw () |
Ensures that the path does not have a trailing path name separator.
This method is idempotent.
class_type& pop_ext | ( | ) | throw () |
Removes the extension, if any, from the file component of the path.
class_type& operator/= | ( | char_type const * | rhs | ) |
Equivalent to push().
class_type& operator/= | ( | S const & | rhs | ) | [inline] |
void clear | ( | ) |
Removes all content.
class_type& make_absolute | ( | bool_type | bRemoveTrailingPathNameSeparator = true |
) |
Converts the path to absolute form.
class_type& canonicalise | ( | bool_type | bRemoveTrailingPathNameSeparator = true |
) |
Canonicalises the path.
Canonicalises the path, removing all "./" parts and evaluating all "../" parts. Any path with only one part will not be canonicalised. A leading '.' will be preserved if no other '..' or "normal" parts are contained.
bRemoveTrailingPathNameSeparator | Removes any trailing separator, even if no other changes have been made. |
char_type const* get_file | ( | ) | const |
Returns a pointer to the part of the path after the last path name separator.
If the path contains no path name separator, the full path will be returned
char_type const* get_ext | ( | ) | const |
Returns a pointer to the extension, or to the empty string if there is no extension.
size_type length | ( | ) | const |
Returns the length of the converted path.
static size_type max_size | ( | ) | [static] |
The maximum possible length of a path.
bool_type empty | ( | ) | const |
Determines whether the path is empty.
char_type const* c_str | ( | ) | const |
Conversion to a non-mutable (const) pointer to the path.
Returns a non-mutable (const) reference to the character at the given index.
index >= size()
. bool_type exists | ( | ) | const |
Indicates whether the path represents an existing file system entry.
bool_type is_rooted | ( | ) | const |
Indicates whether the path is rooted.
bool_type is_absolute | ( | ) | const |
Indicates whether the path is absolute.
bool_type has_sep | ( | ) | const |
Indicates whether the path has a trailing separator.
Copies the contents into a caller supplied buffer.
buffer | Pointer to character buffer to receive the contents. May be NULL, in which case the method returns size(). | |
cchBuffer | Number of characters of available space in buffer . |
Determines whether the instance holds a string that refers to the same file-system entity as the given string.
///
/// winstl::path p("C:\\Windows\\system32\\.."); /// /// assert(p != "C:\\WINDOWS\\"); /// assert(!p.equal("C:\\WINDOWS\\")); /// assert(p.equivalent("C:\\WINDOWS\\")); //////
bool_type equivalent | ( | class_type const & | rhs | ) | const |
Evaluates whether the two instances hold strings that refer to the same file-system entity.
Evaluates whether the instance holds an identical string.
bool_type equal | ( | class_type const & | rhs | ) | const |
Evaluates whether the two instances hold identical strings.