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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="fs.class.path.general">[[fs.class.path.general]]</a>
|
| 2 |
+
|
| 3 |
+
An object of class `path` represents a path and contains a pathname.
|
| 4 |
+
Such an object is concerned only with the lexical and syntactic aspects
|
| 5 |
+
of a path. The path does not necessarily exist in external storage, and
|
| 6 |
+
the pathname is not necessarily valid for the current operating system
|
| 7 |
+
or for a particular file system.
|
| 8 |
+
|
| 9 |
+
[*Note 1*: Class `path` is used to support the differences between the
|
| 10 |
+
string types used by different operating systems to represent pathnames,
|
| 11 |
+
and to perform conversions between encodings when
|
| 12 |
+
necessary. — *end note*]
|
| 13 |
+
|
| 14 |
+
A *path* is a sequence of elements that identify the location of a file
|
| 15 |
+
within a filesystem. The elements are the *root-name*ₒₚₜ ,
|
| 16 |
+
*root-directory*ₒₚₜ , and an optional sequence of *filename*s
|
| 17 |
+
[[fs.path.generic]]. The maximum number of elements in the sequence is
|
| 18 |
+
operating system dependent [[fs.conform.os]].
|
| 19 |
+
|
| 20 |
+
An *absolute path* is a path that unambiguously identifies the location
|
| 21 |
+
of a file without reference to an additional starting location. The
|
| 22 |
+
elements of a path that determine if it is absolute are operating system
|
| 23 |
+
dependent. A *relative path* is a path that is not absolute, and as
|
| 24 |
+
such, only unambiguously identifies the location of a file when resolved
|
| 25 |
+
relative to an implied starting location. The elements of a path that
|
| 26 |
+
determine if it is relative are operating system dependent.
|
| 27 |
+
|
| 28 |
+
[*Note 2*: Pathnames “.” and “..” are relative paths. — *end note*]
|
| 29 |
+
|
| 30 |
+
A *pathname* is a character string that represents the name of a path.
|
| 31 |
+
Pathnames are formatted according to the generic pathname format grammar
|
| 32 |
+
[[fs.path.generic]] or according to an operating system dependent
|
| 33 |
+
*native pathname format* accepted by the host operating system.
|
| 34 |
+
|
| 35 |
+
*Pathname resolution* is the operating system dependent mechanism for
|
| 36 |
+
resolving a pathname to a particular file in a file hierarchy. There may
|
| 37 |
+
be multiple pathnames that resolve to the same file.
|
| 38 |
+
|
| 39 |
+
[*Example 1*: POSIX specifies the mechanism in section 4.12, Pathname
|
| 40 |
+
resolution. — *end example*]
|
| 41 |
+
|
| 42 |
+
``` cpp
|
| 43 |
+
namespace std::filesystem {
|
| 44 |
+
class path {
|
| 45 |
+
public:
|
| 46 |
+
using value_type = see below;
|
| 47 |
+
using string_type = basic_string<value_type>;
|
| 48 |
+
static constexpr value_type preferred_separator = see below;
|
| 49 |
+
|
| 50 |
+
// [fs.enum.path.format], enumeration format
|
| 51 |
+
enum format;
|
| 52 |
+
|
| 53 |
+
// [fs.path.construct], constructors and destructor
|
| 54 |
+
path() noexcept;
|
| 55 |
+
path(const path& p);
|
| 56 |
+
path(path&& p) noexcept;
|
| 57 |
+
path(string_type&& source, format fmt = auto_format);
|
| 58 |
+
template<class Source>
|
| 59 |
+
path(const Source& source, format fmt = auto_format);
|
| 60 |
+
template<class InputIterator>
|
| 61 |
+
path(InputIterator first, InputIterator last, format fmt = auto_format);
|
| 62 |
+
template<class Source>
|
| 63 |
+
path(const Source& source, const locale& loc, format fmt = auto_format);
|
| 64 |
+
template<class InputIterator>
|
| 65 |
+
path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format);
|
| 66 |
+
~path();
|
| 67 |
+
|
| 68 |
+
// [fs.path.assign], assignments
|
| 69 |
+
path& operator=(const path& p);
|
| 70 |
+
path& operator=(path&& p) noexcept;
|
| 71 |
+
path& operator=(string_type&& source);
|
| 72 |
+
path& assign(string_type&& source);
|
| 73 |
+
template<class Source>
|
| 74 |
+
path& operator=(const Source& source);
|
| 75 |
+
template<class Source>
|
| 76 |
+
path& assign(const Source& source);
|
| 77 |
+
template<class InputIterator>
|
| 78 |
+
path& assign(InputIterator first, InputIterator last);
|
| 79 |
+
|
| 80 |
+
// [fs.path.append], appends
|
| 81 |
+
path& operator/=(const path& p);
|
| 82 |
+
template<class Source>
|
| 83 |
+
path& operator/=(const Source& source);
|
| 84 |
+
template<class Source>
|
| 85 |
+
path& append(const Source& source);
|
| 86 |
+
template<class InputIterator>
|
| 87 |
+
path& append(InputIterator first, InputIterator last);
|
| 88 |
+
|
| 89 |
+
// [fs.path.concat], concatenation
|
| 90 |
+
path& operator+=(const path& x);
|
| 91 |
+
path& operator+=(const string_type& x);
|
| 92 |
+
path& operator+=(basic_string_view<value_type> x);
|
| 93 |
+
path& operator+=(const value_type* x);
|
| 94 |
+
path& operator+=(value_type x);
|
| 95 |
+
template<class Source>
|
| 96 |
+
path& operator+=(const Source& x);
|
| 97 |
+
template<class EcharT>
|
| 98 |
+
path& operator+=(EcharT x);
|
| 99 |
+
template<class Source>
|
| 100 |
+
path& concat(const Source& x);
|
| 101 |
+
template<class InputIterator>
|
| 102 |
+
path& concat(InputIterator first, InputIterator last);
|
| 103 |
+
|
| 104 |
+
// [fs.path.modifiers], modifiers
|
| 105 |
+
void clear() noexcept;
|
| 106 |
+
path& make_preferred();
|
| 107 |
+
path& remove_filename();
|
| 108 |
+
path& replace_filename(const path& replacement);
|
| 109 |
+
path& replace_extension(const path& replacement = path());
|
| 110 |
+
void swap(path& rhs) noexcept;
|
| 111 |
+
|
| 112 |
+
// [fs.path.nonmember], non-member operators
|
| 113 |
+
friend bool operator==(const path& lhs, const path& rhs) noexcept;
|
| 114 |
+
friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept;
|
| 115 |
+
|
| 116 |
+
friend path operator/(const path& lhs, const path& rhs);
|
| 117 |
+
|
| 118 |
+
// [fs.path.native.obs], native format observers
|
| 119 |
+
const string_type& native() const noexcept;
|
| 120 |
+
const value_type* c_str() const noexcept;
|
| 121 |
+
operator string_type() const;
|
| 122 |
+
|
| 123 |
+
template<class EcharT, class traits = char_traits<EcharT>,
|
| 124 |
+
class Allocator = allocator<EcharT>>
|
| 125 |
+
basic_string<EcharT, traits, Allocator>
|
| 126 |
+
string(const Allocator& a = Allocator()) const;
|
| 127 |
+
std::string string() const;
|
| 128 |
+
std::wstring wstring() const;
|
| 129 |
+
std::u8string u8string() const;
|
| 130 |
+
std::u16string u16string() const;
|
| 131 |
+
std::u32string u32string() const;
|
| 132 |
+
|
| 133 |
+
// [fs.path.generic.obs], generic format observers
|
| 134 |
+
template<class EcharT, class traits = char_traits<EcharT>,
|
| 135 |
+
class Allocator = allocator<EcharT>>
|
| 136 |
+
basic_string<EcharT, traits, Allocator>
|
| 137 |
+
generic_string(const Allocator& a = Allocator()) const;
|
| 138 |
+
std::string generic_string() const;
|
| 139 |
+
std::wstring generic_wstring() const;
|
| 140 |
+
std::u8string generic_u8string() const;
|
| 141 |
+
std::u16string generic_u16string() const;
|
| 142 |
+
std::u32string generic_u32string() const;
|
| 143 |
+
|
| 144 |
+
// [fs.path.compare], compare
|
| 145 |
+
int compare(const path& p) const noexcept;
|
| 146 |
+
int compare(const string_type& s) const;
|
| 147 |
+
int compare(basic_string_view<value_type> s) const;
|
| 148 |
+
int compare(const value_type* s) const;
|
| 149 |
+
|
| 150 |
+
// [fs.path.decompose], decomposition
|
| 151 |
+
path root_name() const;
|
| 152 |
+
path root_directory() const;
|
| 153 |
+
path root_path() const;
|
| 154 |
+
path relative_path() const;
|
| 155 |
+
path parent_path() const;
|
| 156 |
+
path filename() const;
|
| 157 |
+
path stem() const;
|
| 158 |
+
path extension() const;
|
| 159 |
+
|
| 160 |
+
// [fs.path.query], query
|
| 161 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 162 |
+
bool has_root_name() const;
|
| 163 |
+
bool has_root_directory() const;
|
| 164 |
+
bool has_root_path() const;
|
| 165 |
+
bool has_relative_path() const;
|
| 166 |
+
bool has_parent_path() const;
|
| 167 |
+
bool has_filename() const;
|
| 168 |
+
bool has_stem() const;
|
| 169 |
+
bool has_extension() const;
|
| 170 |
+
bool is_absolute() const;
|
| 171 |
+
bool is_relative() const;
|
| 172 |
+
|
| 173 |
+
// [fs.path.gen], generation
|
| 174 |
+
path lexically_normal() const;
|
| 175 |
+
path lexically_relative(const path& base) const;
|
| 176 |
+
path lexically_proximate(const path& base) const;
|
| 177 |
+
|
| 178 |
+
// [fs.path.itr], iterators
|
| 179 |
+
class iterator;
|
| 180 |
+
using const_iterator = iterator;
|
| 181 |
+
|
| 182 |
+
iterator begin() const;
|
| 183 |
+
iterator end() const;
|
| 184 |
+
|
| 185 |
+
// [fs.path.io], path inserter and extractor
|
| 186 |
+
template<class charT, class traits>
|
| 187 |
+
friend basic_ostream<charT, traits>&
|
| 188 |
+
operator<<(basic_ostream<charT, traits>& os, const path& p);
|
| 189 |
+
template<class charT, class traits>
|
| 190 |
+
friend basic_istream<charT, traits>&
|
| 191 |
+
operator>>(basic_istream<charT, traits>& is, path& p);
|
| 192 |
+
};
|
| 193 |
+
}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
`value_type` is a `typedef` for the operating system dependent encoded
|
| 197 |
+
character type used to represent pathnames.
|
| 198 |
+
|
| 199 |
+
The value of the `preferred_separator` member is the operating system
|
| 200 |
+
dependent *preferred-separator* character [[fs.path.generic]].
|
| 201 |
+
|
| 202 |
+
[*Example 2*: For POSIX-based operating systems, `value_type` is `char`
|
| 203 |
+
and `preferred_separator` is the slash character (`'/'`). For
|
| 204 |
+
Windows-based operating systems, `value_type` is `wchar_t` and
|
| 205 |
+
`preferred_separator` is the backslash character
|
| 206 |
+
(`L'\\'`). — *end example*]
|
| 207 |
+
|