Init
This commit is contained in:
506
cppdraft/fs/class/directory/entry.md
Normal file
506
cppdraft/fs/class/directory/entry.md
Normal file
@@ -0,0 +1,506 @@
|
||||
[fs.class.directory.entry]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.directory.entry)
|
||||
|
||||
### 31.12.10 Class directory_entry [fs.class.directory.entry]
|
||||
|
||||
#### [31.12.10.1](#general) General [[fs.class.directory.entry.general]](fs.class.directory.entry.general)
|
||||
|
||||
[ð](#lib:directory_entry)
|
||||
|
||||
namespace std::filesystem {class directory_entry {public:// [[fs.dir.entry.cons]](#fs.dir.entry.cons "31.12.10.2 Constructors"), constructors and destructor directory_entry() noexcept = default;
|
||||
directory_entry(const directory_entry&) = default;
|
||||
directory_entry(directory_entry&&) noexcept = default; explicit directory_entry(const filesystem::path& p);
|
||||
directory_entry(const filesystem::path& p, error_code& ec); ~directory_entry(); // assignments directory_entry& operator=(const directory_entry&) = default;
|
||||
directory_entry& operator=(directory_entry&&) noexcept = default; // [[fs.dir.entry.mods]](#fs.dir.entry.mods "31.12.10.3 Modifiers"), modifiersvoid assign(const filesystem::path& p); void assign(const filesystem::path& p, error_code& ec); void replace_filename(const filesystem::path& p); void replace_filename(const filesystem::path& p, error_code& ec); void refresh(); void refresh(error_code& ec) noexcept; // [[fs.dir.entry.obs]](#fs.dir.entry.obs "31.12.10.4 Observers"), observersconst filesystem::path& path() const noexcept; operator const filesystem::path&() const noexcept; bool exists() const; bool exists(error_code& ec) const noexcept; bool is_block_file() const; bool is_block_file(error_code& ec) const noexcept; bool is_character_file() const; bool is_character_file(error_code& ec) const noexcept; bool is_directory() const; bool is_directory(error_code& ec) const noexcept; bool is_fifo() const; bool is_fifo(error_code& ec) const noexcept; bool is_other() const; bool is_other(error_code& ec) const noexcept; bool is_regular_file() const; bool is_regular_file(error_code& ec) const noexcept; bool is_socket() const; bool is_socket(error_code& ec) const noexcept; bool is_symlink() const; bool is_symlink(error_code& ec) const noexcept;
|
||||
uintmax_t file_size() const;
|
||||
uintmax_t file_size(error_code& ec) const noexcept;
|
||||
uintmax_t hard_link_count() const;
|
||||
uintmax_t hard_link_count(error_code& ec) const noexcept;
|
||||
file_time_type last_write_time() const;
|
||||
file_time_type last_write_time(error_code& ec) const noexcept;
|
||||
file_status status() const;
|
||||
file_status status(error_code& ec) const noexcept;
|
||||
file_status symlink_status() const;
|
||||
file_status symlink_status(error_code& ec) const noexcept; bool operator==(const directory_entry& rhs) const noexcept;
|
||||
strong_ordering operator<=>(const directory_entry& rhs) const noexcept; // [[fs.dir.entry.io]](#fs.dir.entry.io "31.12.10.5 Inserter"), insertertemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const directory_entry& d); private: filesystem::path *path-object*; // *exposition only*};}
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16110)
|
||||
|
||||
A directory_entry object stores a path object
|
||||
and may store additional objects for file attributes
|
||||
such as hard link count, status, symlink status, file size, and last write time[.](#general-1.sentence-1)
|
||||
|
||||
[2](#general-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16116)
|
||||
|
||||
Implementations should store such additional file attributes
|
||||
during directory iteration if their values are available
|
||||
and storing the values would allow the implementation to eliminate file system accesses
|
||||
by directory_entry observer functions ([[fs.op.funcs]](fs.op.funcs "31.12.13 Filesystem operation functions"))[.](#general-2.sentence-1)
|
||||
|
||||
Such stored file attribute values are said to be [*cached*](#def:file_attributes,cached "31.12.10.1 General [fs.class.directory.entry.general]")[.](#general-2.sentence-2)
|
||||
|
||||
[3](#general-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16123)
|
||||
|
||||
[*Note [1](#general-note-1)*:
|
||||
|
||||
directory_iterator can cache
|
||||
already available attribute values
|
||||
directly into a directory_entry object
|
||||
without the cost of a call to refresh()[.](#general-3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#general-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16131)
|
||||
|
||||
[*Example [1](#general-example-1)*: using namespace std::filesystem;
|
||||
|
||||
// use possibly cached last write time to minimize disk accessesfor (auto&& x : directory_iterator(".")){ std::cout << x.path() << " " << x.last_write_time() << std::endl;}// call refresh() to refresh a stale cachefor (auto&& x : directory_iterator(".")){ lengthy_function(x.path()); // cache becomes stale x.refresh();
|
||||
std::cout << x.path() << " " << x.last_write_time() << std::endl;}
|
||||
|
||||
On implementations that do not cache the last write time,
|
||||
both loops will result in a potentially expensive call
|
||||
to the std::filesystem::last_write_time function[.](#general-4.sentence-1)
|
||||
|
||||
On implementations that do cache the last write time,
|
||||
the first loop will use the cached value and so
|
||||
will not result in a potentially expensive call
|
||||
to the std::filesystem::last_write_time function[.](#general-4.sentence-2)
|
||||
|
||||
The code is portable to any implementation,
|
||||
regardless of whether or not it employs caching[.](#general-4.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
|
||||
#### [31.12.10.2](#fs.dir.entry.cons) Constructors [[fs.dir.entry.cons]](fs.dir.entry.cons)
|
||||
|
||||
[ð](#lib:directory_entry,constructor)
|
||||
|
||||
`explicit directory_entry(const filesystem::path& p);
|
||||
directory_entry(const filesystem::path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#fs.dir.entry.cons-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16172)
|
||||
|
||||
*Effects*: Calls refresh() or refresh(ec), respectively[.](#fs.dir.entry.cons-1.sentence-1)
|
||||
|
||||
[2](#fs.dir.entry.cons-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16176)
|
||||
|
||||
*Postconditions*: path() == p if no error occurs,
|
||||
otherwise path() == filesystem::path()[.](#fs.dir.entry.cons-2.sentence-1)
|
||||
|
||||
[3](#fs.dir.entry.cons-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16181)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.cons-3.sentence-1)
|
||||
|
||||
#### [31.12.10.3](#fs.dir.entry.mods) Modifiers [[fs.dir.entry.mods]](fs.dir.entry.mods)
|
||||
|
||||
[ð](#lib:assign,directory_entry)
|
||||
|
||||
`void assign(const filesystem::path& p);
|
||||
void assign(const filesystem::path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#fs.dir.entry.mods-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16195)
|
||||
|
||||
*Effects*: Equivalent to *path-object* = p,
|
||||
then refresh() or refresh(ec), respectively[.](#fs.dir.entry.mods-1.sentence-1)
|
||||
|
||||
If an error occurs, the values of any cached attributes are unspecified[.](#fs.dir.entry.mods-1.sentence-2)
|
||||
|
||||
[2](#fs.dir.entry.mods-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16201)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.mods-2.sentence-1)
|
||||
|
||||
[ð](#lib:replace_filename,directory_entry)
|
||||
|
||||
`void replace_filename(const filesystem::path& p);
|
||||
void replace_filename(const filesystem::path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[3](#fs.dir.entry.mods-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16213)
|
||||
|
||||
*Effects*: Equivalent to *path-object*.replace_filename(p),
|
||||
then refresh() or refresh(ec), respectively[.](#fs.dir.entry.mods-3.sentence-1)
|
||||
|
||||
If an error occurs, the values of any cached attributes are unspecified[.](#fs.dir.entry.mods-3.sentence-2)
|
||||
|
||||
[4](#fs.dir.entry.mods-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16219)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.mods-4.sentence-1)
|
||||
|
||||
[ð](#lib:refresh,directory_entry)
|
||||
|
||||
`void refresh();
|
||||
void refresh(error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[5](#fs.dir.entry.mods-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16231)
|
||||
|
||||
*Effects*: Stores the current values of any cached attributes of the file p resolves to[.](#fs.dir.entry.mods-5.sentence-1)
|
||||
|
||||
If an error occurs, an error is reported ([[fs.err.report]](fs.err.report "31.12.5 Error reporting"))
|
||||
and the values of any cached attributes are unspecified[.](#fs.dir.entry.mods-5.sentence-2)
|
||||
|
||||
[6](#fs.dir.entry.mods-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16237)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.mods-6.sentence-1)
|
||||
|
||||
[7](#fs.dir.entry.mods-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16241)
|
||||
|
||||
[*Note [1](#fs.dir.entry.mods-note-1)*:
|
||||
|
||||
Implementations of directory_iterator ([[fs.class.directory.iterator]](fs.class.directory.iterator "31.12.11 Class directory_iterator"))
|
||||
are prohibited from directly or indirectly calling the refresh function
|
||||
as described in [[fs.class.directory.iterator.general]](fs.class.directory.iterator.general "31.12.11.1 General")[.](#fs.dir.entry.mods-7.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [31.12.10.4](#fs.dir.entry.obs) Observers [[fs.dir.entry.obs]](fs.dir.entry.obs)
|
||||
|
||||
[1](#fs.dir.entry.obs-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16251)
|
||||
|
||||
Unqualified function names in the *Returns*: elements of thedirectory_entry observers described below refer to members of thestd::filesystem namespace[.](#fs.dir.entry.obs-1.sentence-1)
|
||||
|
||||
[ð](#lib:path,directory_entry)
|
||||
|
||||
`const filesystem::path& path() const noexcept;
|
||||
operator const filesystem::path&() const noexcept;
|
||||
`
|
||||
|
||||
[2](#fs.dir.entry.obs-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16264)
|
||||
|
||||
*Returns*: *path-object*[.](#fs.dir.entry.obs-2.sentence-1)
|
||||
|
||||
[ð](#lib:exists,directory_entry)
|
||||
|
||||
`bool exists() const;
|
||||
bool exists(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[3](#fs.dir.entry.obs-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16276)
|
||||
|
||||
*Returns*: exists(this->status()) or exists(this->status(ec)), respectively[.](#fs.dir.entry.obs-3.sentence-1)
|
||||
|
||||
[4](#fs.dir.entry.obs-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16280)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-4.sentence-1)
|
||||
|
||||
[ð](#lib:is_block_file,directory_entry)
|
||||
|
||||
`bool is_block_file() const;
|
||||
bool is_block_file(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[5](#fs.dir.entry.obs-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16292)
|
||||
|
||||
*Returns*: is_block_file(this->status()) or is_block_file(this->status(ec)), respectively[.](#fs.dir.entry.obs-5.sentence-1)
|
||||
|
||||
[6](#fs.dir.entry.obs-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16296)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-6.sentence-1)
|
||||
|
||||
[ð](#lib:is_character_file,directory_entry)
|
||||
|
||||
`bool is_character_file() const;
|
||||
bool is_character_file(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[7](#fs.dir.entry.obs-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16308)
|
||||
|
||||
*Returns*: is_character_file(this->status()) or is_character_file(this->status(ec)), respectively[.](#fs.dir.entry.obs-7.sentence-1)
|
||||
|
||||
[8](#fs.dir.entry.obs-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16312)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-8.sentence-1)
|
||||
|
||||
[ð](#lib:is_directory,directory_entry)
|
||||
|
||||
`bool is_directory() const;
|
||||
bool is_directory(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[9](#fs.dir.entry.obs-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16324)
|
||||
|
||||
*Returns*: is_directory(this->status()) or is_directory(this->status(ec)), respectively[.](#fs.dir.entry.obs-9.sentence-1)
|
||||
|
||||
[10](#fs.dir.entry.obs-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16328)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-10.sentence-1)
|
||||
|
||||
[ð](#lib:is_fifo,directory_entry)
|
||||
|
||||
`bool is_fifo() const;
|
||||
bool is_fifo(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[11](#fs.dir.entry.obs-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16340)
|
||||
|
||||
*Returns*: is_fifo(this->status()) or is_fifo(this->status(ec)), respectively[.](#fs.dir.entry.obs-11.sentence-1)
|
||||
|
||||
[12](#fs.dir.entry.obs-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16344)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-12.sentence-1)
|
||||
|
||||
[ð](#lib:is_other,directory_entry)
|
||||
|
||||
`bool is_other() const;
|
||||
bool is_other(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[13](#fs.dir.entry.obs-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16356)
|
||||
|
||||
*Returns*: is_other(this->status()) or is_other(this->status(ec)), respectively[.](#fs.dir.entry.obs-13.sentence-1)
|
||||
|
||||
[14](#fs.dir.entry.obs-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16360)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-14.sentence-1)
|
||||
|
||||
[ð](#lib:is_regular_file,directory_entry)
|
||||
|
||||
`bool is_regular_file() const;
|
||||
bool is_regular_file(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[15](#fs.dir.entry.obs-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16372)
|
||||
|
||||
*Returns*: is_regular_file(this->status()) or is_regular_file(this->status(ec)), respectively[.](#fs.dir.entry.obs-15.sentence-1)
|
||||
|
||||
[16](#fs.dir.entry.obs-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16376)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-16.sentence-1)
|
||||
|
||||
[ð](#lib:is_socket,directory_entry)
|
||||
|
||||
`bool is_socket() const;
|
||||
bool is_socket(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[17](#fs.dir.entry.obs-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16388)
|
||||
|
||||
*Returns*: is_socket(this->status()) or is_socket(this->status(ec)), respectively[.](#fs.dir.entry.obs-17.sentence-1)
|
||||
|
||||
[18](#fs.dir.entry.obs-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16392)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-18.sentence-1)
|
||||
|
||||
[ð](#lib:is_symlink,directory_entry)
|
||||
|
||||
`bool is_symlink() const;
|
||||
bool is_symlink(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[19](#fs.dir.entry.obs-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16404)
|
||||
|
||||
*Returns*: is_symlink(this->symlink_status()) or is_symlink(this->symlink_status(ec)), respectively[.](#fs.dir.entry.obs-19.sentence-1)
|
||||
|
||||
[20](#fs.dir.entry.obs-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16408)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-20.sentence-1)
|
||||
|
||||
[ð](#lib:file_size,directory_entry)
|
||||
|
||||
`uintmax_t file_size() const;
|
||||
uintmax_t file_size(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[21](#fs.dir.entry.obs-21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16420)
|
||||
|
||||
*Returns*: If cached, the file size attribute value[.](#fs.dir.entry.obs-21.sentence-1)
|
||||
|
||||
Otherwise, file_size(path()) or file_size(path(), ec), respectively[.](#fs.dir.entry.obs-21.sentence-2)
|
||||
|
||||
[22](#fs.dir.entry.obs-22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16425)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-22.sentence-1)
|
||||
|
||||
[ð](#lib:hard_link_count,directory_entry)
|
||||
|
||||
`uintmax_t hard_link_count() const;
|
||||
uintmax_t hard_link_count(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[23](#fs.dir.entry.obs-23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16437)
|
||||
|
||||
*Returns*: If cached, the hard link count attribute value[.](#fs.dir.entry.obs-23.sentence-1)
|
||||
|
||||
Otherwise, hard_link_count(path()) or hard_link_count(path(), ec), respectively[.](#fs.dir.entry.obs-23.sentence-2)
|
||||
|
||||
[24](#fs.dir.entry.obs-24)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16442)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-24.sentence-1)
|
||||
|
||||
[ð](#lib:last_write_time,directory_entry)
|
||||
|
||||
`file_time_type last_write_time() const;
|
||||
file_time_type last_write_time(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[25](#fs.dir.entry.obs-25)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16454)
|
||||
|
||||
*Returns*: If cached, the last write time attribute value[.](#fs.dir.entry.obs-25.sentence-1)
|
||||
|
||||
Otherwise, last_write_time(path()) or last_write_time(path(), ec), respectively[.](#fs.dir.entry.obs-25.sentence-2)
|
||||
|
||||
[26](#fs.dir.entry.obs-26)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16459)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-26.sentence-1)
|
||||
|
||||
[ð](#lib:status,directory_entry)
|
||||
|
||||
`file_status status() const;
|
||||
file_status status(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[27](#fs.dir.entry.obs-27)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16471)
|
||||
|
||||
*Returns*: If cached, the status attribute value[.](#fs.dir.entry.obs-27.sentence-1)
|
||||
|
||||
Otherwise, status(path()) or status(path(), ec), respectively[.](#fs.dir.entry.obs-27.sentence-2)
|
||||
|
||||
[28](#fs.dir.entry.obs-28)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16476)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-28.sentence-1)
|
||||
|
||||
[ð](#lib:symlink_status,directory_entry)
|
||||
|
||||
`file_status symlink_status() const;
|
||||
file_status symlink_status(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[29](#fs.dir.entry.obs-29)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16488)
|
||||
|
||||
*Returns*: If cached, the symlink status attribute value[.](#fs.dir.entry.obs-29.sentence-1)
|
||||
|
||||
Otherwise, symlink_status(path()) or symlink_status(path(), ec), respectively[.](#fs.dir.entry.obs-29.sentence-2)
|
||||
|
||||
[30](#fs.dir.entry.obs-30)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16493)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.entry.obs-30.sentence-1)
|
||||
|
||||
[ð](#lib:operator==,directory_entry)
|
||||
|
||||
`bool operator==(const directory_entry& rhs) const noexcept;
|
||||
`
|
||||
|
||||
[31](#fs.dir.entry.obs-31)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16504)
|
||||
|
||||
*Returns*: *path-object* == rhs.*path-object*[.](#fs.dir.entry.obs-31.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,directory_entry)
|
||||
|
||||
`strong_ordering operator<=>(const directory_entry& rhs) const noexcept;
|
||||
`
|
||||
|
||||
[32](#fs.dir.entry.obs-32)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16515)
|
||||
|
||||
*Returns*: *path-object* <=> rhs.*path-object*[.](#fs.dir.entry.obs-32.sentence-1)
|
||||
|
||||
#### [31.12.10.5](#fs.dir.entry.io) Inserter [[fs.dir.entry.io]](fs.dir.entry.io)
|
||||
|
||||
[ð](#lib:operator%3c%3c,directory_entry)
|
||||
|
||||
`template<class charT, class traits>
|
||||
friend basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
|
||||
`
|
||||
|
||||
[1](#fs.dir.entry.io-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16530)
|
||||
|
||||
*Effects*: Equivalent to: return os << d.path();
|
||||
83
cppdraft/fs/class/directory/entry/general.md
Normal file
83
cppdraft/fs/class/directory/entry/general.md
Normal file
@@ -0,0 +1,83 @@
|
||||
[fs.class.directory.entry.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.directory.entry.general)
|
||||
|
||||
### 31.12.10 Class directory_entry [[fs.class.directory.entry]](fs.class.directory.entry#general)
|
||||
|
||||
#### 31.12.10.1 General [fs.class.directory.entry.general]
|
||||
|
||||
[ð](#lib:directory_entry)
|
||||
|
||||
namespace std::filesystem {class directory_entry {public:// [[fs.dir.entry.cons]](fs.dir.entry.cons "31.12.10.2 Constructors"), constructors and destructor directory_entry() noexcept = default;
|
||||
directory_entry(const directory_entry&) = default;
|
||||
directory_entry(directory_entry&&) noexcept = default; explicit directory_entry(const filesystem::path& p);
|
||||
directory_entry(const filesystem::path& p, error_code& ec); ~directory_entry(); // assignments directory_entry& operator=(const directory_entry&) = default;
|
||||
directory_entry& operator=(directory_entry&&) noexcept = default; // [[fs.dir.entry.mods]](fs.dir.entry.mods "31.12.10.3 Modifiers"), modifiersvoid assign(const filesystem::path& p); void assign(const filesystem::path& p, error_code& ec); void replace_filename(const filesystem::path& p); void replace_filename(const filesystem::path& p, error_code& ec); void refresh(); void refresh(error_code& ec) noexcept; // [[fs.dir.entry.obs]](fs.dir.entry.obs "31.12.10.4 Observers"), observersconst filesystem::path& path() const noexcept; operator const filesystem::path&() const noexcept; bool exists() const; bool exists(error_code& ec) const noexcept; bool is_block_file() const; bool is_block_file(error_code& ec) const noexcept; bool is_character_file() const; bool is_character_file(error_code& ec) const noexcept; bool is_directory() const; bool is_directory(error_code& ec) const noexcept; bool is_fifo() const; bool is_fifo(error_code& ec) const noexcept; bool is_other() const; bool is_other(error_code& ec) const noexcept; bool is_regular_file() const; bool is_regular_file(error_code& ec) const noexcept; bool is_socket() const; bool is_socket(error_code& ec) const noexcept; bool is_symlink() const; bool is_symlink(error_code& ec) const noexcept;
|
||||
uintmax_t file_size() const;
|
||||
uintmax_t file_size(error_code& ec) const noexcept;
|
||||
uintmax_t hard_link_count() const;
|
||||
uintmax_t hard_link_count(error_code& ec) const noexcept;
|
||||
file_time_type last_write_time() const;
|
||||
file_time_type last_write_time(error_code& ec) const noexcept;
|
||||
file_status status() const;
|
||||
file_status status(error_code& ec) const noexcept;
|
||||
file_status symlink_status() const;
|
||||
file_status symlink_status(error_code& ec) const noexcept; bool operator==(const directory_entry& rhs) const noexcept;
|
||||
strong_ordering operator<=>(const directory_entry& rhs) const noexcept; // [[fs.dir.entry.io]](fs.dir.entry.io "31.12.10.5 Inserter"), insertertemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const directory_entry& d); private: filesystem::path *path-object*; // *exposition only*};}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16110)
|
||||
|
||||
A directory_entry object stores a path object
|
||||
and may store additional objects for file attributes
|
||||
such as hard link count, status, symlink status, file size, and last write time[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16116)
|
||||
|
||||
Implementations should store such additional file attributes
|
||||
during directory iteration if their values are available
|
||||
and storing the values would allow the implementation to eliminate file system accesses
|
||||
by directory_entry observer functions ([[fs.op.funcs]](fs.op.funcs "31.12.13 Filesystem operation functions"))[.](#2.sentence-1)
|
||||
|
||||
Such stored file attribute values are said to be [*cached*](#def:file_attributes,cached "31.12.10.1 General [fs.class.directory.entry.general]")[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16123)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
directory_iterator can cache
|
||||
already available attribute values
|
||||
directly into a directory_entry object
|
||||
without the cost of a call to refresh()[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16131)
|
||||
|
||||
[*Example [1](#example-1)*: using namespace std::filesystem;
|
||||
|
||||
// use possibly cached last write time to minimize disk accessesfor (auto&& x : directory_iterator(".")){ std::cout << x.path() << " " << x.last_write_time() << std::endl;}// call refresh() to refresh a stale cachefor (auto&& x : directory_iterator(".")){ lengthy_function(x.path()); // cache becomes stale x.refresh();
|
||||
std::cout << x.path() << " " << x.last_write_time() << std::endl;}
|
||||
|
||||
On implementations that do not cache the last write time,
|
||||
both loops will result in a potentially expensive call
|
||||
to the std::filesystem::last_write_time function[.](#4.sentence-1)
|
||||
|
||||
On implementations that do cache the last write time,
|
||||
the first loop will use the cached value and so
|
||||
will not result in a potentially expensive call
|
||||
to the std::filesystem::last_write_time function[.](#4.sentence-2)
|
||||
|
||||
The code is portable to any implementation,
|
||||
regardless of whether or not it employs caching[.](#4.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
281
cppdraft/fs/class/directory/iterator.md
Normal file
281
cppdraft/fs/class/directory/iterator.md
Normal file
@@ -0,0 +1,281 @@
|
||||
[fs.class.directory.iterator]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.directory.iterator)
|
||||
|
||||
### 31.12.11 Class directory_iterator [fs.class.directory.iterator]
|
||||
|
||||
#### [31.12.11.1](#general) General [[fs.class.directory.iterator.general]](fs.class.directory.iterator.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16540)
|
||||
|
||||
An object of type directory_iterator provides an iterator for a
|
||||
sequence of directory_entry elements representing the
|
||||
path and any cached attribute values ([[fs.class.directory.entry]](fs.class.directory.entry "31.12.10 Class directory_entry"))
|
||||
for each file in a directory
|
||||
or in an implementation-defined directory-like file type[.](#general-1.sentence-1)
|
||||
|
||||
[*Note [1](#general-note-1)*:
|
||||
|
||||
For iteration into subdirectories, see class recursive_directory_iterator ([[fs.class.rec.dir.itr]](fs.class.rec.dir.itr "31.12.12 Class recursive_directory_iterator"))[.](#general-1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
namespace std::filesystem {class directory_iterator {public:using iterator_category = input_iterator_tag; using value_type = directory_entry; using difference_type = ptrdiff_t; using pointer = const directory_entry*; using reference = const directory_entry&; // [[fs.dir.itr.members]](#fs.dir.itr.members "31.12.11.2 Members"), member functions directory_iterator() noexcept; explicit directory_iterator(const path& p);
|
||||
directory_iterator(const path& p, directory_options options);
|
||||
directory_iterator(const path& p, error_code& ec);
|
||||
directory_iterator(const path& p, directory_options options,
|
||||
error_code& ec);
|
||||
directory_iterator(const directory_iterator& rhs);
|
||||
directory_iterator(directory_iterator&& rhs) noexcept; ~directory_iterator();
|
||||
|
||||
directory_iterator& operator=(const directory_iterator& rhs);
|
||||
directory_iterator& operator=(directory_iterator&& rhs) noexcept; const directory_entry& operator*() const; const directory_entry* operator->() const;
|
||||
directory_iterator& operator++();
|
||||
directory_iterator& increment(error_code& ec); bool operator==(default_sentinel_t) const noexcept {return *this == directory_iterator(); }// other members as required by [[input.iterators]](input.iterators "24.3.5.3 Input iterators"), input iterators};}
|
||||
|
||||
[2](#general-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16588)
|
||||
|
||||
directory_iterator meets the[*Cpp17InputIterator*](input.iterators#:Cpp17InputIterator "24.3.5.3 Input iterators [input.iterators]") requirements ([[input.iterators]](input.iterators "24.3.5.3 Input iterators"))[.](#general-2.sentence-1)
|
||||
|
||||
[3](#general-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16592)
|
||||
|
||||
If an iterator of type directory_iterator reports an error or
|
||||
is advanced past the last directory element,
|
||||
that iterator shall become equal to the end iterator
|
||||
value[.](#general-3.sentence-1)
|
||||
|
||||
The directory_iterator default constructor shall
|
||||
create an iterator equal to the end iterator value, and this shall be the only
|
||||
valid iterator for the end condition[.](#general-3.sentence-2)
|
||||
|
||||
[4](#general-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16600)
|
||||
|
||||
The end iterator is not dereferenceable[.](#general-4.sentence-1)
|
||||
|
||||
[5](#general-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16603)
|
||||
|
||||
Two end iterators are always equal[.](#general-5.sentence-1)
|
||||
|
||||
An end iterator shall not be equal to a non-end
|
||||
iterator[.](#general-5.sentence-2)
|
||||
|
||||
[6](#general-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16607)
|
||||
|
||||
The result of calling the path() member of the directory_entry object obtained by dereferencing a directory_iterator is a reference to a path object composed of the directory argument from which the iterator was
|
||||
constructed with the filename of the directory entry appended as if by operator/=[.](#general-6.sentence-1)
|
||||
|
||||
[7](#general-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16611)
|
||||
|
||||
Directory iteration shall not yield directory entries for the current (dot)
|
||||
and parent (dot-dot) directories[.](#general-7.sentence-1)
|
||||
|
||||
[8](#general-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16615)
|
||||
|
||||
The order of directory entries obtained by dereferencing successive
|
||||
increments of a directory_iterator is unspecified[.](#general-8.sentence-1)
|
||||
|
||||
[9](#general-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16619)
|
||||
|
||||
Constructors and non-const directory_iterator member functions
|
||||
store the values of any cached attributes ([[fs.class.directory.entry]](fs.class.directory.entry "31.12.10 Class directory_entry"))
|
||||
in the directory_entry element returned by operator*()[.](#general-9.sentence-1)
|
||||
|
||||
directory_iterator member functions shall not directly or indirectly call
|
||||
any directory_entry refresh function[.](#general-9.sentence-2)
|
||||
|
||||
[*Note [2](#general-note-2)*:
|
||||
|
||||
The exact mechanism for storing cached attribute values is not exposed to users[.](#general-9.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[10](#general-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16629)
|
||||
|
||||
[*Note [3](#general-note-3)*:
|
||||
|
||||
A path obtained by dereferencing a directory iterator might not actually exist;
|
||||
it could be a symbolic link to a non-existent file[.](#general-10.sentence-1)
|
||||
|
||||
Recursively walking directory trees
|
||||
for purposes of removing and renaming entries
|
||||
might invalidate symbolic links that are being followed[.](#general-10.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[11](#general-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16638)
|
||||
|
||||
[*Note [4](#general-note-4)*:
|
||||
|
||||
If a file is removed from or added to a directory after the
|
||||
construction of a directory_iterator for the directory, it is
|
||||
unspecified whether or not subsequently incrementing the iterator will ever
|
||||
result in an iterator referencing the removed or added directory entry[.](#general-11.sentence-1)
|
||||
|
||||
See
|
||||
POSIX [readdir](http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html)[.](#general-11.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [31.12.11.2](#fs.dir.itr.members) Members [[fs.dir.itr.members]](fs.dir.itr.members)
|
||||
|
||||
[ð](#lib:directory_iterator,constructor)
|
||||
|
||||
`directory_iterator() noexcept;
|
||||
`
|
||||
|
||||
[1](#fs.dir.itr.members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16655)
|
||||
|
||||
*Effects*: Constructs the end iterator[.](#fs.dir.itr.members-1.sentence-1)
|
||||
|
||||
[ð](#lib:directory_iterator,constructor_)
|
||||
|
||||
`explicit directory_iterator(const path& p);
|
||||
directory_iterator(const path& p, directory_options options);
|
||||
directory_iterator(const path& p, error_code& ec);
|
||||
directory_iterator(const path& p, directory_options options, error_code& ec);
|
||||
`
|
||||
|
||||
[2](#fs.dir.itr.members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16669)
|
||||
|
||||
*Effects*: For the directory that p resolves to, constructs an
|
||||
iterator for the first element in a sequence of directory_entry elements representing the files in the directory, if any; otherwise the end
|
||||
iterator[.](#fs.dir.itr.members-2.sentence-1)
|
||||
|
||||
However, if(options & directory_options::skip_permission_denied) != directory_options::none and construction encounters an error indicating
|
||||
that permission to access p is denied, constructs the end iterator
|
||||
and does not report an error[.](#fs.dir.itr.members-2.sentence-2)
|
||||
|
||||
[3](#fs.dir.itr.members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16682)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.itr.members-3.sentence-1)
|
||||
|
||||
[4](#fs.dir.itr.members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16686)
|
||||
|
||||
[*Note [1](#fs.dir.itr.members-note-1)*:
|
||||
|
||||
To iterate over the current directory, use directory_iterator(".") rather than directory_iterator("")[.](#fs.dir.itr.members-4.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:directory_iterator,constructor__)
|
||||
|
||||
`directory_iterator(const directory_iterator& rhs);
|
||||
directory_iterator(directory_iterator&& rhs) noexcept;
|
||||
`
|
||||
|
||||
[5](#fs.dir.itr.members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16699)
|
||||
|
||||
*Postconditions*: *this has the original value of rhs[.](#fs.dir.itr.members-5.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,directory_iterator)
|
||||
|
||||
`directory_iterator& operator=(const directory_iterator& rhs);
|
||||
directory_iterator& operator=(directory_iterator&& rhs) noexcept;
|
||||
`
|
||||
|
||||
[6](#fs.dir.itr.members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16711)
|
||||
|
||||
*Effects*: If *this and rhs are the same
|
||||
object, the member has no effect[.](#fs.dir.itr.members-6.sentence-1)
|
||||
|
||||
[7](#fs.dir.itr.members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16716)
|
||||
|
||||
*Postconditions*: *this has the original value of rhs[.](#fs.dir.itr.members-7.sentence-1)
|
||||
|
||||
[8](#fs.dir.itr.members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16720)
|
||||
|
||||
*Returns*: *this[.](#fs.dir.itr.members-8.sentence-1)
|
||||
|
||||
[ð](#lib:increment,directory_iterator)
|
||||
|
||||
`directory_iterator& operator++();
|
||||
directory_iterator& increment(error_code& ec);
|
||||
`
|
||||
|
||||
[9](#fs.dir.itr.members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16733)
|
||||
|
||||
*Effects*: As specified for the prefix increment operation of[Input iterators](input.iterators "24.3.5.3 Input iterators [input.iterators]")[.](#fs.dir.itr.members-9.sentence-1)
|
||||
|
||||
[10](#fs.dir.itr.members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16738)
|
||||
|
||||
*Returns*: *this[.](#fs.dir.itr.members-10.sentence-1)
|
||||
|
||||
[11](#fs.dir.itr.members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16742)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.dir.itr.members-11.sentence-1)
|
||||
|
||||
#### [31.12.11.3](#fs.dir.itr.nonmembers) Non-member functions [[fs.dir.itr.nonmembers]](fs.dir.itr.nonmembers)
|
||||
|
||||
[1](#fs.dir.itr.nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16749)
|
||||
|
||||
These functions enable range access for directory_iterator[.](#fs.dir.itr.nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:begin,directory_iterator)
|
||||
|
||||
`directory_iterator begin(directory_iterator iter) noexcept;
|
||||
`
|
||||
|
||||
[2](#fs.dir.itr.nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16758)
|
||||
|
||||
*Returns*: iter[.](#fs.dir.itr.nonmembers-2.sentence-1)
|
||||
|
||||
[ð](#lib:end,directory_iterator)
|
||||
|
||||
`directory_iterator end(directory_iterator) noexcept;
|
||||
`
|
||||
|
||||
[3](#fs.dir.itr.nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16769)
|
||||
|
||||
*Returns*: directory_iterator()[.](#fs.dir.itr.nonmembers-3.sentence-1)
|
||||
141
cppdraft/fs/class/directory/iterator/general.md
Normal file
141
cppdraft/fs/class/directory/iterator/general.md
Normal file
@@ -0,0 +1,141 @@
|
||||
[fs.class.directory.iterator.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.directory.iterator.general)
|
||||
|
||||
### 31.12.11 Class directory_iterator [[fs.class.directory.iterator]](fs.class.directory.iterator#general)
|
||||
|
||||
#### 31.12.11.1 General [fs.class.directory.iterator.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16540)
|
||||
|
||||
An object of type directory_iterator provides an iterator for a
|
||||
sequence of directory_entry elements representing the
|
||||
path and any cached attribute values ([[fs.class.directory.entry]](fs.class.directory.entry "31.12.10 Class directory_entry"))
|
||||
for each file in a directory
|
||||
or in an implementation-defined directory-like file type[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
For iteration into subdirectories, see class recursive_directory_iterator ([[fs.class.rec.dir.itr]](fs.class.rec.dir.itr "31.12.12 Class recursive_directory_iterator"))[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
namespace std::filesystem {class directory_iterator {public:using iterator_category = input_iterator_tag; using value_type = directory_entry; using difference_type = ptrdiff_t; using pointer = const directory_entry*; using reference = const directory_entry&; // [[fs.dir.itr.members]](fs.dir.itr.members "31.12.11.2 Members"), member functions directory_iterator() noexcept; explicit directory_iterator(const path& p);
|
||||
directory_iterator(const path& p, directory_options options);
|
||||
directory_iterator(const path& p, error_code& ec);
|
||||
directory_iterator(const path& p, directory_options options,
|
||||
error_code& ec);
|
||||
directory_iterator(const directory_iterator& rhs);
|
||||
directory_iterator(directory_iterator&& rhs) noexcept; ~directory_iterator();
|
||||
|
||||
directory_iterator& operator=(const directory_iterator& rhs);
|
||||
directory_iterator& operator=(directory_iterator&& rhs) noexcept; const directory_entry& operator*() const; const directory_entry* operator->() const;
|
||||
directory_iterator& operator++();
|
||||
directory_iterator& increment(error_code& ec); bool operator==(default_sentinel_t) const noexcept {return *this == directory_iterator(); }// other members as required by [[input.iterators]](input.iterators "24.3.5.3 Input iterators"), input iterators};}
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16588)
|
||||
|
||||
directory_iterator meets the[*Cpp17InputIterator*](input.iterators#:Cpp17InputIterator "24.3.5.3 Input iterators [input.iterators]") requirements ([[input.iterators]](input.iterators "24.3.5.3 Input iterators"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16592)
|
||||
|
||||
If an iterator of type directory_iterator reports an error or
|
||||
is advanced past the last directory element,
|
||||
that iterator shall become equal to the end iterator
|
||||
value[.](#3.sentence-1)
|
||||
|
||||
The directory_iterator default constructor shall
|
||||
create an iterator equal to the end iterator value, and this shall be the only
|
||||
valid iterator for the end condition[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16600)
|
||||
|
||||
The end iterator is not dereferenceable[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16603)
|
||||
|
||||
Two end iterators are always equal[.](#5.sentence-1)
|
||||
|
||||
An end iterator shall not be equal to a non-end
|
||||
iterator[.](#5.sentence-2)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16607)
|
||||
|
||||
The result of calling the path() member of the directory_entry object obtained by dereferencing a directory_iterator is a reference to a path object composed of the directory argument from which the iterator was
|
||||
constructed with the filename of the directory entry appended as if by operator/=[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16611)
|
||||
|
||||
Directory iteration shall not yield directory entries for the current (dot)
|
||||
and parent (dot-dot) directories[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16615)
|
||||
|
||||
The order of directory entries obtained by dereferencing successive
|
||||
increments of a directory_iterator is unspecified[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16619)
|
||||
|
||||
Constructors and non-const directory_iterator member functions
|
||||
store the values of any cached attributes ([[fs.class.directory.entry]](fs.class.directory.entry "31.12.10 Class directory_entry"))
|
||||
in the directory_entry element returned by operator*()[.](#9.sentence-1)
|
||||
|
||||
directory_iterator member functions shall not directly or indirectly call
|
||||
any directory_entry refresh function[.](#9.sentence-2)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
The exact mechanism for storing cached attribute values is not exposed to users[.](#9.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16629)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
A path obtained by dereferencing a directory iterator might not actually exist;
|
||||
it could be a symbolic link to a non-existent file[.](#10.sentence-1)
|
||||
|
||||
Recursively walking directory trees
|
||||
for purposes of removing and renaming entries
|
||||
might invalidate symbolic links that are being followed[.](#10.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16638)
|
||||
|
||||
[*Note [4](#note-4)*:
|
||||
|
||||
If a file is removed from or added to a directory after the
|
||||
construction of a directory_iterator for the directory, it is
|
||||
unspecified whether or not subsequently incrementing the iterator will ever
|
||||
result in an iterator referencing the removed or added directory entry[.](#11.sentence-1)
|
||||
|
||||
See
|
||||
POSIX [readdir](http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html)[.](#11.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
86
cppdraft/fs/class/file/status.md
Normal file
86
cppdraft/fs/class/file/status.md
Normal file
@@ -0,0 +1,86 @@
|
||||
[fs.class.file.status]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.file.status)
|
||||
|
||||
### 31.12.9 Class file_status [fs.class.file.status]
|
||||
|
||||
#### [31.12.9.1](#general) General [[fs.class.file.status.general]](fs.class.file.status.general)
|
||||
|
||||
[ð](#lib:file_status)
|
||||
|
||||
namespace std::filesystem {class file_status {public:// [[fs.file.status.cons]](#fs.file.status.cons "31.12.9.2 Constructors"), constructors and destructor file_status() noexcept : file_status(file_type::none) {}explicit file_status(file_type ft,
|
||||
perms prms = perms::unknown) noexcept;
|
||||
file_status(const file_status&) noexcept = default;
|
||||
file_status(file_status&&) noexcept = default; ~file_status(); // assignments file_status& operator=(const file_status&) noexcept = default;
|
||||
file_status& operator=(file_status&&) noexcept = default; // [[fs.file.status.mods]](#fs.file.status.mods "31.12.9.4 Modifiers"), modifiersvoid type(file_type ft) noexcept; void permissions(perms prms) noexcept; // [[fs.file.status.obs]](#fs.file.status.obs "31.12.9.3 Observers"), observers file_type type() const noexcept;
|
||||
perms permissions() const noexcept; friend bool operator==(const file_status& lhs, const file_status& rhs) noexcept{ return lhs.type() == rhs.type() && lhs.permissions() == rhs.permissions(); }};}
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15970)
|
||||
|
||||
An object of type file_status stores information about the type
|
||||
and permissions of a file[.](#general-1.sentence-1)
|
||||
|
||||
#### [31.12.9.2](#fs.file.status.cons) Constructors [[fs.file.status.cons]](fs.file.status.cons)
|
||||
|
||||
[ð](#lib:file_status,constructor)
|
||||
|
||||
`explicit file_status(file_type ft, perms prms = perms::unknown) noexcept;
|
||||
`
|
||||
|
||||
[1](#fs.file.status.cons-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15981)
|
||||
|
||||
*Postconditions*: type() == ft and permissions() == prms[.](#fs.file.status.cons-1.sentence-1)
|
||||
|
||||
#### [31.12.9.3](#fs.file.status.obs) Observers [[fs.file.status.obs]](fs.file.status.obs)
|
||||
|
||||
[ð](#lib:type,file_status)
|
||||
|
||||
`file_type type() const noexcept;
|
||||
`
|
||||
|
||||
[1](#fs.file.status.obs-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15994)
|
||||
|
||||
*Returns*: The value of type() specified by the postconditions of the most recent call to a constructor, operator=, or type(file_type) function[.](#fs.file.status.obs-1.sentence-1)
|
||||
|
||||
[ð](#lib:permissions,file_status)
|
||||
|
||||
`perms permissions() const noexcept;
|
||||
`
|
||||
|
||||
[2](#fs.file.status.obs-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16006)
|
||||
|
||||
*Returns*: The value of permissions() specified by the postconditions of the most recent call to a constructor, operator=, or permissions(perms) function[.](#fs.file.status.obs-2.sentence-1)
|
||||
|
||||
#### [31.12.9.4](#fs.file.status.mods) Modifiers [[fs.file.status.mods]](fs.file.status.mods)
|
||||
|
||||
[ð](#lib:type,file_status_)
|
||||
|
||||
`void type(file_type ft) noexcept;
|
||||
`
|
||||
|
||||
[1](#fs.file.status.mods-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16020)
|
||||
|
||||
*Postconditions*: type() == ft[.](#fs.file.status.mods-1.sentence-1)
|
||||
|
||||
[ð](#lib:permissions,file_status_)
|
||||
|
||||
`void permissions(perms prms) noexcept;
|
||||
`
|
||||
|
||||
[2](#fs.file.status.mods-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16031)
|
||||
|
||||
*Postconditions*: permissions() == prms[.](#fs.file.status.mods-2.sentence-1)
|
||||
25
cppdraft/fs/class/file/status/general.md
Normal file
25
cppdraft/fs/class/file/status/general.md
Normal file
@@ -0,0 +1,25 @@
|
||||
[fs.class.file.status.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.file.status.general)
|
||||
|
||||
### 31.12.9 Class file_status [[fs.class.file.status]](fs.class.file.status#general)
|
||||
|
||||
#### 31.12.9.1 General [fs.class.file.status.general]
|
||||
|
||||
[ð](#lib:file_status)
|
||||
|
||||
namespace std::filesystem {class file_status {public:// [[fs.file.status.cons]](fs.file.status.cons "31.12.9.2 Constructors"), constructors and destructor file_status() noexcept : file_status(file_type::none) {}explicit file_status(file_type ft,
|
||||
perms prms = perms::unknown) noexcept;
|
||||
file_status(const file_status&) noexcept = default;
|
||||
file_status(file_status&&) noexcept = default; ~file_status(); // assignments file_status& operator=(const file_status&) noexcept = default;
|
||||
file_status& operator=(file_status&&) noexcept = default; // [[fs.file.status.mods]](fs.file.status.mods "31.12.9.4 Modifiers"), modifiersvoid type(file_type ft) noexcept; void permissions(perms prms) noexcept; // [[fs.file.status.obs]](fs.file.status.obs "31.12.9.3 Observers"), observers file_type type() const noexcept;
|
||||
perms permissions() const noexcept; friend bool operator==(const file_status& lhs, const file_status& rhs) noexcept{ return lhs.type() == rhs.type() && lhs.permissions() == rhs.permissions(); }};}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15970)
|
||||
|
||||
An object of type file_status stores information about the type
|
||||
and permissions of a file[.](#1.sentence-1)
|
||||
155
cppdraft/fs/class/filesystem/error.md
Normal file
155
cppdraft/fs/class/filesystem/error.md
Normal file
@@ -0,0 +1,155 @@
|
||||
[fs.class.filesystem.error]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.filesystem.error)
|
||||
|
||||
### 31.12.7 Class filesystem_error [fs.class.filesystem.error]
|
||||
|
||||
#### [31.12.7.1](#general) General [[fs.class.filesystem.error.general]](fs.class.filesystem.error.general)
|
||||
|
||||
[ð](#lib:filesystem_error)
|
||||
|
||||
namespace std::filesystem {class filesystem_error : public system_error {public: filesystem_error(const string& what_arg, error_code ec);
|
||||
filesystem_error(const string& what_arg, const path& p1, error_code ec);
|
||||
filesystem_error(const string& what_arg, const path& p1, const path& p2, error_code ec); const path& path1() const noexcept; const path& path2() const noexcept; const char* what() const noexcept override; };}
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15591)
|
||||
|
||||
The class filesystem_error defines the type of
|
||||
objects thrown as exceptions to report file system errors from functions described in
|
||||
subclause [[filesystems]](filesystems "31.12 File systems")[.](#general-1.sentence-1)
|
||||
|
||||
#### [31.12.7.2](#fs.filesystem.error.members) Members [[fs.filesystem.error.members]](fs.filesystem.error.members)
|
||||
|
||||
[1](#fs.filesystem.error.members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15598)
|
||||
|
||||
Constructors are provided that store zero, one, or two paths associated with
|
||||
an error[.](#fs.filesystem.error.members-1.sentence-1)
|
||||
|
||||
[ð](#lib:filesystem_error,constructor)
|
||||
|
||||
`filesystem_error(const string& what_arg, error_code ec);
|
||||
`
|
||||
|
||||
[2](#fs.filesystem.error.members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15608)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(2.1)](#fs.filesystem.error.members-2.1)
|
||||
|
||||
code() == ec is true,
|
||||
|
||||
- [(2.2)](#fs.filesystem.error.members-2.2)
|
||||
|
||||
path1().empty() is true,
|
||||
|
||||
- [(2.3)](#fs.filesystem.error.members-2.3)
|
||||
|
||||
path2().empty() is true, and
|
||||
|
||||
- [(2.4)](#fs.filesystem.error.members-2.4)
|
||||
|
||||
string_view(what()).find(what_arg.c_str()) != string_view::npos is true[.](#fs.filesystem.error.members-2.sentence-1)
|
||||
|
||||
[ð](#lib:filesystem_error,constructor_)
|
||||
|
||||
`filesystem_error(const string& what_arg, const path& p1, error_code ec);
|
||||
`
|
||||
|
||||
[3](#fs.filesystem.error.members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15624)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(3.1)](#fs.filesystem.error.members-3.1)
|
||||
|
||||
code() == ec is true,
|
||||
|
||||
- [(3.2)](#fs.filesystem.error.members-3.2)
|
||||
|
||||
path1() returns a reference to the stored copy of p1,
|
||||
|
||||
- [(3.3)](#fs.filesystem.error.members-3.3)
|
||||
|
||||
path2().empty() is true, and
|
||||
|
||||
- [(3.4)](#fs.filesystem.error.members-3.4)
|
||||
|
||||
string_view(what()).find(what_arg.c_str()) != string_view::npos is true[.](#fs.filesystem.error.members-3.sentence-1)
|
||||
|
||||
[ð](#lib:filesystem_error,constructor__)
|
||||
|
||||
`filesystem_error(const string& what_arg, const path& p1, const path& p2, error_code ec);
|
||||
`
|
||||
|
||||
[4](#fs.filesystem.error.members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15640)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(4.1)](#fs.filesystem.error.members-4.1)
|
||||
|
||||
code() == ec,
|
||||
|
||||
- [(4.2)](#fs.filesystem.error.members-4.2)
|
||||
|
||||
path1() returns a reference to the stored copy of p1,
|
||||
|
||||
- [(4.3)](#fs.filesystem.error.members-4.3)
|
||||
|
||||
path2() returns a reference to the stored copy of p2, and
|
||||
|
||||
- [(4.4)](#fs.filesystem.error.members-4.4)
|
||||
|
||||
string_view(what()).find(what_arg.c_str()) != string_view::npos[.](#fs.filesystem.error.members-4.sentence-1)
|
||||
|
||||
[ð](#lib:path1,filesystem_error)
|
||||
|
||||
`const path& path1() const noexcept;
|
||||
`
|
||||
|
||||
[5](#fs.filesystem.error.members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15656)
|
||||
|
||||
*Returns*: A reference to the copy of p1 stored by the
|
||||
constructor, or, if none, an empty path[.](#fs.filesystem.error.members-5.sentence-1)
|
||||
|
||||
[ð](#lib:path2,filesystem_error)
|
||||
|
||||
`const path& path2() const noexcept;
|
||||
`
|
||||
|
||||
[6](#fs.filesystem.error.members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15668)
|
||||
|
||||
*Returns*: A reference to the copy of p2 stored by the
|
||||
constructor, or, if none, an empty path[.](#fs.filesystem.error.members-6.sentence-1)
|
||||
|
||||
[ð](#lib:what,filesystem_error)
|
||||
|
||||
`const char* what() const noexcept override;
|
||||
`
|
||||
|
||||
[7](#fs.filesystem.error.members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15680)
|
||||
|
||||
*Returns*: An ntbs that incorporates
|
||||
the what_arg argument supplied to the constructor[.](#fs.filesystem.error.members-7.sentence-1)
|
||||
|
||||
The exact format is unspecified[.](#fs.filesystem.error.members-7.sentence-2)
|
||||
|
||||
Implementations should include
|
||||
the system_error::what() string and
|
||||
the pathnames of path1 and path2 in the native format in the returned string[.](#fs.filesystem.error.members-7.sentence-3)
|
||||
23
cppdraft/fs/class/filesystem/error/general.md
Normal file
23
cppdraft/fs/class/filesystem/error/general.md
Normal file
@@ -0,0 +1,23 @@
|
||||
[fs.class.filesystem.error.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.filesystem.error.general)
|
||||
|
||||
### 31.12.7 Class filesystem_error [[fs.class.filesystem.error]](fs.class.filesystem.error#general)
|
||||
|
||||
#### 31.12.7.1 General [fs.class.filesystem.error.general]
|
||||
|
||||
[ð](#lib:filesystem_error)
|
||||
|
||||
namespace std::filesystem {class filesystem_error : public system_error {public: filesystem_error(const string& what_arg, error_code ec);
|
||||
filesystem_error(const string& what_arg, const path& p1, error_code ec);
|
||||
filesystem_error(const string& what_arg, const path& p1, const path& p2, error_code ec); const path& path1() const noexcept; const path& path2() const noexcept; const char* what() const noexcept override; };}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15591)
|
||||
|
||||
The class filesystem_error defines the type of
|
||||
objects thrown as exceptions to report file system errors from functions described in
|
||||
subclause [[filesystems]](filesystems "31.12 File systems")[.](#1.sentence-1)
|
||||
2162
cppdraft/fs/class/path.md
Normal file
2162
cppdraft/fs/class/path.md
Normal file
File diff suppressed because it is too large
Load Diff
170
cppdraft/fs/class/path/general.md
Normal file
170
cppdraft/fs/class/path/general.md
Normal file
@@ -0,0 +1,170 @@
|
||||
[fs.class.path.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.path.general)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#general)
|
||||
|
||||
#### 31.12.6.1 General [fs.class.path.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13559)
|
||||
|
||||
An object of class path represents a path
|
||||
and contains a pathname[.](#1.sentence-1)
|
||||
|
||||
Such an object is concerned only with the lexical and syntactic aspects
|
||||
of a path[.](#1.sentence-2)
|
||||
|
||||
The path does not necessarily exist in external storage, and the
|
||||
pathname is not necessarily valid for the current operating
|
||||
system or for a particular file system[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13567)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Class path is used to support the differences
|
||||
between the string types used by different operating systems
|
||||
to represent pathnames,
|
||||
and to perform conversions between encodings when necessary[.](#2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13575)
|
||||
|
||||
A [*path*](#def:path "31.12.6.1 General [fs.class.path.general]") is
|
||||
a sequence of elements that identify
|
||||
the location of a file within a filesystem[.](#3.sentence-1)
|
||||
|
||||
The elements are the[*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]")opt,[*root-directory*](fs.path.generic#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]")opt,
|
||||
and an optional sequence of [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]")*s* ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))[.](#3.sentence-2)
|
||||
|
||||
The maximum number of elements in the sequence is
|
||||
operating system dependent ([[fs.conform.os]](fs.conform.os "31.12.2.3 Operating system dependent behavior conformance"))[.](#3.sentence-3)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13586)
|
||||
|
||||
An [*absolute path*](#def:path,absolute "31.12.6.1 General [fs.class.path.general]") is a path that unambiguously
|
||||
identifies the location of a file without reference to an additional starting
|
||||
location[.](#4.sentence-1)
|
||||
|
||||
The elements of a path that determine if it is absolute are
|
||||
operating system dependent[.](#4.sentence-2)
|
||||
|
||||
A [*relative path*](#def:path,relative "31.12.6.1 General [fs.class.path.general]") is
|
||||
a path that is not absolute, and as such, only unambiguously
|
||||
identifies the location of a file when resolved relative to
|
||||
an implied starting location[.](#4.sentence-3)
|
||||
|
||||
The elements of a path that determine if it is
|
||||
relative are operating system dependent[.](#4.sentence-4)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Pathnames â.â and â..â are relative paths[.](#4.sentence-5)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13600)
|
||||
|
||||
A [*pathname*](#def:pathname "31.12.6.1 General [fs.class.path.general]") is
|
||||
a character string that represents the name of a path[.](#5.sentence-1)
|
||||
|
||||
Pathnames are
|
||||
formatted according to the generic pathname format grammar ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))
|
||||
or according to an
|
||||
operating system dependent[*native pathname format*](#def:native_pathname_format "31.12.6.1 General [fs.class.path.general]") accepted by the host operating system[.](#5.sentence-2)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13608)
|
||||
|
||||
[*Pathname resolution*](#def:pathname_resolution "31.12.6.1 General [fs.class.path.general]") is the operating system dependent mechanism for resolving
|
||||
a pathname to a particular file in a file hierarchy[.](#6.sentence-1)
|
||||
|
||||
There may be multiple
|
||||
pathnames that resolve to the same file[.](#6.sentence-2)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
For POSIX-based operating systems,
|
||||
this mechanism is specified in POSIX, section 4.12, Pathname resolution[.](#6.sentence-3)
|
||||
|
||||
â *end example*]
|
||||
|
||||
namespace std::filesystem {class path {public:using value_type = *see below*; using string_type = basic_string<value_type>; static constexpr value_type preferred_separator = *see below*; // [[fs.enum.path.format]](fs.enum.path.format "31.12.8.1 Enum path::format"), enumeration formatenum format; // [[fs.path.construct]](fs.path.construct "31.12.6.5.1 Constructors"), constructors and destructor path() noexcept;
|
||||
path(const path& p);
|
||||
path(path&& p) noexcept;
|
||||
path(string_type&& source, format fmt = auto_format); template<class Source> path(const Source& source, format fmt = auto_format); template<class InputIterator> path(InputIterator first, InputIterator last, format fmt = auto_format); template<class Source> path(const Source& source, const locale& loc, format fmt = auto_format); template<class InputIterator> path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format); ~path(); // [[fs.path.assign]](fs.path.assign "31.12.6.5.2 Assignments"), assignments path& operator=(const path& p);
|
||||
path& operator=(path&& p) noexcept;
|
||||
path& operator=(string_type&& source);
|
||||
path& assign(string_type&& source); template<class Source> path& operator=(const Source& source); template<class Source> path& assign(const Source& source); template<class InputIterator> path& assign(InputIterator first, InputIterator last); // [[fs.path.append]](fs.path.append "31.12.6.5.3 Appends"), appends path& operator/=(const path& p); template<class Source> path& operator/=(const Source& source); template<class Source> path& append(const Source& source); template<class InputIterator> path& append(InputIterator first, InputIterator last); // [[fs.path.concat]](fs.path.concat "31.12.6.5.4 Concatenation"), concatenation path& operator+=(const path& x);
|
||||
path& operator+=(const string_type& x);
|
||||
path& operator+=(basic_string_view<value_type> x);
|
||||
path& operator+=(const value_type* x);
|
||||
path& operator+=(value_type x); template<class Source> path& operator+=(const Source& x); template<class EcharT> path& operator+=(EcharT x); template<class Source> path& concat(const Source& x); template<class InputIterator> path& concat(InputIterator first, InputIterator last); // [[fs.path.modifiers]](fs.path.modifiers "31.12.6.5.5 Modifiers"), modifiersvoid clear() noexcept;
|
||||
path& make_preferred();
|
||||
path& remove_filename();
|
||||
path& replace_filename(const path& replacement);
|
||||
path& replace_extension(const path& replacement = path()); void swap(path& rhs) noexcept; // [[fs.path.nonmember]](fs.path.nonmember "31.12.6.8 Non-member functions"), non-member operatorsfriend bool operator==(const path& lhs, const path& rhs) noexcept; friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept; friend path operator/(const path& lhs, const path& rhs); // [[fs.path.native.obs]](fs.path.native.obs "31.12.6.5.6 Native format observers"), native format observersconst string_type& native() const noexcept; const value_type* c_str() const noexcept; operator string_type() const; template<class EcharT, class traits = char_traits<EcharT>, class Allocator = allocator<EcharT>> basic_string<EcharT, traits, Allocator> string(const Allocator& a = Allocator()) const;
|
||||
std::string display_string() const;
|
||||
std::string system_encoded_string() const;
|
||||
std::wstring wstring() const;
|
||||
std::u8string u8string() const;
|
||||
std::u16string u16string() const;
|
||||
std::u32string u32string() const; // [[fs.path.generic.obs]](fs.path.generic.obs "31.12.6.5.7 Generic format observers"), generic format observerstemplate<class EcharT, class traits = char_traits<EcharT>, class Allocator = allocator<EcharT>> basic_string<EcharT, traits, Allocator> generic_string(const Allocator& a = Allocator()) const;
|
||||
std::string generic_display_string() const;
|
||||
std::string generic_system_encoded_string() const;
|
||||
std::wstring generic_wstring() const;
|
||||
std::u8string generic_u8string() const;
|
||||
std::u16string generic_u16string() const;
|
||||
std::u32string generic_u32string() const; // [[fs.path.compare]](fs.path.compare "31.12.6.5.8 Compare"), compareint compare(const path& p) const noexcept; int compare(const string_type& s) const; int compare(basic_string_view<value_type> s) const; int compare(const value_type* s) const; // [[fs.path.decompose]](fs.path.decompose "31.12.6.5.9 Decomposition"), decomposition path root_name() const;
|
||||
path root_directory() const;
|
||||
path root_path() const;
|
||||
path relative_path() const;
|
||||
path parent_path() const;
|
||||
path filename() const;
|
||||
path stem() const;
|
||||
path extension() const; // [[fs.path.query]](fs.path.query "31.12.6.5.10 Query"), querybool empty() const noexcept; bool has_root_name() const; bool has_root_directory() const; bool has_root_path() const; bool has_relative_path() const; bool has_parent_path() const; bool has_filename() const; bool has_stem() const; bool has_extension() const; bool is_absolute() const; bool is_relative() const; // [[fs.path.gen]](fs.path.gen "31.12.6.5.11 Generation"), generation path lexically_normal() const;
|
||||
path lexically_relative(const path& base) const;
|
||||
path lexically_proximate(const path& base) const; // [[fs.path.itr]](fs.path.itr "31.12.6.6 Iterators"), iteratorsclass iterator; using const_iterator = iterator;
|
||||
|
||||
iterator begin() const;
|
||||
iterator end() const; // [[fs.path.io]](fs.path.io "31.12.6.7 Inserter and extractor"), path inserter and extractortemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const path& p); template<class charT, class traits>friend basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, path& p); };}
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13775)
|
||||
|
||||
value_type is a typedef for the
|
||||
operating system dependent encoded character type used to represent pathnames[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13780)
|
||||
|
||||
The value of the preferred_separator member
|
||||
is the operating system dependent [*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]") character ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13784)
|
||||
|
||||
[*Example [2](#example-2)*:
|
||||
|
||||
For POSIX-based operating systems,value_type is char andpreferred_separator is the slash character ('/')[.](#9.sentence-1)
|
||||
|
||||
For Windows-based operating systems,value_type is wchar_t andpreferred_separator is the backslash character (L'\\')[.](#9.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
392
cppdraft/fs/class/rec/dir/itr.md
Normal file
392
cppdraft/fs/class/rec/dir/itr.md
Normal file
@@ -0,0 +1,392 @@
|
||||
[fs.class.rec.dir.itr]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.rec.dir.itr)
|
||||
|
||||
### 31.12.12 Class recursive_directory_iterator [fs.class.rec.dir.itr]
|
||||
|
||||
#### [31.12.12.1](#general) General [[fs.class.rec.dir.itr.general]](fs.class.rec.dir.itr.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16779)
|
||||
|
||||
An object of type recursive_directory_iterator provides an iterator for
|
||||
a sequence of directory_entry elements representing the files in a
|
||||
directory or in an implementation-defined directory-like file
|
||||
type, and its subdirectories[.](#general-1.sentence-1)
|
||||
|
||||
namespace std::filesystem {class recursive_directory_iterator {public:using iterator_category = input_iterator_tag; using value_type = directory_entry; using difference_type = ptrdiff_t; using pointer = const directory_entry*; using reference = const directory_entry&; // [[fs.rec.dir.itr.members]](#fs.rec.dir.itr.members "31.12.12.2 Members"), constructors and destructor recursive_directory_iterator() noexcept; explicit recursive_directory_iterator(const path& p);
|
||||
recursive_directory_iterator(const path& p, directory_options options);
|
||||
recursive_directory_iterator(const path& p, directory_options options,
|
||||
error_code& ec);
|
||||
recursive_directory_iterator(const path& p, error_code& ec);
|
||||
recursive_directory_iterator(const recursive_directory_iterator& rhs);
|
||||
recursive_directory_iterator(recursive_directory_iterator&& rhs) noexcept; ~recursive_directory_iterator(); // [[fs.rec.dir.itr.members]](#fs.rec.dir.itr.members "31.12.12.2 Members"), observers directory_options options() const; int depth() const; bool recursion_pending() const; const directory_entry& operator*() const; const directory_entry* operator->() const; // [[fs.rec.dir.itr.members]](#fs.rec.dir.itr.members "31.12.12.2 Members"), modifiers recursive_directory_iterator&operator=(const recursive_directory_iterator& rhs);
|
||||
recursive_directory_iterator&operator=(recursive_directory_iterator&& rhs) noexcept;
|
||||
|
||||
recursive_directory_iterator& operator++();
|
||||
recursive_directory_iterator& increment(error_code& ec); void pop(); void pop(error_code& ec); void disable_recursion_pending(); bool operator==(default_sentinel_t) const noexcept {return *this == recursive_directory_iterator(); }// other members as required by [[input.iterators]](input.iterators "24.3.5.3 Input iterators"), input iterators};}
|
||||
|
||||
[2](#general-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16836)
|
||||
|
||||
Calling options, depth, recursion_pending,pop or disable_recursion_pending on an iterator that is not dereferenceable results in undefined behavior[.](#general-2.sentence-1)
|
||||
|
||||
[3](#general-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16841)
|
||||
|
||||
The behavior of a recursive_directory_iterator is the same
|
||||
as a directory_iterator unless otherwise specified[.](#general-3.sentence-1)
|
||||
|
||||
[4](#general-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16845)
|
||||
|
||||
[*Note [1](#general-note-1)*:
|
||||
|
||||
If the directory structure being iterated over contains cycles
|
||||
then it is possible that the end iterator is unreachable[.](#general-4.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [31.12.12.2](#fs.rec.dir.itr.members) Members [[fs.rec.dir.itr.members]](fs.rec.dir.itr.members)
|
||||
|
||||
[ð](#lib:recursive_directory_iterator,constructor)
|
||||
|
||||
`recursive_directory_iterator() noexcept;
|
||||
`
|
||||
|
||||
[1](#fs.rec.dir.itr.members-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16859)
|
||||
|
||||
*Effects*: Constructs the end iterator[.](#fs.rec.dir.itr.members-1.sentence-1)
|
||||
|
||||
[ð](#lib:recursive_directory_iterator,constructor_)
|
||||
|
||||
`explicit recursive_directory_iterator(const path& p);
|
||||
recursive_directory_iterator(const path& p, directory_options options);
|
||||
recursive_directory_iterator(const path& p, directory_options options, error_code& ec);
|
||||
recursive_directory_iterator(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[2](#fs.rec.dir.itr.members-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16873)
|
||||
|
||||
*Effects*: Constructs an iterator representing the first
|
||||
entry in the directory to which p resolves, if any; otherwise, the end iterator[.](#fs.rec.dir.itr.members-2.sentence-1)
|
||||
|
||||
However, if(options & directory_options::skip_permission_denied) != directory_options::none and construction encounters an error indicating
|
||||
that permission to access p is denied, constructs the end iterator
|
||||
and does not report an error[.](#fs.rec.dir.itr.members-2.sentence-2)
|
||||
|
||||
[3](#fs.rec.dir.itr.members-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16885)
|
||||
|
||||
*Postconditions*: options() == options for the signatures with adirectory_options argument, otherwise options() == directory_options::none[.](#fs.rec.dir.itr.members-3.sentence-1)
|
||||
|
||||
[4](#fs.rec.dir.itr.members-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16890)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.rec.dir.itr.members-4.sentence-1)
|
||||
|
||||
[5](#fs.rec.dir.itr.members-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16894)
|
||||
|
||||
[*Note [1](#fs.rec.dir.itr.members-note-1)*:
|
||||
|
||||
Use recursive_directory_iterator(".") rather than recursive_directory_iterator("") to iterate over the current directory[.](#fs.rec.dir.itr.members-5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[6](#fs.rec.dir.itr.members-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16901)
|
||||
|
||||
[*Note [2](#fs.rec.dir.itr.members-note-2)*:
|
||||
|
||||
By default, recursive_directory_iterator does not
|
||||
follow directory symlinks[.](#fs.rec.dir.itr.members-6.sentence-1)
|
||||
|
||||
To follow directory symlinks, specify options asdirectory_options::follow_directory_symlink[.](#fs.rec.dir.itr.members-6.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:recursive_directory_iterator,constructor__)
|
||||
|
||||
`recursive_directory_iterator(const recursive_directory_iterator& rhs);
|
||||
`
|
||||
|
||||
[7](#fs.rec.dir.itr.members-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16915)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(7.1)](#fs.rec.dir.itr.members-7.1)
|
||||
|
||||
options() == rhs.options()
|
||||
|
||||
- [(7.2)](#fs.rec.dir.itr.members-7.2)
|
||||
|
||||
depth() == rhs.depth()
|
||||
|
||||
- [(7.3)](#fs.rec.dir.itr.members-7.3)
|
||||
|
||||
recursion_pending() == rhs.recursion_pending()
|
||||
|
||||
[ð](#lib:recursive_directory_iterator,constructor___)
|
||||
|
||||
`recursive_directory_iterator(recursive_directory_iterator&& rhs) noexcept;
|
||||
`
|
||||
|
||||
[8](#fs.rec.dir.itr.members-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16930)
|
||||
|
||||
*Postconditions*: options(), depth(),
|
||||
and recursion_pending() have the values that rhs.options(), rhs.depth(), and rhs.recursion_pending(), respectively, had before the function call[.](#fs.rec.dir.itr.members-8.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,recursive_directory_iterator)
|
||||
|
||||
`recursive_directory_iterator& operator=(const recursive_directory_iterator& rhs);
|
||||
`
|
||||
|
||||
[9](#fs.rec.dir.itr.members-9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16944)
|
||||
|
||||
*Effects*: If *this and rhs are the same
|
||||
object, the member has no effect[.](#fs.rec.dir.itr.members-9.sentence-1)
|
||||
|
||||
[10](#fs.rec.dir.itr.members-10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16949)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(10.1)](#fs.rec.dir.itr.members-10.1)
|
||||
|
||||
options() == rhs.options()
|
||||
|
||||
- [(10.2)](#fs.rec.dir.itr.members-10.2)
|
||||
|
||||
depth() == rhs.depth()
|
||||
|
||||
- [(10.3)](#fs.rec.dir.itr.members-10.3)
|
||||
|
||||
recursion_pending() == rhs.recursion_pending()
|
||||
|
||||
[11](#fs.rec.dir.itr.members-11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16957)
|
||||
|
||||
*Returns*: *this[.](#fs.rec.dir.itr.members-11.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,recursive_directory_iterator_)
|
||||
|
||||
`recursive_directory_iterator& operator=(recursive_directory_iterator&& rhs) noexcept;
|
||||
`
|
||||
|
||||
[12](#fs.rec.dir.itr.members-12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16968)
|
||||
|
||||
*Effects*: If *this and rhs are the same
|
||||
object, the member has no effect[.](#fs.rec.dir.itr.members-12.sentence-1)
|
||||
|
||||
[13](#fs.rec.dir.itr.members-13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16973)
|
||||
|
||||
*Postconditions*: options(), depth(),
|
||||
and recursion_pending() have the values that rhs.options(),rhs.depth(), and rhs.recursion_pending(), respectively, had before the function call[.](#fs.rec.dir.itr.members-13.sentence-1)
|
||||
|
||||
[14](#fs.rec.dir.itr.members-14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16979)
|
||||
|
||||
*Returns*: *this[.](#fs.rec.dir.itr.members-14.sentence-1)
|
||||
|
||||
[ð](#lib:options,recursive_directory_iterator)
|
||||
|
||||
`directory_options options() const;
|
||||
`
|
||||
|
||||
[15](#fs.rec.dir.itr.members-15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16990)
|
||||
|
||||
*Returns*: The value of the argument passed to the constructor for theoptions parameter, if present, otherwisedirectory_options::none[.](#fs.rec.dir.itr.members-15.sentence-1)
|
||||
|
||||
[16](#fs.rec.dir.itr.members-16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16996)
|
||||
|
||||
*Throws*: Nothing[.](#fs.rec.dir.itr.members-16.sentence-1)
|
||||
|
||||
[ð](#lib:depth,recursive_directory_iterator)
|
||||
|
||||
`int depth() const;
|
||||
`
|
||||
|
||||
[17](#fs.rec.dir.itr.members-17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17007)
|
||||
|
||||
*Returns*: The current depth of the directory tree being traversed[.](#fs.rec.dir.itr.members-17.sentence-1)
|
||||
|
||||
[*Note [3](#fs.rec.dir.itr.members-note-3)*:
|
||||
|
||||
The initial directory is depth 0, its immediate subdirectories are depth 1,
|
||||
and so forth[.](#fs.rec.dir.itr.members-17.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[18](#fs.rec.dir.itr.members-18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17015)
|
||||
|
||||
*Throws*: Nothing[.](#fs.rec.dir.itr.members-18.sentence-1)
|
||||
|
||||
[ð](#lib:recursion_pending,recursive_directory_iterator)
|
||||
|
||||
`bool recursion_pending() const;
|
||||
`
|
||||
|
||||
[19](#fs.rec.dir.itr.members-19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17026)
|
||||
|
||||
*Returns*: true if disable_recursion_pending() has not been called subsequent to the prior construction or increment
|
||||
operation, otherwise false[.](#fs.rec.dir.itr.members-19.sentence-1)
|
||||
|
||||
[20](#fs.rec.dir.itr.members-20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17032)
|
||||
|
||||
*Throws*: Nothing[.](#fs.rec.dir.itr.members-20.sentence-1)
|
||||
|
||||
[ð](#lib:increment,recursive_directory_iterator)
|
||||
|
||||
`recursive_directory_iterator& operator++();
|
||||
recursive_directory_iterator& increment(error_code& ec);
|
||||
`
|
||||
|
||||
[21](#fs.rec.dir.itr.members-21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17045)
|
||||
|
||||
*Effects*: As specified for the prefix increment operation of[Input iterators](input.iterators "24.3.5.3 Input iterators [input.iterators]"),
|
||||
except that:
|
||||
|
||||
- [(21.1)](#fs.rec.dir.itr.members-21.1)
|
||||
|
||||
If there are no more entries at the current depth, then if depth() != 0 iteration over the parent directory resumes; otherwise *this = recursive_directory_iterator().
|
||||
|
||||
- [(21.2)](#fs.rec.dir.itr.members-21.2)
|
||||
|
||||
Otherwise ifrecursion_pending() && is_directory((*this)->status()) &&(!is_symlink((*this)->symlink_status()) ||(options() & directory_options::follow_directory_symlink) != directory_options::none) then either directory (*this)->path() is recursively iterated into or,
|
||||
if(options() & directory_options::skip_permission_denied) != directory_options::none and an error occurs indicating that permission to access directory (*this)->path() is denied,
|
||||
then directory (*this)->path() is
|
||||
treated as an empty directory and no error is reported.
|
||||
|
||||
[22](#fs.rec.dir.itr.members-22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17070)
|
||||
|
||||
*Returns*: *this[.](#fs.rec.dir.itr.members-22.sentence-1)
|
||||
|
||||
[23](#fs.rec.dir.itr.members-23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17074)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.rec.dir.itr.members-23.sentence-1)
|
||||
|
||||
[ð](#lib:pop,recursive_directory_iterator)
|
||||
|
||||
`void pop();
|
||||
void pop(error_code& ec);
|
||||
`
|
||||
|
||||
[24](#fs.rec.dir.itr.members-24)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17086)
|
||||
|
||||
*Effects*: If depth() == 0, set *this to recursive_directory_iterator()[.](#fs.rec.dir.itr.members-24.sentence-1)
|
||||
|
||||
Otherwise, cease iteration of the directory currently being
|
||||
iterated over, and continue iteration over the parent directory[.](#fs.rec.dir.itr.members-24.sentence-2)
|
||||
|
||||
[25](#fs.rec.dir.itr.members-25)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17092)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.rec.dir.itr.members-25.sentence-1)
|
||||
|
||||
[26](#fs.rec.dir.itr.members-26)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17097)
|
||||
|
||||
*Remarks*: Any copies of the previous value of *this are no longer required
|
||||
to be dereferenceable nor to be in the domain of ==[.](#fs.rec.dir.itr.members-26.sentence-1)
|
||||
|
||||
[ð](#lib:disable_recursion_pending,recursive_directory_iterator)
|
||||
|
||||
`void disable_recursion_pending();
|
||||
`
|
||||
|
||||
[27](#fs.rec.dir.itr.members-27)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17109)
|
||||
|
||||
*Postconditions*: recursion_pending() == false[.](#fs.rec.dir.itr.members-27.sentence-1)
|
||||
|
||||
[28](#fs.rec.dir.itr.members-28)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17113)
|
||||
|
||||
[*Note [4](#fs.rec.dir.itr.members-note-4)*:
|
||||
|
||||
disable_recursion_pending() is used to prevent
|
||||
unwanted recursion into a directory[.](#fs.rec.dir.itr.members-28.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [31.12.12.3](#fs.rec.dir.itr.nonmembers) Non-member functions [[fs.rec.dir.itr.nonmembers]](fs.rec.dir.itr.nonmembers)
|
||||
|
||||
[1](#fs.rec.dir.itr.nonmembers-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17122)
|
||||
|
||||
These functions enable use of recursive_directory_iterator with range-based for statements[.](#fs.rec.dir.itr.nonmembers-1.sentence-1)
|
||||
|
||||
[ð](#lib:begin,recursive_directory_iterator)
|
||||
|
||||
`recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
|
||||
`
|
||||
|
||||
[2](#fs.rec.dir.itr.nonmembers-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17132)
|
||||
|
||||
*Returns*: iter[.](#fs.rec.dir.itr.nonmembers-2.sentence-1)
|
||||
|
||||
[ð](#lib:end,recursive_directory_iterator)
|
||||
|
||||
`recursive_directory_iterator end(recursive_directory_iterator) noexcept;
|
||||
`
|
||||
|
||||
[3](#fs.rec.dir.itr.nonmembers-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17143)
|
||||
|
||||
*Returns*: recursive_directory_iterator()[.](#fs.rec.dir.itr.nonmembers-3.sentence-1)
|
||||
54
cppdraft/fs/class/rec/dir/itr/general.md
Normal file
54
cppdraft/fs/class/rec/dir/itr/general.md
Normal file
@@ -0,0 +1,54 @@
|
||||
[fs.class.rec.dir.itr.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.class.rec.dir.itr.general)
|
||||
|
||||
### 31.12.12 Class recursive_directory_iterator [[fs.class.rec.dir.itr]](fs.class.rec.dir.itr#general)
|
||||
|
||||
#### 31.12.12.1 General [fs.class.rec.dir.itr.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16779)
|
||||
|
||||
An object of type recursive_directory_iterator provides an iterator for
|
||||
a sequence of directory_entry elements representing the files in a
|
||||
directory or in an implementation-defined directory-like file
|
||||
type, and its subdirectories[.](#1.sentence-1)
|
||||
|
||||
namespace std::filesystem {class recursive_directory_iterator {public:using iterator_category = input_iterator_tag; using value_type = directory_entry; using difference_type = ptrdiff_t; using pointer = const directory_entry*; using reference = const directory_entry&; // [[fs.rec.dir.itr.members]](fs.rec.dir.itr.members "31.12.12.2 Members"), constructors and destructor recursive_directory_iterator() noexcept; explicit recursive_directory_iterator(const path& p);
|
||||
recursive_directory_iterator(const path& p, directory_options options);
|
||||
recursive_directory_iterator(const path& p, directory_options options,
|
||||
error_code& ec);
|
||||
recursive_directory_iterator(const path& p, error_code& ec);
|
||||
recursive_directory_iterator(const recursive_directory_iterator& rhs);
|
||||
recursive_directory_iterator(recursive_directory_iterator&& rhs) noexcept; ~recursive_directory_iterator(); // [[fs.rec.dir.itr.members]](fs.rec.dir.itr.members "31.12.12.2 Members"), observers directory_options options() const; int depth() const; bool recursion_pending() const; const directory_entry& operator*() const; const directory_entry* operator->() const; // [[fs.rec.dir.itr.members]](fs.rec.dir.itr.members "31.12.12.2 Members"), modifiers recursive_directory_iterator&operator=(const recursive_directory_iterator& rhs);
|
||||
recursive_directory_iterator&operator=(recursive_directory_iterator&& rhs) noexcept;
|
||||
|
||||
recursive_directory_iterator& operator++();
|
||||
recursive_directory_iterator& increment(error_code& ec); void pop(); void pop(error_code& ec); void disable_recursion_pending(); bool operator==(default_sentinel_t) const noexcept {return *this == recursive_directory_iterator(); }// other members as required by [[input.iterators]](input.iterators "24.3.5.3 Input iterators"), input iterators};}
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16836)
|
||||
|
||||
Calling options, depth, recursion_pending,pop or disable_recursion_pending on an iterator that is not dereferenceable results in undefined behavior[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16841)
|
||||
|
||||
The behavior of a recursive_directory_iterator is the same
|
||||
as a directory_iterator unless otherwise specified[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16845)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
If the directory structure being iterated over contains cycles
|
||||
then it is possible that the end iterator is unreachable[.](#4.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
67
cppdraft/fs/conform/9945.md
Normal file
67
cppdraft/fs/conform/9945.md
Normal file
@@ -0,0 +1,67 @@
|
||||
[fs.conform.9945]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.conform.9945)
|
||||
|
||||
### 31.12.2 Conformance [[fs.conformance]](fs.conformance#fs.conform.9945)
|
||||
|
||||
#### 31.12.2.2 POSIX conformance [fs.conform.9945]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13173)
|
||||
|
||||
Some behavior is specified by reference to POSIX[.](#1.sentence-1)
|
||||
|
||||
How such behavior is actually implemented is unspecified[.](#1.sentence-2)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This constitutes an âas ifâ rule allowing implementations
|
||||
to call native
|
||||
operating system or other APIs[.](#1.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13181)
|
||||
|
||||
Implementations should provide such behavior as it is defined by
|
||||
POSIX[.](#2.sentence-1)
|
||||
|
||||
Implementations shall document any behavior that differs from the
|
||||
behavior defined by POSIX[.](#2.sentence-2)
|
||||
|
||||
Implementations that do not support exact POSIX
|
||||
behavior should provide behavior as close to POSIX behavior as is reasonable given the
|
||||
limitations of actual operating systems and file systems[.](#2.sentence-3)
|
||||
|
||||
If an implementation cannot provide any
|
||||
reasonable behavior, the implementation shall report an error as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-4)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
This allows users to rely on an exception being thrown or
|
||||
an error code being set when an implementation cannot provide any reasonable
|
||||
behavior[.](#2.sentence-5)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13194)
|
||||
|
||||
Implementations are not required to provide behavior that is not supported by
|
||||
a particular file system[.](#3.sentence-1)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
The FAT file system used by some memory cards, camera memory, and
|
||||
floppy disks does not support hard links, symlinks, and many other features of
|
||||
more capable file systems, so implementations are not required to support those
|
||||
features on the FAT file system
|
||||
but instead are required to report an error as described above[.](#3.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
26
cppdraft/fs/conform/os.md
Normal file
26
cppdraft/fs/conform/os.md
Normal file
@@ -0,0 +1,26 @@
|
||||
[fs.conform.os]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.conform.os)
|
||||
|
||||
### 31.12.2 Conformance [[fs.conformance]](fs.conformance#fs.conform.os)
|
||||
|
||||
#### 31.12.2.3 Operating system dependent behavior conformance [fs.conform.os]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13206)
|
||||
|
||||
Behavior that is specified as being[*operating system dependent*](#def:operating_system_dependent "31.12.2.3 Operating system dependent behavior conformance [fs.conform.os]") is dependent upon the behavior
|
||||
and characteristics of an operating system[.](#1.sentence-1)
|
||||
|
||||
The operating system an
|
||||
implementation is dependent upon isimplementation-defined[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13215)
|
||||
|
||||
It is permissible for an implementation to be dependent upon an operating
|
||||
system emulator rather than the actual underlying operating system[.](#2.sentence-1)
|
||||
125
cppdraft/fs/conformance.md
Normal file
125
cppdraft/fs/conformance.md
Normal file
@@ -0,0 +1,125 @@
|
||||
[fs.conformance]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.conformance)
|
||||
|
||||
### 31.12.2 Conformance [fs.conformance]
|
||||
|
||||
#### [31.12.2.1](#general) General [[fs.conformance.general]](fs.conformance.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13168)
|
||||
|
||||
Conformance is specified in terms of behavior[.](#general-1.sentence-1)
|
||||
|
||||
Ideal behavior is not always
|
||||
implementable, so the conformance subclauses take that into account[.](#general-1.sentence-2)
|
||||
|
||||
#### [31.12.2.2](#fs.conform.9945) POSIX conformance [[fs.conform.9945]](fs.conform.9945)
|
||||
|
||||
[1](#fs.conform.9945-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13173)
|
||||
|
||||
Some behavior is specified by reference to POSIX[.](#fs.conform.9945-1.sentence-1)
|
||||
|
||||
How such behavior is actually implemented is unspecified[.](#fs.conform.9945-1.sentence-2)
|
||||
|
||||
[*Note [1](#fs.conform.9945-note-1)*:
|
||||
|
||||
This constitutes an âas ifâ rule allowing implementations
|
||||
to call native
|
||||
operating system or other APIs[.](#fs.conform.9945-1.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#fs.conform.9945-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13181)
|
||||
|
||||
Implementations should provide such behavior as it is defined by
|
||||
POSIX[.](#fs.conform.9945-2.sentence-1)
|
||||
|
||||
Implementations shall document any behavior that differs from the
|
||||
behavior defined by POSIX[.](#fs.conform.9945-2.sentence-2)
|
||||
|
||||
Implementations that do not support exact POSIX
|
||||
behavior should provide behavior as close to POSIX behavior as is reasonable given the
|
||||
limitations of actual operating systems and file systems[.](#fs.conform.9945-2.sentence-3)
|
||||
|
||||
If an implementation cannot provide any
|
||||
reasonable behavior, the implementation shall report an error as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#fs.conform.9945-2.sentence-4)
|
||||
|
||||
[*Note [2](#fs.conform.9945-note-2)*:
|
||||
|
||||
This allows users to rely on an exception being thrown or
|
||||
an error code being set when an implementation cannot provide any reasonable
|
||||
behavior[.](#fs.conform.9945-2.sentence-5)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[3](#fs.conform.9945-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13194)
|
||||
|
||||
Implementations are not required to provide behavior that is not supported by
|
||||
a particular file system[.](#fs.conform.9945-3.sentence-1)
|
||||
|
||||
[*Example [1](#fs.conform.9945-example-1)*:
|
||||
|
||||
The FAT file system used by some memory cards, camera memory, and
|
||||
floppy disks does not support hard links, symlinks, and many other features of
|
||||
more capable file systems, so implementations are not required to support those
|
||||
features on the FAT file system
|
||||
but instead are required to report an error as described above[.](#fs.conform.9945-3.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
|
||||
#### [31.12.2.3](#fs.conform.os) Operating system dependent behavior conformance [[fs.conform.os]](fs.conform.os)
|
||||
|
||||
[1](#fs.conform.os-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13206)
|
||||
|
||||
Behavior that is specified as being[*operating system dependent*](#def:operating_system_dependent "31.12.2.3 Operating system dependent behavior conformance [fs.conform.os]") is dependent upon the behavior
|
||||
and characteristics of an operating system[.](#fs.conform.os-1.sentence-1)
|
||||
|
||||
The operating system an
|
||||
implementation is dependent upon isimplementation-defined[.](#fs.conform.os-1.sentence-2)
|
||||
|
||||
[2](#fs.conform.os-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13215)
|
||||
|
||||
It is permissible for an implementation to be dependent upon an operating
|
||||
system emulator rather than the actual underlying operating system[.](#fs.conform.os-2.sentence-1)
|
||||
|
||||
#### [31.12.2.4](#fs.race.behavior) File system race behavior [[fs.race.behavior]](fs.race.behavior)
|
||||
|
||||
[1](#fs.race.behavior-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13221)
|
||||
|
||||
A [*file system race*](#def:file_system_race "31.12.2.4 File system race behavior [fs.race.behavior]") is
|
||||
the condition that occurs
|
||||
when multiple threads, processes, or computers interleave access and
|
||||
modification of
|
||||
the same object within a file system[.](#fs.race.behavior-1.sentence-1)
|
||||
|
||||
Behavior is undefined if calls to functions provided by subclause [[filesystems]](filesystems "31.12 File systems") introduce a file system race[.](#fs.race.behavior-1.sentence-2)
|
||||
|
||||
[2](#fs.race.behavior-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13229)
|
||||
|
||||
If the possibility of a file system race would make it unreliable for a
|
||||
program to test for a precondition before calling a function described herein,*Preconditions*: is not specified for the function[.](#fs.race.behavior-2.sentence-1)
|
||||
|
||||
[*Note [1](#fs.race.behavior-note-1)*:
|
||||
|
||||
As a design practice, preconditions are not specified when it
|
||||
is unreasonable for a program to detect them prior to calling the function[.](#fs.race.behavior-2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
18
cppdraft/fs/conformance/general.md
Normal file
18
cppdraft/fs/conformance/general.md
Normal file
@@ -0,0 +1,18 @@
|
||||
[fs.conformance.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.conformance.general)
|
||||
|
||||
### 31.12.2 Conformance [[fs.conformance]](fs.conformance#general)
|
||||
|
||||
#### 31.12.2.1 General [fs.conformance.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13168)
|
||||
|
||||
Conformance is specified in terms of behavior[.](#1.sentence-1)
|
||||
|
||||
Ideal behavior is not always
|
||||
implementable, so the conformance subclauses take that into account[.](#1.sentence-2)
|
||||
34
cppdraft/fs/dir/entry/cons.md
Normal file
34
cppdraft/fs/dir/entry/cons.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[fs.dir.entry.cons]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.dir.entry.cons)
|
||||
|
||||
### 31.12.10 Class directory_entry [[fs.class.directory.entry]](fs.class.directory.entry#fs.dir.entry.cons)
|
||||
|
||||
#### 31.12.10.2 Constructors [fs.dir.entry.cons]
|
||||
|
||||
[ð](#lib:directory_entry,constructor)
|
||||
|
||||
`explicit directory_entry(const filesystem::path& p);
|
||||
directory_entry(const filesystem::path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16172)
|
||||
|
||||
*Effects*: Calls refresh() or refresh(ec), respectively[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16176)
|
||||
|
||||
*Postconditions*: path() == p if no error occurs,
|
||||
otherwise path() == filesystem::path()[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16181)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
22
cppdraft/fs/dir/entry/io.md
Normal file
22
cppdraft/fs/dir/entry/io.md
Normal file
@@ -0,0 +1,22 @@
|
||||
[fs.dir.entry.io]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.dir.entry.io)
|
||||
|
||||
### 31.12.10 Class directory_entry [[fs.class.directory.entry]](fs.class.directory.entry#fs.dir.entry.io)
|
||||
|
||||
#### 31.12.10.5 Inserter [fs.dir.entry.io]
|
||||
|
||||
[ð](#lib:operator%3c%3c,directory_entry)
|
||||
|
||||
`template<class charT, class traits>
|
||||
friend basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16530)
|
||||
|
||||
*Effects*: Equivalent to: return os << d.path();
|
||||
84
cppdraft/fs/dir/entry/mods.md
Normal file
84
cppdraft/fs/dir/entry/mods.md
Normal file
@@ -0,0 +1,84 @@
|
||||
[fs.dir.entry.mods]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.dir.entry.mods)
|
||||
|
||||
### 31.12.10 Class directory_entry [[fs.class.directory.entry]](fs.class.directory.entry#fs.dir.entry.mods)
|
||||
|
||||
#### 31.12.10.3 Modifiers [fs.dir.entry.mods]
|
||||
|
||||
[ð](#lib:assign,directory_entry)
|
||||
|
||||
`void assign(const filesystem::path& p);
|
||||
void assign(const filesystem::path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16195)
|
||||
|
||||
*Effects*: Equivalent to *path-object* = p,
|
||||
then refresh() or refresh(ec), respectively[.](#1.sentence-1)
|
||||
|
||||
If an error occurs, the values of any cached attributes are unspecified[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16201)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:replace_filename,directory_entry)
|
||||
|
||||
`void replace_filename(const filesystem::path& p);
|
||||
void replace_filename(const filesystem::path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16213)
|
||||
|
||||
*Effects*: Equivalent to *path-object*.replace_filename(p),
|
||||
then refresh() or refresh(ec), respectively[.](#3.sentence-1)
|
||||
|
||||
If an error occurs, the values of any cached attributes are unspecified[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16219)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:refresh,directory_entry)
|
||||
|
||||
`void refresh();
|
||||
void refresh(error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16231)
|
||||
|
||||
*Effects*: Stores the current values of any cached attributes of the file p resolves to[.](#5.sentence-1)
|
||||
|
||||
If an error occurs, an error is reported ([[fs.err.report]](fs.err.report "31.12.5 Error reporting"))
|
||||
and the values of any cached attributes are unspecified[.](#5.sentence-2)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16237)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16241)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Implementations of directory_iterator ([[fs.class.directory.iterator]](fs.class.directory.iterator "31.12.11 Class directory_iterator"))
|
||||
are prohibited from directly or indirectly calling the refresh function
|
||||
as described in [[fs.class.directory.iterator.general]](fs.class.directory.iterator.general "31.12.11.1 General")[.](#7.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
311
cppdraft/fs/dir/entry/obs.md
Normal file
311
cppdraft/fs/dir/entry/obs.md
Normal file
@@ -0,0 +1,311 @@
|
||||
[fs.dir.entry.obs]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.dir.entry.obs)
|
||||
|
||||
### 31.12.10 Class directory_entry [[fs.class.directory.entry]](fs.class.directory.entry#fs.dir.entry.obs)
|
||||
|
||||
#### 31.12.10.4 Observers [fs.dir.entry.obs]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16251)
|
||||
|
||||
Unqualified function names in the *Returns*: elements of thedirectory_entry observers described below refer to members of thestd::filesystem namespace[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:path,directory_entry)
|
||||
|
||||
`const filesystem::path& path() const noexcept;
|
||||
operator const filesystem::path&() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16264)
|
||||
|
||||
*Returns*: *path-object*[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:exists,directory_entry)
|
||||
|
||||
`bool exists() const;
|
||||
bool exists(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16276)
|
||||
|
||||
*Returns*: exists(this->status()) or exists(this->status(ec)), respectively[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16280)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:is_block_file,directory_entry)
|
||||
|
||||
`bool is_block_file() const;
|
||||
bool is_block_file(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16292)
|
||||
|
||||
*Returns*: is_block_file(this->status()) or is_block_file(this->status(ec)), respectively[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16296)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:is_character_file,directory_entry)
|
||||
|
||||
`bool is_character_file() const;
|
||||
bool is_character_file(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16308)
|
||||
|
||||
*Returns*: is_character_file(this->status()) or is_character_file(this->status(ec)), respectively[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16312)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:is_directory,directory_entry)
|
||||
|
||||
`bool is_directory() const;
|
||||
bool is_directory(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16324)
|
||||
|
||||
*Returns*: is_directory(this->status()) or is_directory(this->status(ec)), respectively[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16328)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#10.sentence-1)
|
||||
|
||||
[ð](#lib:is_fifo,directory_entry)
|
||||
|
||||
`bool is_fifo() const;
|
||||
bool is_fifo(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16340)
|
||||
|
||||
*Returns*: is_fifo(this->status()) or is_fifo(this->status(ec)), respectively[.](#11.sentence-1)
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16344)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:is_other,directory_entry)
|
||||
|
||||
`bool is_other() const;
|
||||
bool is_other(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16356)
|
||||
|
||||
*Returns*: is_other(this->status()) or is_other(this->status(ec)), respectively[.](#13.sentence-1)
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16360)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:is_regular_file,directory_entry)
|
||||
|
||||
`bool is_regular_file() const;
|
||||
bool is_regular_file(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16372)
|
||||
|
||||
*Returns*: is_regular_file(this->status()) or is_regular_file(this->status(ec)), respectively[.](#15.sentence-1)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16376)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#16.sentence-1)
|
||||
|
||||
[ð](#lib:is_socket,directory_entry)
|
||||
|
||||
`bool is_socket() const;
|
||||
bool is_socket(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16388)
|
||||
|
||||
*Returns*: is_socket(this->status()) or is_socket(this->status(ec)), respectively[.](#17.sentence-1)
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16392)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#18.sentence-1)
|
||||
|
||||
[ð](#lib:is_symlink,directory_entry)
|
||||
|
||||
`bool is_symlink() const;
|
||||
bool is_symlink(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16404)
|
||||
|
||||
*Returns*: is_symlink(this->symlink_status()) or is_symlink(this->symlink_status(ec)), respectively[.](#19.sentence-1)
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16408)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#20.sentence-1)
|
||||
|
||||
[ð](#lib:file_size,directory_entry)
|
||||
|
||||
`uintmax_t file_size() const;
|
||||
uintmax_t file_size(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[21](#21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16420)
|
||||
|
||||
*Returns*: If cached, the file size attribute value[.](#21.sentence-1)
|
||||
|
||||
Otherwise, file_size(path()) or file_size(path(), ec), respectively[.](#21.sentence-2)
|
||||
|
||||
[22](#22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16425)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#22.sentence-1)
|
||||
|
||||
[ð](#lib:hard_link_count,directory_entry)
|
||||
|
||||
`uintmax_t hard_link_count() const;
|
||||
uintmax_t hard_link_count(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[23](#23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16437)
|
||||
|
||||
*Returns*: If cached, the hard link count attribute value[.](#23.sentence-1)
|
||||
|
||||
Otherwise, hard_link_count(path()) or hard_link_count(path(), ec), respectively[.](#23.sentence-2)
|
||||
|
||||
[24](#24)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16442)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#24.sentence-1)
|
||||
|
||||
[ð](#lib:last_write_time,directory_entry)
|
||||
|
||||
`file_time_type last_write_time() const;
|
||||
file_time_type last_write_time(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[25](#25)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16454)
|
||||
|
||||
*Returns*: If cached, the last write time attribute value[.](#25.sentence-1)
|
||||
|
||||
Otherwise, last_write_time(path()) or last_write_time(path(), ec), respectively[.](#25.sentence-2)
|
||||
|
||||
[26](#26)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16459)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#26.sentence-1)
|
||||
|
||||
[ð](#lib:status,directory_entry)
|
||||
|
||||
`file_status status() const;
|
||||
file_status status(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[27](#27)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16471)
|
||||
|
||||
*Returns*: If cached, the status attribute value[.](#27.sentence-1)
|
||||
|
||||
Otherwise, status(path()) or status(path(), ec), respectively[.](#27.sentence-2)
|
||||
|
||||
[28](#28)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16476)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#28.sentence-1)
|
||||
|
||||
[ð](#lib:symlink_status,directory_entry)
|
||||
|
||||
`file_status symlink_status() const;
|
||||
file_status symlink_status(error_code& ec) const noexcept;
|
||||
`
|
||||
|
||||
[29](#29)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16488)
|
||||
|
||||
*Returns*: If cached, the symlink status attribute value[.](#29.sentence-1)
|
||||
|
||||
Otherwise, symlink_status(path()) or symlink_status(path(), ec), respectively[.](#29.sentence-2)
|
||||
|
||||
[30](#30)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16493)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#30.sentence-1)
|
||||
|
||||
[ð](#lib:operator==,directory_entry)
|
||||
|
||||
`bool operator==(const directory_entry& rhs) const noexcept;
|
||||
`
|
||||
|
||||
[31](#31)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16504)
|
||||
|
||||
*Returns*: *path-object* == rhs.*path-object*[.](#31.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3c=%3e,directory_entry)
|
||||
|
||||
`strong_ordering operator<=>(const directory_entry& rhs) const noexcept;
|
||||
`
|
||||
|
||||
[32](#32)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16515)
|
||||
|
||||
*Returns*: *path-object* <=> rhs.*path-object*[.](#32.sentence-1)
|
||||
117
cppdraft/fs/dir/itr/members.md
Normal file
117
cppdraft/fs/dir/itr/members.md
Normal file
@@ -0,0 +1,117 @@
|
||||
[fs.dir.itr.members]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.dir.itr.members)
|
||||
|
||||
### 31.12.11 Class directory_iterator [[fs.class.directory.iterator]](fs.class.directory.iterator#fs.dir.itr.members)
|
||||
|
||||
#### 31.12.11.2 Members [fs.dir.itr.members]
|
||||
|
||||
[ð](#lib:directory_iterator,constructor)
|
||||
|
||||
`directory_iterator() noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16655)
|
||||
|
||||
*Effects*: Constructs the end iterator[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:directory_iterator,constructor_)
|
||||
|
||||
`explicit directory_iterator(const path& p);
|
||||
directory_iterator(const path& p, directory_options options);
|
||||
directory_iterator(const path& p, error_code& ec);
|
||||
directory_iterator(const path& p, directory_options options, error_code& ec);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16669)
|
||||
|
||||
*Effects*: For the directory that p resolves to, constructs an
|
||||
iterator for the first element in a sequence of directory_entry elements representing the files in the directory, if any; otherwise the end
|
||||
iterator[.](#2.sentence-1)
|
||||
|
||||
However, if(options & directory_options::skip_permission_denied) != directory_options::none and construction encounters an error indicating
|
||||
that permission to access p is denied, constructs the end iterator
|
||||
and does not report an error[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16682)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16686)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
To iterate over the current directory, use directory_iterator(".") rather than directory_iterator("")[.](#4.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:directory_iterator,constructor__)
|
||||
|
||||
`directory_iterator(const directory_iterator& rhs);
|
||||
directory_iterator(directory_iterator&& rhs) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16699)
|
||||
|
||||
*Postconditions*: *this has the original value of rhs[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,directory_iterator)
|
||||
|
||||
`directory_iterator& operator=(const directory_iterator& rhs);
|
||||
directory_iterator& operator=(directory_iterator&& rhs) noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16711)
|
||||
|
||||
*Effects*: If *this and rhs are the same
|
||||
object, the member has no effect[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16716)
|
||||
|
||||
*Postconditions*: *this has the original value of rhs[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16720)
|
||||
|
||||
*Returns*: *this[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:increment,directory_iterator)
|
||||
|
||||
`directory_iterator& operator++();
|
||||
directory_iterator& increment(error_code& ec);
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16733)
|
||||
|
||||
*Effects*: As specified for the prefix increment operation of[Input iterators](input.iterators "24.3.5.3 Input iterators [input.iterators]")[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16738)
|
||||
|
||||
*Returns*: *this[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16742)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#11.sentence-1)
|
||||
37
cppdraft/fs/dir/itr/nonmembers.md
Normal file
37
cppdraft/fs/dir/itr/nonmembers.md
Normal file
@@ -0,0 +1,37 @@
|
||||
[fs.dir.itr.nonmembers]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.dir.itr.nonmembers)
|
||||
|
||||
### 31.12.11 Class directory_iterator [[fs.class.directory.iterator]](fs.class.directory.iterator#fs.dir.itr.nonmembers)
|
||||
|
||||
#### 31.12.11.3 Non-member functions [fs.dir.itr.nonmembers]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16749)
|
||||
|
||||
These functions enable range access for directory_iterator[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:begin,directory_iterator)
|
||||
|
||||
`directory_iterator begin(directory_iterator iter) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16758)
|
||||
|
||||
*Returns*: iter[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:end,directory_iterator)
|
||||
|
||||
`directory_iterator end(directory_iterator) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16769)
|
||||
|
||||
*Returns*: directory_iterator()[.](#3.sentence-1)
|
||||
171
cppdraft/fs/enum.md
Normal file
171
cppdraft/fs/enum.md
Normal file
@@ -0,0 +1,171 @@
|
||||
[fs.enum]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum)
|
||||
|
||||
### 31.12.8 Enumerations [fs.enum]
|
||||
|
||||
#### [31.12.8.1](#path.format) Enum path::format [[fs.enum.path.format]](fs.enum.path.format)
|
||||
|
||||
[1](#path.format-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15695)
|
||||
|
||||
This enum specifies constants used to identify the format of the character
|
||||
sequence, with the meanings listed in Table [148](#tab:fs.enum.path.format "Table 148: Enum path::format")[.](#path.format-1.sentence-1)
|
||||
|
||||
Table [148](#tab:fs.enum.path.format) — Enum path::format [[tab:fs.enum.path.format]](./tab:fs.enum.path.format)
|
||||
|
||||
| [ð](#tab:fs.enum.path.format-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.path.format-row-2)<br>native_format | The native pathname format[.](#tab:fs.enum.path.format-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.path.format-row-3)<br>generic_format | The generic pathname format[.](#tab:fs.enum.path.format-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.path.format-row-4)<br>auto_format | The interpretation of the format of the character sequence is implementation-defined[.](#tab:fs.enum.path.format-row-4-column-2-sentence-1)<br>The implementation may inspect the content of the character sequence to determine the format[.](#tab:fs.enum.path.format-row-4-column-2-sentence-2)<br>*Recommended practice*: For POSIX-based systems, native and generic formats are equivalent and the character sequence should always be interpreted in the same way[.](#tab:fs.enum.path.format-row-4-column-2-sentence-3) |
|
||||
|
||||
#### [31.12.8.2](#file.type) Enum class file_type [[fs.enum.file.type]](fs.enum.file.type)
|
||||
|
||||
[1](#file.type-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15720)
|
||||
|
||||
This enum class specifies constants used to identify file types,
|
||||
with the meanings listed in Table [149](#tab:fs.enum.file.type "Table 149: Enum class file_type")[.](#file.type-1.sentence-1)
|
||||
|
||||
The values of the constants are distinct[.](#file.type-1.sentence-2)
|
||||
|
||||
Table [149](#tab:fs.enum.file.type) — Enum class file_type [[tab:fs.enum.file.type]](./tab:fs.enum.file.type)
|
||||
|
||||
| [ð](#tab:fs.enum.file.type-row-1)<br>**Constant** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.file.type-row-2)<br>[none](#lib:file_type,none "31.12.8.2 Enum class file_type [fs.enum.file.type]") | The type of the file has not been determined or an error occurred while trying to determine the type[.](#tab:fs.enum.file.type-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.file.type-row-3)<br>[not_found](#lib:file_type,not_found "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Pseudo-type indicating the file was not found[.](#tab:fs.enum.file.type-row-3-column-2-sentence-1)<br>[*Note [1](#tab:fs.enum.file.type-row-3-column-2-note-1)*:<br>The file not being found is not considered an error while determining the type of a file[.](#tab:fs.enum.file.type-row-3-column-2-sentence-2) â *end note*] |
|
||||
| [ð](#tab:fs.enum.file.type-row-4)<br>[regular](#lib:file_type,regular "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Regular file |
|
||||
| [ð](#tab:fs.enum.file.type-row-5)<br>[directory](#lib:file_type,directory "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Directory file |
|
||||
| [ð](#tab:fs.enum.file.type-row-6)<br>[symlink](#lib:file_type,symlink "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Symbolic link file |
|
||||
| [ð](#tab:fs.enum.file.type-row-7)<br>[block](#lib:file_type,block "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Block special file |
|
||||
| [ð](#tab:fs.enum.file.type-row-8)<br>[character](#lib:file_type,character "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Character special file |
|
||||
| [ð](#tab:fs.enum.file.type-row-9)<br>[fifo](#lib:file_type,fifo "31.12.8.2 Enum class file_type [fs.enum.file.type]") | FIFO or pipe file |
|
||||
| [ð](#tab:fs.enum.file.type-row-10)<br>[socket](#lib:file_type,socket "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Socket file |
|
||||
| [ð](#tab:fs.enum.file.type-row-11)<br>*implementation-defined* | Implementations that support file systems having file types in addition to the above file_type types shall supply implementation-defined file_type constants to separately identify each of those additional file types |
|
||||
| [ð](#tab:fs.enum.file.type-row-12)<br>[unknown](#lib:file_type,unknown "31.12.8.2 Enum class file_type [fs.enum.file.type]") | The file exists but the type cannot be determined |
|
||||
|
||||
#### [31.12.8.3](#copy.opts) Enum class copy_options [[fs.enum.copy.opts]](fs.enum.copy.opts)
|
||||
|
||||
[1](#copy.opts-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15766)
|
||||
|
||||
The enum class type copy_options is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to control the semantics of
|
||||
copy operations[.](#copy.opts-1.sentence-1)
|
||||
|
||||
The constants are specified in option groups with the meanings listed in Table [150](#tab:fs.enum.copy.opts "Table 150: Enum class copy_options")[.](#copy.opts-1.sentence-2)
|
||||
|
||||
The constant none represents the empty bitmask, and
|
||||
is shown in each option group for purposes of exposition;
|
||||
implementations shall provide only a single definition[.](#copy.opts-1.sentence-3)
|
||||
|
||||
Every other constant in the table represents a distinct bitmask element[.](#copy.opts-1.sentence-4)
|
||||
|
||||
Table [150](#tab:fs.enum.copy.opts) — Enum class copy_options [[tab:fs.enum.copy.opts]](./tab:fs.enum.copy.opts)
|
||||
|
||||
| [ð](#tab:fs.enum.copy.opts-row-1)<br>**Option group controlling copy_file function effects for existing target files** | |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-2)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-3)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Error; file already exists[.](#tab:fs.enum.copy.opts-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-4)<br>[skip_existing](#lib:copy_options,skip_existing "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Do not overwrite existing file, do not report an error[.](#tab:fs.enum.copy.opts-row-4-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-5)<br>[overwrite_existing](#lib:copy_options,overwrite_existing "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Overwrite the existing file[.](#tab:fs.enum.copy.opts-row-5-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-6)<br>[update_existing](#lib:copy_options,update_existing "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Overwrite the existing file if it is older than the replacement file[.](#tab:fs.enum.copy.opts-row-6-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-7)<br>**Option group controlling copy function effects for subdirectories** | |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-8)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-9)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Do not copy subdirectories[.](#tab:fs.enum.copy.opts-row-9-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-10)<br>[recursive](#lib:copy_options,recursive "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Recursively copy subdirectories and their contents[.](#tab:fs.enum.copy.opts-row-10-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-11)<br>**Option group controlling copy function effects for symbolic links** | |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-12)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-13)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Follow symbolic links[.](#tab:fs.enum.copy.opts-row-13-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-14)<br>[copy_symlinks](#lib:copy_options,copy_symlinks "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Copy symbolic links as symbolic links rather than copying the files that they point to[.](#tab:fs.enum.copy.opts-row-14-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-15)<br>[skip_symlinks](#lib:copy_options,skip_symlinks "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Ignore symbolic links[.](#tab:fs.enum.copy.opts-row-15-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-16)<br>**Option group controlling copy function effects for choosing the form of copying** | |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-17)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-18)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Copy content[.](#tab:fs.enum.copy.opts-row-18-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-19)<br>[directories_only](#lib:copy_options,directories_only "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Copy directory structure only, do not copy non-directory files[.](#tab:fs.enum.copy.opts-row-19-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-20)<br>[create_symlinks](#lib:copy_options,create_symlinks "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Make symbolic links instead of copies of files[.](#tab:fs.enum.copy.opts-row-20-column-2-sentence-1)<br>The source path shall be an absolute path unless the destination path is in the current directory[.](#tab:fs.enum.copy.opts-row-20-column-2-sentence-2) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-21)<br>[create_hard_links](#lib:copy_options,create_hard_links "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Make hard links instead of copies of files[.](#tab:fs.enum.copy.opts-row-21-column-2-sentence-1) |
|
||||
|
||||
#### [31.12.8.4](#perms) Enum class perms [[fs.enum.perms]](fs.enum.perms)
|
||||
|
||||
[1](#perms-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15823)
|
||||
|
||||
The enum class type perms is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to identify file
|
||||
permissions, with the meanings listed in Table [151](#tab:fs.enum.perms "Table 151: Enum class perms")[.](#perms-1.sentence-1)
|
||||
|
||||
Table [151](#tab:fs.enum.perms) — Enum class perms [[tab:fs.enum.perms]](./tab:fs.enum.perms)
|
||||
|
||||
| [ð](#tab:fs.enum.perms-row-1)<br>**Name** | **Value** | **POSIX** | **Definition or notes** |
|
||||
| --- | --- | --- | --- |
|
||||
| [ð](#tab:fs.enum.perms-row-2) | **(octal)** | **macro** | |
|
||||
| [ð](#tab:fs.enum.perms-row-3)<br>[none](#lib:perms,none "31.12.8.4 Enum class perms [fs.enum.perms]") | 0 | | There are no permissions set for the file[.](#tab:fs.enum.perms-row-3-column-4-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perms-row-4)<br>[owner_read](#lib:perms,owner_read "31.12.8.4 Enum class perms [fs.enum.perms]") | 0400 | S_IRUSR | Read permission, owner |
|
||||
| [ð](#tab:fs.enum.perms-row-5)<br>[owner_write](#lib:perms,owner_write "31.12.8.4 Enum class perms [fs.enum.perms]") | 0200 | S_IWUSR | Write permission, owner |
|
||||
| [ð](#tab:fs.enum.perms-row-6)<br>[owner_exec](#lib:perms,owner_exec "31.12.8.4 Enum class perms [fs.enum.perms]") | 0100 | S_IXUSR | Execute/search permission, owner |
|
||||
| [ð](#tab:fs.enum.perms-row-7)<br>[owner_all](#lib:perms,owner_all "31.12.8.4 Enum class perms [fs.enum.perms]") | 0700 | S_IRWXU | Read, write, execute/search by owner; owner_read | owner_write | owner_exec |
|
||||
| [ð](#tab:fs.enum.perms-row-8)<br>[group_read](#lib:perms,group_read "31.12.8.4 Enum class perms [fs.enum.perms]") | 040 | S_IRGRP | Read permission, group |
|
||||
| [ð](#tab:fs.enum.perms-row-9)<br>[group_write](#lib:perms,group_write "31.12.8.4 Enum class perms [fs.enum.perms]") | 020 | S_IWGRP | Write permission, group |
|
||||
| [ð](#tab:fs.enum.perms-row-10)<br>[group_exec](#lib:perms,group_exec "31.12.8.4 Enum class perms [fs.enum.perms]") | 010 | S_IXGRP | Execute/search permission, group |
|
||||
| [ð](#tab:fs.enum.perms-row-11)<br>[group_all](#lib:perms,group_all "31.12.8.4 Enum class perms [fs.enum.perms]") | 070 | S_IRWXG | Read, write, execute/search by group; group_read | group_write | group_exec |
|
||||
| [ð](#tab:fs.enum.perms-row-12)<br>[others_read](#lib:perms,others_read "31.12.8.4 Enum class perms [fs.enum.perms]") | 04 | S_IROTH | Read permission, others |
|
||||
| [ð](#tab:fs.enum.perms-row-13)<br>[others_write](#lib:perms,others_write "31.12.8.4 Enum class perms [fs.enum.perms]") | 02 | S_IWOTH | Write permission, others |
|
||||
| [ð](#tab:fs.enum.perms-row-14)<br>[others_exec](#lib:perms,others_exec "31.12.8.4 Enum class perms [fs.enum.perms]") | 01 | S_IXOTH | Execute/search permission, others |
|
||||
| [ð](#tab:fs.enum.perms-row-15)<br>[others_all](#lib:perms,others_all "31.12.8.4 Enum class perms [fs.enum.perms]") | 07 | S_IRWXO | Read, write, execute/search by others; others_read | others_write | others_exec |
|
||||
| [ð](#tab:fs.enum.perms-row-16)<br>[all](#lib:perms,all "31.12.8.4 Enum class perms [fs.enum.perms]") | 0777 | | owner_all | group_all | others_all |
|
||||
| [ð](#tab:fs.enum.perms-row-17)<br>[set_uid](#lib:perms,set_uid "31.12.8.4 Enum class perms [fs.enum.perms]") | 04000 | S_ISUID | Set-user-ID on execution |
|
||||
| [ð](#tab:fs.enum.perms-row-18)<br>[set_gid](#lib:perms,set_gid "31.12.8.4 Enum class perms [fs.enum.perms]") | 02000 | S_ISGID | Set-group-ID on execution |
|
||||
| [ð](#tab:fs.enum.perms-row-19)<br>[sticky_bit](#lib:perms,sticky_bit "31.12.8.4 Enum class perms [fs.enum.perms]") | 01000 | S_ISVTX | Operating system dependent[.](#tab:fs.enum.perms-row-19-column-4-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perms-row-20)<br>[mask](#lib:perms,mask "31.12.8.4 Enum class perms [fs.enum.perms]") | 07777 | | all | set_uid | set_gid | sticky_bit |
|
||||
| [ð](#tab:fs.enum.perms-row-21)<br>[unknown](#lib:perms,unknown "31.12.8.4 Enum class perms [fs.enum.perms]") | 0xFFFF | | The permissions are not known, such as when a file_status object is created without specifying the permissions |
|
||||
|
||||
#### [31.12.8.5](#perm.opts) Enum class perm_options [[fs.enum.perm.opts]](fs.enum.perm.opts)
|
||||
|
||||
[1](#perm.opts-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15882)
|
||||
|
||||
The enum class type perm_options is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to
|
||||
control the semantics of permissions operations,
|
||||
with the meanings listed in Table [152](#tab:fs.enum.perm.opts "Table 152: Enum class perm_options")[.](#perm.opts-1.sentence-1)
|
||||
|
||||
The bitmask constants are bitmask elements[.](#perm.opts-1.sentence-2)
|
||||
|
||||
In Table [152](#tab:fs.enum.perm.opts "Table 152: Enum class perm_options") perm denotes a value of type perms passed to permissions[.](#perm.opts-1.sentence-3)
|
||||
|
||||
Table [152](#tab:fs.enum.perm.opts) — Enum class perm_options [[tab:fs.enum.perm.opts]](./tab:fs.enum.perm.opts)
|
||||
|
||||
| [ð](#tab:fs.enum.perm.opts-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-2)<br>[replace](#lib:perm_options,replace "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall replace the file's permission bits with perm |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-3)<br>[add](#lib:perm_options,add "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall replace the file's permission bits with the bitwise or of perm and the file's current permission bits[.](#tab:fs.enum.perm.opts-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-4)<br>[remove](#lib:perm_options,remove "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall replace the file's permission bits with the bitwise and of the complement of perm and the file's current permission bits[.](#tab:fs.enum.perm.opts-row-4-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-5)<br>[nofollow](#lib:perm_options,nofollow "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall change the permissions of a symbolic link itself rather than the permissions of the file the link resolves to[.](#tab:fs.enum.perm.opts-row-5-column-2-sentence-1) |
|
||||
|
||||
#### [31.12.8.6](#dir.opts) Enum class directory_options [[fs.enum.dir.opts]](fs.enum.dir.opts)
|
||||
|
||||
[1](#dir.opts-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15913)
|
||||
|
||||
The enum class type directory_options is a bitmask
|
||||
type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to identify
|
||||
directory traversal options, with the meanings listed in Table [153](#tab:fs.enum.dir.opts "Table 153: Enum class directory_options")[.](#dir.opts-1.sentence-1)
|
||||
|
||||
The constant none represents the empty bitmask;
|
||||
every other constant in the table represents a distinct bitmask element[.](#dir.opts-1.sentence-2)
|
||||
|
||||
Table [153](#tab:fs.enum.dir.opts) — Enum class directory_options [[tab:fs.enum.dir.opts]](./tab:fs.enum.dir.opts)
|
||||
|
||||
| [ð](#tab:fs.enum.dir.opts-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.dir.opts-row-2)<br>[none](#lib:directory_options,none "31.12.8.6 Enum class directory_options [fs.enum.dir.opts]") | (Default) Skip directory symlinks, permission denied is an error[.](#tab:fs.enum.dir.opts-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.dir.opts-row-3)<br>[follow_directory_symlink](#lib:directory_options,follow_directory_symlink "31.12.8.6 Enum class directory_options [fs.enum.dir.opts]") | Follow rather than skip directory symlinks[.](#tab:fs.enum.dir.opts-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.dir.opts-row-4)<br>[skip_permission_denied](#lib:directory_options,skip_permission_denied "31.12.8.6 Enum class directory_options [fs.enum.dir.opts]") | Skip directories that would otherwise result in permission denied[.](#tab:fs.enum.dir.opts-row-4-column-2-sentence-1) |
|
||||
49
cppdraft/fs/enum/copy/opts.md
Normal file
49
cppdraft/fs/enum/copy/opts.md
Normal file
@@ -0,0 +1,49 @@
|
||||
[fs.enum.copy.opts]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum.copy.opts)
|
||||
|
||||
### 31.12.8 Enumerations [[fs.enum]](fs.enum#copy.opts)
|
||||
|
||||
#### 31.12.8.3 Enum class copy_options [fs.enum.copy.opts]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15766)
|
||||
|
||||
The enum class type copy_options is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to control the semantics of
|
||||
copy operations[.](#1.sentence-1)
|
||||
|
||||
The constants are specified in option groups with the meanings listed in Table [150](#tab:fs.enum.copy.opts "Table 150: Enum class copy_options")[.](#1.sentence-2)
|
||||
|
||||
The constant none represents the empty bitmask, and
|
||||
is shown in each option group for purposes of exposition;
|
||||
implementations shall provide only a single definition[.](#1.sentence-3)
|
||||
|
||||
Every other constant in the table represents a distinct bitmask element[.](#1.sentence-4)
|
||||
|
||||
Table [150](#tab:fs.enum.copy.opts) — Enum class copy_options [[tab:fs.enum.copy.opts]](./tab:fs.enum.copy.opts)
|
||||
|
||||
| [ð](#tab:fs.enum.copy.opts-row-1)<br>**Option group controlling copy_file function effects for existing target files** | |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-2)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-3)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Error; file already exists[.](#tab:fs.enum.copy.opts-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-4)<br>[skip_existing](#lib:copy_options,skip_existing "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Do not overwrite existing file, do not report an error[.](#tab:fs.enum.copy.opts-row-4-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-5)<br>[overwrite_existing](#lib:copy_options,overwrite_existing "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Overwrite the existing file[.](#tab:fs.enum.copy.opts-row-5-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-6)<br>[update_existing](#lib:copy_options,update_existing "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Overwrite the existing file if it is older than the replacement file[.](#tab:fs.enum.copy.opts-row-6-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-7)<br>**Option group controlling copy function effects for subdirectories** | |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-8)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-9)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Do not copy subdirectories[.](#tab:fs.enum.copy.opts-row-9-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-10)<br>[recursive](#lib:copy_options,recursive "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Recursively copy subdirectories and their contents[.](#tab:fs.enum.copy.opts-row-10-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-11)<br>**Option group controlling copy function effects for symbolic links** | |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-12)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-13)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Follow symbolic links[.](#tab:fs.enum.copy.opts-row-13-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-14)<br>[copy_symlinks](#lib:copy_options,copy_symlinks "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Copy symbolic links as symbolic links rather than copying the files that they point to[.](#tab:fs.enum.copy.opts-row-14-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-15)<br>[skip_symlinks](#lib:copy_options,skip_symlinks "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Ignore symbolic links[.](#tab:fs.enum.copy.opts-row-15-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-16)<br>**Option group controlling copy function effects for choosing the form of copying** | |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-17)<br>**Constant** | **Meaning** |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-18)<br>[none](#lib:copy_options,none "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | (Default) Copy content[.](#tab:fs.enum.copy.opts-row-18-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-19)<br>[directories_only](#lib:copy_options,directories_only "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Copy directory structure only, do not copy non-directory files[.](#tab:fs.enum.copy.opts-row-19-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-20)<br>[create_symlinks](#lib:copy_options,create_symlinks "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Make symbolic links instead of copies of files[.](#tab:fs.enum.copy.opts-row-20-column-2-sentence-1)<br>The source path shall be an absolute path unless the destination path is in the current directory[.](#tab:fs.enum.copy.opts-row-20-column-2-sentence-2) |
|
||||
| [ð](#tab:fs.enum.copy.opts-row-21)<br>[create_hard_links](#lib:copy_options,create_hard_links "31.12.8.3 Enum class copy_options [fs.enum.copy.opts]") | Make hard links instead of copies of files[.](#tab:fs.enum.copy.opts-row-21-column-2-sentence-1) |
|
||||
28
cppdraft/fs/enum/dir/opts.md
Normal file
28
cppdraft/fs/enum/dir/opts.md
Normal file
@@ -0,0 +1,28 @@
|
||||
[fs.enum.dir.opts]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum.dir.opts)
|
||||
|
||||
### 31.12.8 Enumerations [[fs.enum]](fs.enum#dir.opts)
|
||||
|
||||
#### 31.12.8.6 Enum class directory_options [fs.enum.dir.opts]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15913)
|
||||
|
||||
The enum class type directory_options is a bitmask
|
||||
type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to identify
|
||||
directory traversal options, with the meanings listed in Table [153](#tab:fs.enum.dir.opts "Table 153: Enum class directory_options")[.](#1.sentence-1)
|
||||
|
||||
The constant none represents the empty bitmask;
|
||||
every other constant in the table represents a distinct bitmask element[.](#1.sentence-2)
|
||||
|
||||
Table [153](#tab:fs.enum.dir.opts) — Enum class directory_options [[tab:fs.enum.dir.opts]](./tab:fs.enum.dir.opts)
|
||||
|
||||
| [ð](#tab:fs.enum.dir.opts-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.dir.opts-row-2)<br>[none](#lib:directory_options,none "31.12.8.6 Enum class directory_options [fs.enum.dir.opts]") | (Default) Skip directory symlinks, permission denied is an error[.](#tab:fs.enum.dir.opts-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.dir.opts-row-3)<br>[follow_directory_symlink](#lib:directory_options,follow_directory_symlink "31.12.8.6 Enum class directory_options [fs.enum.dir.opts]") | Follow rather than skip directory symlinks[.](#tab:fs.enum.dir.opts-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.dir.opts-row-4)<br>[skip_permission_denied](#lib:directory_options,skip_permission_denied "31.12.8.6 Enum class directory_options [fs.enum.dir.opts]") | Skip directories that would otherwise result in permission denied[.](#tab:fs.enum.dir.opts-row-4-column-2-sentence-1) |
|
||||
34
cppdraft/fs/enum/file/type.md
Normal file
34
cppdraft/fs/enum/file/type.md
Normal file
@@ -0,0 +1,34 @@
|
||||
[fs.enum.file.type]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum.file.type)
|
||||
|
||||
### 31.12.8 Enumerations [[fs.enum]](fs.enum#file.type)
|
||||
|
||||
#### 31.12.8.2 Enum class file_type [fs.enum.file.type]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15720)
|
||||
|
||||
This enum class specifies constants used to identify file types,
|
||||
with the meanings listed in Table [149](#tab:fs.enum.file.type "Table 149: Enum class file_type")[.](#1.sentence-1)
|
||||
|
||||
The values of the constants are distinct[.](#1.sentence-2)
|
||||
|
||||
Table [149](#tab:fs.enum.file.type) — Enum class file_type [[tab:fs.enum.file.type]](./tab:fs.enum.file.type)
|
||||
|
||||
| [ð](#tab:fs.enum.file.type-row-1)<br>**Constant** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.file.type-row-2)<br>[none](#lib:file_type,none "31.12.8.2 Enum class file_type [fs.enum.file.type]") | The type of the file has not been determined or an error occurred while trying to determine the type[.](#tab:fs.enum.file.type-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.file.type-row-3)<br>[not_found](#lib:file_type,not_found "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Pseudo-type indicating the file was not found[.](#tab:fs.enum.file.type-row-3-column-2-sentence-1)<br>[*Note [1](#tab:fs.enum.file.type-row-3-column-2-note-1)*:<br>The file not being found is not considered an error while determining the type of a file[.](#tab:fs.enum.file.type-row-3-column-2-sentence-2) â *end note*] |
|
||||
| [ð](#tab:fs.enum.file.type-row-4)<br>[regular](#lib:file_type,regular "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Regular file |
|
||||
| [ð](#tab:fs.enum.file.type-row-5)<br>[directory](#lib:file_type,directory "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Directory file |
|
||||
| [ð](#tab:fs.enum.file.type-row-6)<br>[symlink](#lib:file_type,symlink "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Symbolic link file |
|
||||
| [ð](#tab:fs.enum.file.type-row-7)<br>[block](#lib:file_type,block "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Block special file |
|
||||
| [ð](#tab:fs.enum.file.type-row-8)<br>[character](#lib:file_type,character "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Character special file |
|
||||
| [ð](#tab:fs.enum.file.type-row-9)<br>[fifo](#lib:file_type,fifo "31.12.8.2 Enum class file_type [fs.enum.file.type]") | FIFO or pipe file |
|
||||
| [ð](#tab:fs.enum.file.type-row-10)<br>[socket](#lib:file_type,socket "31.12.8.2 Enum class file_type [fs.enum.file.type]") | Socket file |
|
||||
| [ð](#tab:fs.enum.file.type-row-11)<br>*implementation-defined* | Implementations that support file systems having file types in addition to the above file_type types shall supply implementation-defined file_type constants to separately identify each of those additional file types |
|
||||
| [ð](#tab:fs.enum.file.type-row-12)<br>[unknown](#lib:file_type,unknown "31.12.8.2 Enum class file_type [fs.enum.file.type]") | The file exists but the type cannot be determined |
|
||||
24
cppdraft/fs/enum/path/format.md
Normal file
24
cppdraft/fs/enum/path/format.md
Normal file
@@ -0,0 +1,24 @@
|
||||
[fs.enum.path.format]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum.path.format)
|
||||
|
||||
### 31.12.8 Enumerations [[fs.enum]](fs.enum#path.format)
|
||||
|
||||
#### 31.12.8.1 Enum path::format [fs.enum.path.format]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15695)
|
||||
|
||||
This enum specifies constants used to identify the format of the character
|
||||
sequence, with the meanings listed in Table [148](#tab:fs.enum.path.format "Table 148: Enum path::format")[.](#1.sentence-1)
|
||||
|
||||
Table [148](#tab:fs.enum.path.format) — Enum path::format [[tab:fs.enum.path.format]](./tab:fs.enum.path.format)
|
||||
|
||||
| [ð](#tab:fs.enum.path.format-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.path.format-row-2)<br>native_format | The native pathname format[.](#tab:fs.enum.path.format-row-2-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.path.format-row-3)<br>generic_format | The generic pathname format[.](#tab:fs.enum.path.format-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.path.format-row-4)<br>auto_format | The interpretation of the format of the character sequence is implementation-defined[.](#tab:fs.enum.path.format-row-4-column-2-sentence-1)<br>The implementation may inspect the content of the character sequence to determine the format[.](#tab:fs.enum.path.format-row-4-column-2-sentence-2)<br>*Recommended practice*: For POSIX-based systems, native and generic formats are equivalent and the character sequence should always be interpreted in the same way[.](#tab:fs.enum.path.format-row-4-column-2-sentence-3) |
|
||||
30
cppdraft/fs/enum/perm/opts.md
Normal file
30
cppdraft/fs/enum/perm/opts.md
Normal file
@@ -0,0 +1,30 @@
|
||||
[fs.enum.perm.opts]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum.perm.opts)
|
||||
|
||||
### 31.12.8 Enumerations [[fs.enum]](fs.enum#perm.opts)
|
||||
|
||||
#### 31.12.8.5 Enum class perm_options [fs.enum.perm.opts]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15882)
|
||||
|
||||
The enum class type perm_options is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to
|
||||
control the semantics of permissions operations,
|
||||
with the meanings listed in Table [152](#tab:fs.enum.perm.opts "Table 152: Enum class perm_options")[.](#1.sentence-1)
|
||||
|
||||
The bitmask constants are bitmask elements[.](#1.sentence-2)
|
||||
|
||||
In Table [152](#tab:fs.enum.perm.opts "Table 152: Enum class perm_options") perm denotes a value of type perms passed to permissions[.](#1.sentence-3)
|
||||
|
||||
Table [152](#tab:fs.enum.perm.opts) — Enum class perm_options [[tab:fs.enum.perm.opts]](./tab:fs.enum.perm.opts)
|
||||
|
||||
| [ð](#tab:fs.enum.perm.opts-row-1)<br>**Name** | **Meaning** |
|
||||
| --- | --- |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-2)<br>[replace](#lib:perm_options,replace "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall replace the file's permission bits with perm |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-3)<br>[add](#lib:perm_options,add "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall replace the file's permission bits with the bitwise or of perm and the file's current permission bits[.](#tab:fs.enum.perm.opts-row-3-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-4)<br>[remove](#lib:perm_options,remove "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall replace the file's permission bits with the bitwise and of the complement of perm and the file's current permission bits[.](#tab:fs.enum.perm.opts-row-4-column-2-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perm.opts-row-5)<br>[nofollow](#lib:perm_options,nofollow "31.12.8.5 Enum class perm_options [fs.enum.perm.opts]") | permissions shall change the permissions of a symbolic link itself rather than the permissions of the file the link resolves to[.](#tab:fs.enum.perm.opts-row-5-column-2-sentence-1) |
|
||||
41
cppdraft/fs/enum/perms.md
Normal file
41
cppdraft/fs/enum/perms.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.enum.perms]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.enum.perms)
|
||||
|
||||
### 31.12.8 Enumerations [[fs.enum]](fs.enum#perms)
|
||||
|
||||
#### 31.12.8.4 Enum class perms [fs.enum.perms]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15823)
|
||||
|
||||
The enum class type perms is a bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3 Bitmask types")) that specifies bitmask constants used to identify file
|
||||
permissions, with the meanings listed in Table [151](#tab:fs.enum.perms "Table 151: Enum class perms")[.](#1.sentence-1)
|
||||
|
||||
Table [151](#tab:fs.enum.perms) — Enum class perms [[tab:fs.enum.perms]](./tab:fs.enum.perms)
|
||||
|
||||
| [ð](#tab:fs.enum.perms-row-1)<br>**Name** | **Value** | **POSIX** | **Definition or notes** |
|
||||
| --- | --- | --- | --- |
|
||||
| [ð](#tab:fs.enum.perms-row-2) | **(octal)** | **macro** | |
|
||||
| [ð](#tab:fs.enum.perms-row-3)<br>[none](#lib:perms,none "31.12.8.4 Enum class perms [fs.enum.perms]") | 0 | | There are no permissions set for the file[.](#tab:fs.enum.perms-row-3-column-4-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perms-row-4)<br>[owner_read](#lib:perms,owner_read "31.12.8.4 Enum class perms [fs.enum.perms]") | 0400 | S_IRUSR | Read permission, owner |
|
||||
| [ð](#tab:fs.enum.perms-row-5)<br>[owner_write](#lib:perms,owner_write "31.12.8.4 Enum class perms [fs.enum.perms]") | 0200 | S_IWUSR | Write permission, owner |
|
||||
| [ð](#tab:fs.enum.perms-row-6)<br>[owner_exec](#lib:perms,owner_exec "31.12.8.4 Enum class perms [fs.enum.perms]") | 0100 | S_IXUSR | Execute/search permission, owner |
|
||||
| [ð](#tab:fs.enum.perms-row-7)<br>[owner_all](#lib:perms,owner_all "31.12.8.4 Enum class perms [fs.enum.perms]") | 0700 | S_IRWXU | Read, write, execute/search by owner; owner_read | owner_write | owner_exec |
|
||||
| [ð](#tab:fs.enum.perms-row-8)<br>[group_read](#lib:perms,group_read "31.12.8.4 Enum class perms [fs.enum.perms]") | 040 | S_IRGRP | Read permission, group |
|
||||
| [ð](#tab:fs.enum.perms-row-9)<br>[group_write](#lib:perms,group_write "31.12.8.4 Enum class perms [fs.enum.perms]") | 020 | S_IWGRP | Write permission, group |
|
||||
| [ð](#tab:fs.enum.perms-row-10)<br>[group_exec](#lib:perms,group_exec "31.12.8.4 Enum class perms [fs.enum.perms]") | 010 | S_IXGRP | Execute/search permission, group |
|
||||
| [ð](#tab:fs.enum.perms-row-11)<br>[group_all](#lib:perms,group_all "31.12.8.4 Enum class perms [fs.enum.perms]") | 070 | S_IRWXG | Read, write, execute/search by group; group_read | group_write | group_exec |
|
||||
| [ð](#tab:fs.enum.perms-row-12)<br>[others_read](#lib:perms,others_read "31.12.8.4 Enum class perms [fs.enum.perms]") | 04 | S_IROTH | Read permission, others |
|
||||
| [ð](#tab:fs.enum.perms-row-13)<br>[others_write](#lib:perms,others_write "31.12.8.4 Enum class perms [fs.enum.perms]") | 02 | S_IWOTH | Write permission, others |
|
||||
| [ð](#tab:fs.enum.perms-row-14)<br>[others_exec](#lib:perms,others_exec "31.12.8.4 Enum class perms [fs.enum.perms]") | 01 | S_IXOTH | Execute/search permission, others |
|
||||
| [ð](#tab:fs.enum.perms-row-15)<br>[others_all](#lib:perms,others_all "31.12.8.4 Enum class perms [fs.enum.perms]") | 07 | S_IRWXO | Read, write, execute/search by others; others_read | others_write | others_exec |
|
||||
| [ð](#tab:fs.enum.perms-row-16)<br>[all](#lib:perms,all "31.12.8.4 Enum class perms [fs.enum.perms]") | 0777 | | owner_all | group_all | others_all |
|
||||
| [ð](#tab:fs.enum.perms-row-17)<br>[set_uid](#lib:perms,set_uid "31.12.8.4 Enum class perms [fs.enum.perms]") | 04000 | S_ISUID | Set-user-ID on execution |
|
||||
| [ð](#tab:fs.enum.perms-row-18)<br>[set_gid](#lib:perms,set_gid "31.12.8.4 Enum class perms [fs.enum.perms]") | 02000 | S_ISGID | Set-group-ID on execution |
|
||||
| [ð](#tab:fs.enum.perms-row-19)<br>[sticky_bit](#lib:perms,sticky_bit "31.12.8.4 Enum class perms [fs.enum.perms]") | 01000 | S_ISVTX | Operating system dependent[.](#tab:fs.enum.perms-row-19-column-4-sentence-1) |
|
||||
| [ð](#tab:fs.enum.perms-row-20)<br>[mask](#lib:perms,mask "31.12.8.4 Enum class perms [fs.enum.perms]") | 07777 | | all | set_uid | set_gid | sticky_bit |
|
||||
| [ð](#tab:fs.enum.perms-row-21)<br>[unknown](#lib:perms,unknown "31.12.8.4 Enum class perms [fs.enum.perms]") | 0xFFFF | | The permissions are not known, such as when a file_status object is created without specifying the permissions |
|
||||
77
cppdraft/fs/err/report.md
Normal file
77
cppdraft/fs/err/report.md
Normal file
@@ -0,0 +1,77 @@
|
||||
[fs.err.report]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.err.report)
|
||||
|
||||
### 31.12.5 Error reporting [fs.err.report]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13501)
|
||||
|
||||
Filesystem library functions often provide two overloads, one that
|
||||
throws an exception to report file system errors, and another that sets an error_code[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This supports two common use cases:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
Uses where file system errors are truly exceptional
|
||||
and indicate a serious failure[.](#1.1.sentence-1)
|
||||
Throwing an exception is an appropriate response[.](#1.1.sentence-2)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
Uses where file system errors are routine
|
||||
and do not necessarily represent failure[.](#1.2.sentence-1)
|
||||
Returning an error code is the most appropriate response[.](#1.2.sentence-2)
|
||||
This allows application specific error handling, including simply ignoring the error[.](#1.2.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13519)
|
||||
|
||||
Functions not having an argument of type error_code& handle errors as follows, unless otherwise specified:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
When a call by the
|
||||
implementation to an operating system or other underlying API results in an
|
||||
error that prevents the function from meeting its specifications, an exception
|
||||
of typefilesystem_error shall be thrown[.](#2.1.sentence-1)
|
||||
For functions with a single path
|
||||
argument, that argument shall be passed to thefilesystem_error constructor with a single path argument[.](#2.1.sentence-2)
|
||||
For
|
||||
functions with two path arguments, the first of these arguments shall be
|
||||
passed to thefilesystem_error constructor as the path1 argument,
|
||||
and the second shall be passed as the path2 argument[.](#2.1.sentence-3)
|
||||
The filesystem_error constructor's error_code argument
|
||||
is set as appropriate for the specific operating system dependent error[.](#2.1.sentence-4)
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
Failure to allocate storage is reported by throwing an exception
|
||||
as described in [[res.on.exception.handling]](res.on.exception.handling "16.4.6.14 Restrictions on exception handling")[.](#2.2.sentence-1)
|
||||
|
||||
- [(2.3)](#2.3)
|
||||
|
||||
Destructors throw nothing[.](#2.3.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13541)
|
||||
|
||||
Functions having an argument of type error_code& handle errors as follows, unless otherwise specified:
|
||||
|
||||
- [(3.1)](#3.1)
|
||||
|
||||
If a call by the
|
||||
implementation to an operating system or other underlying API results in an
|
||||
error that prevents the function from meeting its specifications, the error_code& argument is set as
|
||||
appropriate for the specific operating system dependent error[.](#3.sentence-1)
|
||||
Otherwise, clear() is called on the error_code& argument[.](#3.1.sentence-2)
|
||||
20
cppdraft/fs/file/status/cons.md
Normal file
20
cppdraft/fs/file/status/cons.md
Normal file
@@ -0,0 +1,20 @@
|
||||
[fs.file.status.cons]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.file.status.cons)
|
||||
|
||||
### 31.12.9 Class file_status [[fs.class.file.status]](fs.class.file.status#fs.file.status.cons)
|
||||
|
||||
#### 31.12.9.2 Constructors [fs.file.status.cons]
|
||||
|
||||
[ð](#lib:file_status,constructor)
|
||||
|
||||
`explicit file_status(file_type ft, perms prms = perms::unknown) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15981)
|
||||
|
||||
*Postconditions*: type() == ft and permissions() == prms[.](#1.sentence-1)
|
||||
31
cppdraft/fs/file/status/mods.md
Normal file
31
cppdraft/fs/file/status/mods.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[fs.file.status.mods]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.file.status.mods)
|
||||
|
||||
### 31.12.9 Class file_status [[fs.class.file.status]](fs.class.file.status#fs.file.status.mods)
|
||||
|
||||
#### 31.12.9.4 Modifiers [fs.file.status.mods]
|
||||
|
||||
[ð](#lib:type,file_status)
|
||||
|
||||
`void type(file_type ft) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16020)
|
||||
|
||||
*Postconditions*: type() == ft[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:permissions,file_status)
|
||||
|
||||
`void permissions(perms prms) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16031)
|
||||
|
||||
*Postconditions*: permissions() == prms[.](#2.sentence-1)
|
||||
31
cppdraft/fs/file/status/obs.md
Normal file
31
cppdraft/fs/file/status/obs.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[fs.file.status.obs]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.file.status.obs)
|
||||
|
||||
### 31.12.9 Class file_status [[fs.class.file.status]](fs.class.file.status#fs.file.status.obs)
|
||||
|
||||
#### 31.12.9.3 Observers [fs.file.status.obs]
|
||||
|
||||
[ð](#lib:type,file_status)
|
||||
|
||||
`file_type type() const noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15994)
|
||||
|
||||
*Returns*: The value of type() specified by the postconditions of the most recent call to a constructor, operator=, or type(file_type) function[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:permissions,file_status)
|
||||
|
||||
`perms permissions() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L16006)
|
||||
|
||||
*Returns*: The value of permissions() specified by the postconditions of the most recent call to a constructor, operator=, or permissions(perms) function[.](#2.sentence-1)
|
||||
139
cppdraft/fs/filesystem/error/members.md
Normal file
139
cppdraft/fs/filesystem/error/members.md
Normal file
@@ -0,0 +1,139 @@
|
||||
[fs.filesystem.error.members]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.filesystem.error.members)
|
||||
|
||||
### 31.12.7 Class filesystem_error [[fs.class.filesystem.error]](fs.class.filesystem.error#fs.filesystem.error.members)
|
||||
|
||||
#### 31.12.7.2 Members [fs.filesystem.error.members]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15598)
|
||||
|
||||
Constructors are provided that store zero, one, or two paths associated with
|
||||
an error[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:filesystem_error,constructor)
|
||||
|
||||
`filesystem_error(const string& what_arg, error_code ec);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15608)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
code() == ec is true,
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
path1().empty() is true,
|
||||
|
||||
- [(2.3)](#2.3)
|
||||
|
||||
path2().empty() is true, and
|
||||
|
||||
- [(2.4)](#2.4)
|
||||
|
||||
string_view(what()).find(what_arg.c_str()) != string_view::npos is true[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:filesystem_error,constructor_)
|
||||
|
||||
`filesystem_error(const string& what_arg, const path& p1, error_code ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15624)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(3.1)](#3.1)
|
||||
|
||||
code() == ec is true,
|
||||
|
||||
- [(3.2)](#3.2)
|
||||
|
||||
path1() returns a reference to the stored copy of p1,
|
||||
|
||||
- [(3.3)](#3.3)
|
||||
|
||||
path2().empty() is true, and
|
||||
|
||||
- [(3.4)](#3.4)
|
||||
|
||||
string_view(what()).find(what_arg.c_str()) != string_view::npos is true[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:filesystem_error,constructor__)
|
||||
|
||||
`filesystem_error(const string& what_arg, const path& p1, const path& p2, error_code ec);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15640)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
code() == ec,
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
path1() returns a reference to the stored copy of p1,
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
path2() returns a reference to the stored copy of p2, and
|
||||
|
||||
- [(4.4)](#4.4)
|
||||
|
||||
string_view(what()).find(what_arg.c_str()) != string_view::npos[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:path1,filesystem_error)
|
||||
|
||||
`const path& path1() const noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15656)
|
||||
|
||||
*Returns*: A reference to the copy of p1 stored by the
|
||||
constructor, or, if none, an empty path[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:path2,filesystem_error)
|
||||
|
||||
`const path& path2() const noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15668)
|
||||
|
||||
*Returns*: A reference to the copy of p2 stored by the
|
||||
constructor, or, if none, an empty path[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:what,filesystem_error)
|
||||
|
||||
`const char* what() const noexcept override;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15680)
|
||||
|
||||
*Returns*: An ntbs that incorporates
|
||||
the what_arg argument supplied to the constructor[.](#7.sentence-1)
|
||||
|
||||
The exact format is unspecified[.](#7.sentence-2)
|
||||
|
||||
Implementations should include
|
||||
the system_error::what() string and
|
||||
the pathnames of path1 and path2 in the native format in the returned string[.](#7.sentence-3)
|
||||
76
cppdraft/fs/filesystem/syn.md
Normal file
76
cppdraft/fs/filesystem/syn.md
Normal file
@@ -0,0 +1,76 @@
|
||||
[fs.filesystem.syn]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.filesystem.syn)
|
||||
|
||||
### 31.12.4 Header <filesystem> synopsis [fs.filesystem.syn]
|
||||
|
||||
[ð](#header:%3cfilesystem%3e)
|
||||
|
||||
#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")namespace std::filesystem {// [[fs.class.path]](fs.class.path "31.12.6 Class path"), pathsclass path; // [[fs.path.nonmember]](fs.path.nonmember "31.12.6.8 Non-member functions"), path non-member functionsvoid swap(path& lhs, path& rhs) noexcept;
|
||||
size_t hash_value(const path& p) noexcept; // [[fs.class.filesystem.error]](fs.class.filesystem.error "31.12.7 Class filesystem_error"), filesystem errorsclass filesystem_error; // [[fs.class.directory.entry]](fs.class.directory.entry "31.12.10 Class directory_entry"), directory entriesclass directory_entry; // [[fs.class.directory.iterator]](fs.class.directory.iterator "31.12.11 Class directory_iterator"), directory iteratorsclass directory_iterator; // [[fs.dir.itr.nonmembers]](fs.dir.itr.nonmembers "31.12.11.3 Non-member functions"), range access for directory iterators directory_iterator begin(directory_iterator iter) noexcept;
|
||||
directory_iterator end(directory_iterator) noexcept; // [[fs.class.rec.dir.itr]](fs.class.rec.dir.itr "31.12.12 Class recursive_directory_iterator"), recursive directory iteratorsclass recursive_directory_iterator; // [[fs.rec.dir.itr.nonmembers]](fs.rec.dir.itr.nonmembers "31.12.12.3 Non-member functions"), range access for recursive directory iterators recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
|
||||
recursive_directory_iterator end(recursive_directory_iterator) noexcept; // [[fs.class.file.status]](fs.class.file.status "31.12.9 Class file_status"), file statusclass file_status; struct space_info { uintmax_t capacity;
|
||||
uintmax_t free;
|
||||
uintmax_t available; friend bool operator==(const space_info&, const space_info&) = default; }; // [[fs.enum]](fs.enum "31.12.8 Enumerations"), enumerationsenum class file_type; enum class perms; enum class perm_options; enum class copy_options; enum class directory_options; using file_time_type = chrono::time_point<chrono::file_clock>; // [[fs.op.funcs]](fs.op.funcs "31.12.13 Filesystem operation functions"), filesystem operations path absolute(const path& p);
|
||||
path absolute(const path& p, error_code& ec);
|
||||
|
||||
path canonical(const path& p);
|
||||
path canonical(const path& p, error_code& ec); void copy(const path& from, const path& to); void copy(const path& from, const path& to, error_code& ec); void copy(const path& from, const path& to, copy_options options); void copy(const path& from, const path& to, copy_options options,
|
||||
error_code& ec); bool copy_file(const path& from, const path& to); bool copy_file(const path& from, const path& to, error_code& ec); bool copy_file(const path& from, const path& to, copy_options option); bool copy_file(const path& from, const path& to, copy_options option,
|
||||
error_code& ec); void copy_symlink(const path& existing_symlink, const path& new_symlink); void copy_symlink(const path& existing_symlink, const path& new_symlink,
|
||||
error_code& ec) noexcept; bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec); bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec) noexcept; bool create_directory(const path& p, const path& attributes); bool create_directory(const path& p, const path& attributes,
|
||||
error_code& ec) noexcept; void create_directory_symlink(const path& to, const path& new_symlink); void create_directory_symlink(const path& to, const path& new_symlink,
|
||||
error_code& ec) noexcept; void create_hard_link(const path& to, const path& new_hard_link); void create_hard_link(const path& to, const path& new_hard_link,
|
||||
error_code& ec) noexcept; void create_symlink(const path& to, const path& new_symlink); void create_symlink(const path& to, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
|
||||
path current_path();
|
||||
path current_path(error_code& ec); void current_path(const path& p); void current_path(const path& p, error_code& ec) noexcept; bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; bool exists(file_status s) noexcept; bool exists(const path& p); bool exists(const path& p, error_code& ec) noexcept;
|
||||
|
||||
uintmax_t file_size(const path& p);
|
||||
uintmax_t file_size(const path& p, error_code& ec) noexcept;
|
||||
|
||||
uintmax_t hard_link_count(const path& p);
|
||||
uintmax_t hard_link_count(const path& p, error_code& ec) noexcept; bool is_block_file(file_status s) noexcept; bool is_block_file(const path& p); bool is_block_file(const path& p, error_code& ec) noexcept; bool is_character_file(file_status s) noexcept; bool is_character_file(const path& p); bool is_character_file(const path& p, error_code& ec) noexcept; bool is_directory(file_status s) noexcept; bool is_directory(const path& p); bool is_directory(const path& p, error_code& ec) noexcept; bool is_empty(const path& p); bool is_empty(const path& p, error_code& ec); bool is_fifo(file_status s) noexcept; bool is_fifo(const path& p); bool is_fifo(const path& p, error_code& ec) noexcept; bool is_other(file_status s) noexcept; bool is_other(const path& p); bool is_other(const path& p, error_code& ec) noexcept; bool is_regular_file(file_status s) noexcept; bool is_regular_file(const path& p); bool is_regular_file(const path& p, error_code& ec) noexcept; bool is_socket(file_status s) noexcept; bool is_socket(const path& p); bool is_socket(const path& p, error_code& ec) noexcept; bool is_symlink(file_status s) noexcept; bool is_symlink(const path& p); bool is_symlink(const path& p, error_code& ec) noexcept;
|
||||
|
||||
file_time_type last_write_time(const path& p);
|
||||
file_time_type last_write_time(const path& p, error_code& ec) noexcept; void last_write_time(const path& p, file_time_type new_time); void last_write_time(const path& p, file_time_type new_time,
|
||||
error_code& ec) noexcept; void permissions(const path& p, perms prms, perm_options opts=perm_options::replace); void permissions(const path& p, perms prms, error_code& ec) noexcept; void permissions(const path& p, perms prms, perm_options opts, error_code& ec);
|
||||
|
||||
path proximate(const path& p, error_code& ec);
|
||||
path proximate(const path& p, const path& base = current_path());
|
||||
path proximate(const path& p, const path& base, error_code& ec);
|
||||
|
||||
path read_symlink(const path& p);
|
||||
path read_symlink(const path& p, error_code& ec);
|
||||
|
||||
path relative(const path& p, error_code& ec);
|
||||
path relative(const path& p, const path& base = current_path());
|
||||
path relative(const path& p, const path& base, error_code& ec); bool remove(const path& p); bool remove(const path& p, error_code& ec) noexcept;
|
||||
|
||||
uintmax_t remove_all(const path& p);
|
||||
uintmax_t remove_all(const path& p, error_code& ec); void rename(const path& from, const path& to); void rename(const path& from, const path& to, error_code& ec) noexcept; void resize_file(const path& p, uintmax_t size); void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept;
|
||||
|
||||
space_info space(const path& p);
|
||||
space_info space(const path& p, error_code& ec) noexcept;
|
||||
|
||||
file_status status(const path& p);
|
||||
file_status status(const path& p, error_code& ec) noexcept; bool status_known(file_status s) noexcept;
|
||||
|
||||
file_status symlink_status(const path& p);
|
||||
file_status symlink_status(const path& p, error_code& ec) noexcept;
|
||||
|
||||
path temp_directory_path();
|
||||
path temp_directory_path(error_code& ec);
|
||||
|
||||
path weakly_canonical(const path& p);
|
||||
path weakly_canonical(const path& p, error_code& ec);}namespace std {// [[fs.path.fmtr]](fs.path.fmtr "31.12.6.9 Formatting support"), formatting supporttemplate<class charT> struct formatter<filesystem::path, charT>; // [[fs.path.hash]](fs.path.hash "31.12.6.10 Hash support"), hash supporttemplate<class T> struct hash; template<> struct hash<filesystem::path>;}namespace std::ranges {template<>inline constexpr bool enable_borrowed_range<filesystem::directory_iterator> = true; template<>inline constexpr bool enable_borrowed_range<filesystem::recursive_directory_iterator> = true; template<>inline constexpr bool enable_view<filesystem::directory_iterator> = true; template<>inline constexpr bool enable_view<filesystem::recursive_directory_iterator> = true;}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13494)
|
||||
|
||||
Implementations should ensure that the resolution and range offile_time_type reflect the operating system dependent resolution and range
|
||||
of file time values[.](#1.sentence-1)
|
||||
97
cppdraft/fs/general.md
Normal file
97
cppdraft/fs/general.md
Normal file
@@ -0,0 +1,97 @@
|
||||
[fs.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.general)
|
||||
|
||||
### 31.12.1 General [fs.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13115)
|
||||
|
||||
Subclause [[filesystems]](filesystems "31.12 File systems") describes operations on file systems and their components, such as paths,
|
||||
regular files, and directories[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13119)
|
||||
|
||||
A [*file system*](#def:file_system "31.12.1 General [fs.general]") is
|
||||
a collection of files and their attributes[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13123)
|
||||
|
||||
A [*file*](#def:file "31.12.1 General [fs.general]") is
|
||||
an object within a file system that holds user or system data[.](#3.sentence-1)
|
||||
|
||||
Files can be written to, or read from, or both[.](#3.sentence-2)
|
||||
|
||||
A file
|
||||
has certain attributes, including type[.](#3.sentence-3)
|
||||
|
||||
File types include regular files
|
||||
and directories[.](#3.sentence-4)
|
||||
|
||||
Other types of files, such as symbolic links,
|
||||
may be supported by the implementation[.](#3.sentence-5)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13130)
|
||||
|
||||
A [*directory*](#def:directory "31.12.1 General [fs.general]") is
|
||||
a file within a file system that acts as a container of directory entries
|
||||
that contain information about
|
||||
other files, possibly including other directory files[.](#4.sentence-1)
|
||||
|
||||
The [*parent directory*](#def:parent_directory "31.12.1 General [fs.general]") of a directory is
|
||||
the directory that both contains a
|
||||
directory entry for the given directory and is represented by the dot-dot
|
||||
filename ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format")) in the given directory[.](#4.sentence-2)
|
||||
|
||||
The [*parent directory*](#def:parent_directory "31.12.1 General [fs.general]") of other types of files is a directory containing a directory
|
||||
entry for the file under discussion[.](#4.sentence-3)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13143)
|
||||
|
||||
A [*link*](#def:link "31.12.1 General [fs.general]") is
|
||||
an object that associates a filename with a file[.](#5.sentence-1)
|
||||
|
||||
Several links can associate names with the same file[.](#5.sentence-2)
|
||||
|
||||
A [*hard link*](#def:hard_link "31.12.1 General [fs.general]") is
|
||||
a link to an existing file[.](#5.sentence-3)
|
||||
|
||||
Some
|
||||
file systems support multiple hard links to a file[.](#5.sentence-4)
|
||||
|
||||
If the last hard link to a
|
||||
file is removed, the file itself is removed[.](#5.sentence-5)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A hard link can be thought of as a shared-ownership smart
|
||||
pointer to a file[.](#5.sentence-6)
|
||||
|
||||
â *end note*]
|
||||
|
||||
A [*symbolic link*](#def:symbolic_link "31.12.1 General [fs.general]") is
|
||||
a type of file with the
|
||||
property that when the file is encountered during pathname resolution ([[fs.class.path]](fs.class.path "31.12.6 Class path")), a string
|
||||
stored by the file is used to modify the pathname resolution[.](#5.sentence-7)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Symbolic links are often called symlinks[.](#5.sentence-8)
|
||||
|
||||
A symbolic link can be thought of as a raw pointer to a file[.](#5.sentence-9)
|
||||
|
||||
If the file pointed to does not exist, the symbolic link is said to be a
|
||||
âdanglingâ symbolic link[.](#5.sentence-10)
|
||||
|
||||
â *end note*]
|
||||
81
cppdraft/fs/op/absolute.md
Normal file
81
cppdraft/fs/op/absolute.md
Normal file
@@ -0,0 +1,81 @@
|
||||
[fs.op.absolute]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.absolute)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.absolute)
|
||||
|
||||
#### 31.12.13.2 Absolute [fs.op.absolute]
|
||||
|
||||
[ð](#lib:absolute)
|
||||
|
||||
`path filesystem::absolute(const path& p);
|
||||
path filesystem::absolute(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17173)
|
||||
|
||||
*Effects*: Composes an absolute path referencing the same file system location
|
||||
as p according to the operating system ([[fs.conform.os]](fs.conform.os "31.12.2.3 Operating system dependent behavior conformance"))[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17178)
|
||||
|
||||
*Returns*: The composed path[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17183)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
For the returned path, rp, rp.is_absolute() is true unless an error occurs[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17189)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17193)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
To resolve symlinks
|
||||
or perform other sanitization that can involve queries to secondary storage,
|
||||
such as hard disks, consider canonical ([[fs.op.canonical]](fs.op.canonical "31.12.13.3 Canonical"))[.](#5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17200)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
Implementations are strongly encouraged to not query secondary storage,
|
||||
and not consider !exists(p) an error[.](#6.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17206)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
For POSIX-based operating systems,absolute(p) is simply current_path()/p[.](#7.sentence-1)
|
||||
|
||||
For Windows-based operating systems,absolute might have the same semantics as GetFullPathNameW[.](#7.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
44
cppdraft/fs/op/canonical.md
Normal file
44
cppdraft/fs/op/canonical.md
Normal file
@@ -0,0 +1,44 @@
|
||||
[fs.op.canonical]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.canonical)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.canonical)
|
||||
|
||||
#### 31.12.13.3 Canonical [fs.op.canonical]
|
||||
|
||||
[ð](#lib:canonical)
|
||||
|
||||
`path filesystem::canonical(const path& p);
|
||||
path filesystem::canonical(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17224)
|
||||
|
||||
*Effects*: Converts p to an absolute
|
||||
path that has no symbolic link, dot, or dot-dot elements
|
||||
in its pathname in the generic format[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17230)
|
||||
|
||||
*Returns*: A path that refers to
|
||||
the same file system object as absolute(p)[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17236)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17240)
|
||||
|
||||
*Remarks*: !exists(p) is an error[.](#4.sentence-1)
|
||||
216
cppdraft/fs/op/copy.md
Normal file
216
cppdraft/fs/op/copy.md
Normal file
@@ -0,0 +1,216 @@
|
||||
[fs.op.copy]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.copy)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.copy)
|
||||
|
||||
#### 31.12.13.4 Copy [fs.op.copy]
|
||||
|
||||
[ð](#lib:copy,path)
|
||||
|
||||
`void filesystem::copy(const path& from, const path& to);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17253)
|
||||
|
||||
*Effects*: Equivalent tocopy(from, to, copy_options::none)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:copy,path_)
|
||||
|
||||
`void filesystem::copy(const path& from, const path& to, error_code& ec);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17265)
|
||||
|
||||
*Effects*: Equivalent tocopy(from, to, copy_options::none, ec)[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:copy,path__)
|
||||
|
||||
`void filesystem::copy(const path& from, const path& to, copy_options options);
|
||||
void filesystem::copy(const path& from, const path& to, copy_options options,
|
||||
error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17279)
|
||||
|
||||
*Preconditions*: At most one element from each option group ([[fs.enum.copy.opts]](fs.enum.copy.opts "31.12.8.3 Enum class copy_options"))
|
||||
is set in options[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17284)
|
||||
|
||||
*Effects*: Before the first use of f and t:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
If(options & copy_options::create_symlinks) != copy_options::none ||(options & copy_options::skip_symlinks) != copy_options::none then auto f = symlink_status(from) and if needed auto t = symlink_status(to).
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
Otherwise, if(options & copy_options::copy_symlinks) != copy_options::none then auto f = symlink_status(from) and if needed auto t = status(to).
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
Otherwise, auto f = status(from) and if needed auto t = status(to).
|
||||
|
||||
Effects are then as follows:
|
||||
|
||||
- [(4.4)](#4.4)
|
||||
|
||||
If f.type() or t.type() is an implementation-defined
|
||||
file type ([[fs.enum.file.type]](fs.enum.file.type "31.12.8.2 Enum class file_type")), then the effects areimplementation-defined[.](#4.4.sentence-1)
|
||||
|
||||
- [(4.5)](#4.5)
|
||||
|
||||
Otherwise, an error is reported as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting") if
|
||||
* [(4.5.1)](#4.5.1)
|
||||
|
||||
exists(f) is false, or
|
||||
|
||||
* [(4.5.2)](#4.5.2)
|
||||
|
||||
equivalent(from, to) is true, or
|
||||
|
||||
* [(4.5.3)](#4.5.3)
|
||||
|
||||
is_other(f) || is_other(t) is true, or
|
||||
|
||||
* [(4.5.4)](#4.5.4)
|
||||
|
||||
is_directory(f) && is_regular_file(t) is true[.](#4.5.sentence-1)
|
||||
|
||||
- [(4.6)](#4.6)
|
||||
|
||||
Otherwise, if is_symlink(f), then:
|
||||
* [(4.6.1)](#4.6.1)
|
||||
|
||||
If(options & copy_options::skip_symlinks) != copy_options::none then return[.](#4.6.1.sentence-1)
|
||||
|
||||
* [(4.6.2)](#4.6.2)
|
||||
|
||||
Otherwise if!exists(t) && (options & copy_options::copy_symlinks) != copy_options::none then copy_symlink(from, to)[.](#4.6.2.sentence-1)
|
||||
|
||||
* [(4.6.3)](#4.6.3)
|
||||
|
||||
Otherwise report an error as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.6.3.sentence-1)
|
||||
|
||||
- [(4.7)](#4.7)
|
||||
|
||||
Otherwise, if is_regular_file(f), then:
|
||||
* [(4.7.1)](#4.7.1)
|
||||
|
||||
If (options & copy_options::directories_only) != copy_options::none, then return[.](#4.7.1.sentence-1)
|
||||
|
||||
* [(4.7.2)](#4.7.2)
|
||||
|
||||
Otherwise, if (options & copy_options::create_symlinks) != copy_options::none, then create a symbolic link to the
|
||||
source file[.](#4.7.2.sentence-1)
|
||||
|
||||
* [(4.7.3)](#4.7.3)
|
||||
|
||||
Otherwise, if (options & copy_options::create_hard_links) != copy_options::none,
|
||||
then create a hard link to the source file[.](#4.7.3.sentence-1)
|
||||
|
||||
* [(4.7.4)](#4.7.4)
|
||||
|
||||
Otherwise, if is_directory(t), then copy_file(from, to/from.filename(), options)[.](#4.7.4.sentence-1)
|
||||
|
||||
* [(4.7.5)](#4.7.5)
|
||||
|
||||
Otherwise, copy_file(from, to, options)[.](#4.7.5.sentence-1)
|
||||
|
||||
- [(4.8)](#4.8)
|
||||
|
||||
Otherwise, ifis_directory(f) &&(options & copy_options::create_symlinks) != copy_options::none then report an error with an error_code argument
|
||||
equal to make_error_code(errc::is_a_directory)[.](#4.8.sentence-1)
|
||||
|
||||
- [(4.9)](#4.9)
|
||||
|
||||
Otherwise, ifis_directory(f) &&((options & copy_options::recursive) != copy_options::none || options == copy_options::none) then:
|
||||
* [(4.9.1)](#4.9.1)
|
||||
|
||||
If exists(t) is false, then create_directory(to, from).
|
||||
|
||||
* [(4.9.2)](#4.9.2)
|
||||
|
||||
Then, iterate over the files in from, as if byfor (const directory_entry& x : directory_iterator(from)) copy(x.path(), to/x.path().filename(),
|
||||
options | copy_options::*in-recursive-copy*); where *in-recursive-copy* is a bitmask element of copy_options that is not one of the elements in [[fs.enum.copy.opts]](fs.enum.copy.opts "31.12.8.3 Enum class copy_options").
|
||||
|
||||
- [(4.10)](#4.10)
|
||||
|
||||
Otherwise, for the signature with argument ec, ec.clear()[.](#4.10.sentence-1)
|
||||
|
||||
- [(4.11)](#4.11)
|
||||
|
||||
Otherwise, no effects[.](#4.11.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17381)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17385)
|
||||
|
||||
*Remarks*: For the signature with argument ec, any
|
||||
library functions called by the implementation shall have an error_code argument if applicable[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17390)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
Given this directory structure:
|
||||
|
||||
```
|
||||
/dir1
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
|
||||
```
|
||||
|
||||
Calling copy("/dir1", "/dir3") would result in:
|
||||
|
||||
```
|
||||
/dir1
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
/dir3
|
||||
file1
|
||||
file2
|
||||
|
||||
```
|
||||
|
||||
Alternatively, calling copy("/dir1", "/dir3", copy_options::recursive) would result in:
|
||||
|
||||
```
|
||||
/dir1
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
/dir3
|
||||
file1
|
||||
file2
|
||||
dir2
|
||||
file3
|
||||
|
||||
```
|
||||
|
||||
â *end example*]
|
||||
109
cppdraft/fs/op/copy/file.md
Normal file
109
cppdraft/fs/op/copy/file.md
Normal file
@@ -0,0 +1,109 @@
|
||||
[fs.op.copy.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.copy.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.copy.file)
|
||||
|
||||
#### 31.12.13.5 Copy file [fs.op.copy.file]
|
||||
|
||||
[ð](#lib:copy_file)
|
||||
|
||||
`bool filesystem::copy_file(const path& from, const path& to);
|
||||
bool filesystem::copy_file(const path& from, const path& to, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17439)
|
||||
|
||||
*Returns*: copy_file(from, to, copy_options::none) or
|
||||
|
||||
copy_file(from, to, copy_options::none, ec), respectively[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17444)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:copy_file_)
|
||||
|
||||
`bool filesystem::copy_file(const path& from, const path& to, copy_options options);
|
||||
bool filesystem::copy_file(const path& from, const path& to, copy_options options,
|
||||
error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17457)
|
||||
|
||||
*Preconditions*: At most one element from each
|
||||
option group ([[fs.enum.copy.opts]](fs.enum.copy.opts "31.12.8.3 Enum class copy_options")) is set
|
||||
in options[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17463)
|
||||
|
||||
*Effects*: As follows:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
Report an error as specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting") if
|
||||
* [(4.1.1)](#4.1.1)
|
||||
|
||||
is_regular_file(from) is false, or
|
||||
|
||||
* [(4.1.2)](#4.1.2)
|
||||
|
||||
exists(to) is true and is_regular_file(to) is false, or
|
||||
|
||||
* [(4.1.3)](#4.1.3)
|
||||
|
||||
exists(to) is true and equivalent(from, to) is true, or
|
||||
|
||||
* [(4.1.4)](#4.1.4)
|
||||
|
||||
exists(to) is true and(options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) == copy_options::none
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
Otherwise, copy the contents and attributes of the file from resolves to, to the file to resolves to, if
|
||||
* [(4.2.1)](#4.2.1)
|
||||
|
||||
exists(to) is false, or
|
||||
|
||||
* [(4.2.2)](#4.2.2)
|
||||
|
||||
(options & copy_options::overwrite_existing) != copy_options::none, or
|
||||
|
||||
* [(4.2.3)](#4.2.3)
|
||||
|
||||
(options & copy_options::update_existing) != copy_options::none and from is more recent than to, determined as if by use of the last_write_time function ([[fs.op.last.write.time]](fs.op.last.write.time "31.12.13.26 Last write time"))[.](#4.2.sentence-1)
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
Otherwise, no effects[.](#4.3.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17495)
|
||||
|
||||
*Returns*: true if the from file
|
||||
was copied, otherwise false[.](#5.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#5.sentence-2)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17501)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17505)
|
||||
|
||||
*Complexity*: At most one direct or indirect invocation of status(to)[.](#7.sentence-1)
|
||||
31
cppdraft/fs/op/copy/symlink.md
Normal file
31
cppdraft/fs/op/copy/symlink.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[fs.op.copy.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.copy.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.copy.symlink)
|
||||
|
||||
#### 31.12.13.6 Copy symlink [fs.op.copy.symlink]
|
||||
|
||||
[ð](#lib:copy_symlink)
|
||||
|
||||
`void filesystem::copy_symlink(const path& existing_symlink, const path& new_symlink);
|
||||
void filesystem::copy_symlink(const path& existing_symlink, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17520)
|
||||
|
||||
*Effects*: Equivalent to*function*(read_symlink(existing_symlink), new_symlink) or
|
||||
|
||||
*function*(read_symlink(existing_symlink, ec), new_symlink, ec), respectively,
|
||||
where in each case *function* is create_symlink or create_directory_symlink as appropriate[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17528)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
64
cppdraft/fs/op/create/dir/symlk.md
Normal file
64
cppdraft/fs/op/create/dir/symlk.md
Normal file
@@ -0,0 +1,64 @@
|
||||
[fs.op.create.dir.symlk]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.dir.symlk)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.dir.symlk)
|
||||
|
||||
#### 31.12.13.9 Create directory symlink [fs.op.create.dir.symlk]
|
||||
|
||||
[ð](#lib:create_directory_symlink)
|
||||
|
||||
`void filesystem::create_directory_symlink(const path& to, const path& new_symlink);
|
||||
void filesystem::create_directory_symlink(const path& to, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17636)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX [symlink](http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17640)
|
||||
|
||||
*Postconditions*: new_symlink resolves to a symbolic link file that
|
||||
contains an unspecified representation of to[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17645)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17649)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Some operating systems require symlink creation to
|
||||
identify that the link is to a directory[.](#4.sentence-1)
|
||||
|
||||
Thus, create_symlink (instead of create_directory_symlink)
|
||||
cannot be used reliably to create directory symlinks[.](#4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17657)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Some operating systems do not support symbolic links at all or support
|
||||
them only for regular files[.](#5.sentence-1)
|
||||
|
||||
Some file systems (such as the FAT file system) do not
|
||||
support
|
||||
symbolic links regardless of the operating system[.](#5.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
42
cppdraft/fs/op/create/directories.md
Normal file
42
cppdraft/fs/op/create/directories.md
Normal file
@@ -0,0 +1,42 @@
|
||||
[fs.op.create.directories]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.directories)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.directories)
|
||||
|
||||
#### 31.12.13.7 Create directories [fs.op.create.directories]
|
||||
|
||||
[ð](#lib:create_directories)
|
||||
|
||||
`bool filesystem::create_directories(const path& p);
|
||||
bool filesystem::create_directories(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17543)
|
||||
|
||||
*Effects*: Calls create_directory for each element of p that does not exist[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17548)
|
||||
|
||||
*Returns*: true if a new directory was created
|
||||
for the directory p resolves to,
|
||||
otherwise false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17554)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17558)
|
||||
|
||||
*Complexity*: O(n) where *n* is the number of elements
|
||||
of p[.](#4.sentence-1)
|
||||
86
cppdraft/fs/op/create/directory.md
Normal file
86
cppdraft/fs/op/create/directory.md
Normal file
@@ -0,0 +1,86 @@
|
||||
[fs.op.create.directory]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.directory)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.directory)
|
||||
|
||||
#### 31.12.13.8 Create directory [fs.op.create.directory]
|
||||
|
||||
[ð](#lib:create_directory)
|
||||
|
||||
`bool filesystem::create_directory(const path& p);
|
||||
bool filesystem::create_directory(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17574)
|
||||
|
||||
*Effects*: Creates the directory p resolves to,
|
||||
as if by POSIX mkdir with a second argument of static_cast<int>(perms::all)[.](#1.sentence-1)
|
||||
|
||||
If mkdir fails because p resolves to an existing directory,
|
||||
no error is reported[.](#1.sentence-2)
|
||||
|
||||
Otherwise on failure an error is reported[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17582)
|
||||
|
||||
*Returns*: true if a new directory was created, otherwise false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17586)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:create_directory_)
|
||||
|
||||
`bool filesystem::create_directory(const path& p, const path& existing_p);
|
||||
bool filesystem::create_directory(const path& p, const path& existing_p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17598)
|
||||
|
||||
*Effects*: Creates the
|
||||
directory p resolves to, with
|
||||
attributes copied from directory existing_p[.](#4.sentence-1)
|
||||
|
||||
The set of attributes
|
||||
copied is operating system dependent[.](#4.sentence-2)
|
||||
|
||||
If mkdir fails because p resolves to an existing directory,
|
||||
no error is reported[.](#4.sentence-3)
|
||||
|
||||
Otherwise on failure an error is reported[.](#4.sentence-4)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
For POSIX-based operating systems, the
|
||||
attributes are those copied by native API stat(existing_p.c_str(), &attributes_stat) followed by mkdir(p.c_str(), attributes_stat.st_mode)[.](#4.sentence-5)
|
||||
|
||||
For
|
||||
Windows-based operating systems, the attributes are those copied by native
|
||||
API CreateDirectoryExW(existing_p.c_str(), p.c_str(), 0)[.](#4.sentence-6)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17614)
|
||||
|
||||
*Returns*: true if a new directory was created
|
||||
with attributes copied from directory existing_p,
|
||||
otherwise false[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17620)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#6.sentence-1)
|
||||
58
cppdraft/fs/op/create/hard/lk.md
Normal file
58
cppdraft/fs/op/create/hard/lk.md
Normal file
@@ -0,0 +1,58 @@
|
||||
[fs.op.create.hard.lk]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.hard.lk)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.hard.lk)
|
||||
|
||||
#### 31.12.13.10 Create hard link [fs.op.create.hard.lk]
|
||||
|
||||
[ð](#lib:create_hard_link)
|
||||
|
||||
`void filesystem::create_hard_link(const path& to, const path& new_hard_link);
|
||||
void filesystem::create_hard_link(const path& to, const path& new_hard_link,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17677)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX link[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17681)
|
||||
|
||||
*Postconditions*:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
exists(to) && exists(new_hard_link) && equivalent(to, new_hard_link)
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
The contents of the file or directory to resolves to are unchanged[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17689)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17693)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Some operating systems do not support hard links at all or support
|
||||
them only for regular files[.](#4.sentence-1)
|
||||
|
||||
Some file systems (such as the FAT file system)
|
||||
do not support hard links regardless of the operating system[.](#4.sentence-2)
|
||||
|
||||
Some file systems limit the number of links per file[.](#4.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
49
cppdraft/fs/op/create/symlink.md
Normal file
49
cppdraft/fs/op/create/symlink.md
Normal file
@@ -0,0 +1,49 @@
|
||||
[fs.op.create.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.create.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.symlink)
|
||||
|
||||
#### 31.12.13.11 Create symlink [fs.op.create.symlink]
|
||||
|
||||
[ð](#lib:create_symlink)
|
||||
|
||||
`void filesystem::create_symlink(const path& to, const path& new_symlink);
|
||||
void filesystem::create_symlink(const path& to, const path& new_symlink,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17712)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX [symlink](http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17716)
|
||||
|
||||
*Postconditions*: new_symlink resolves to a symbolic link file that
|
||||
contains an unspecified representation of to[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17721)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17725)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Some operating systems do not support symbolic links at all or support
|
||||
them only for regular files[.](#4.sentence-1)
|
||||
|
||||
Some file systems (such as the FAT file system) do not
|
||||
support symbolic links regardless of the operating system[.](#4.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
88
cppdraft/fs/op/current/path.md
Normal file
88
cppdraft/fs/op/current/path.md
Normal file
@@ -0,0 +1,88 @@
|
||||
[fs.op.current.path]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.current.path)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.current.path)
|
||||
|
||||
#### 31.12.13.12 Current path [fs.op.current.path]
|
||||
|
||||
[ð](#lib:current_path)
|
||||
|
||||
`path filesystem::current_path();
|
||||
path filesystem::current_path(error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17743)
|
||||
|
||||
*Returns*: The absolute path of the current working directory,
|
||||
whose pathname in the native format is
|
||||
obtained as if by POSIX [getcwd](http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html)[.](#1.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an
|
||||
error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17751)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17755)
|
||||
|
||||
*Remarks*: The current working directory is the directory, associated
|
||||
with the process, that is used as the starting location in pathname resolution
|
||||
for relative paths[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17761)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The current path as returned by many operating systems is a dangerous
|
||||
global variable and can be changed unexpectedly by third-party or system
|
||||
library functions, or by another thread[.](#4.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:current_path_)
|
||||
|
||||
`void filesystem::current_path(const path& p);
|
||||
void filesystem::current_path(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17776)
|
||||
|
||||
*Effects*: Establishes the postcondition, as if by POSIX [chdir](http://pubs.opengroup.org/onlinepubs/9699919799/functions/chdir.html)[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17780)
|
||||
|
||||
*Postconditions*: equivalent(p, current_path())[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17784)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17788)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
The current path for many operating systems is a dangerous
|
||||
global state and can be changed unexpectedly by third-party or system
|
||||
library functions, or by another thread[.](#8.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
52
cppdraft/fs/op/equivalent.md
Normal file
52
cppdraft/fs/op/equivalent.md
Normal file
@@ -0,0 +1,52 @@
|
||||
[fs.op.equivalent]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.equivalent)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.equivalent)
|
||||
|
||||
#### 31.12.13.13 Equivalent [fs.op.equivalent]
|
||||
|
||||
[ð](#lib:equivalent)
|
||||
|
||||
`bool filesystem::equivalent(const path& p1, const path& p2);
|
||||
bool filesystem::equivalent(const path& p1, const path& p2, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17805)
|
||||
|
||||
Two paths are considered to resolve to the same file system entity if two
|
||||
candidate entities reside on the same device at the same location[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
On POSIX platforms, this is
|
||||
determined as if by the values of the POSIX stat class,
|
||||
obtained as if by stat for the two paths, having equal st_dev values
|
||||
and equal st_ino values[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17815)
|
||||
|
||||
*Returns*: true, if p1 and p2 resolve to the same file
|
||||
system entity, otherwise false[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17821)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17825)
|
||||
|
||||
*Remarks*: !exists(p1) || !exists(p2) is an error[.](#4.sentence-1)
|
||||
51
cppdraft/fs/op/exists.md
Normal file
51
cppdraft/fs/op/exists.md
Normal file
@@ -0,0 +1,51 @@
|
||||
[fs.op.exists]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.exists)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.exists)
|
||||
|
||||
#### 31.12.13.14 Exists [fs.op.exists]
|
||||
|
||||
[ð](#lib:exists)
|
||||
|
||||
`bool filesystem::exists(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17839)
|
||||
|
||||
*Returns*: status_known(s) && s.type() != file_type::not_found[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:exists_)
|
||||
|
||||
`bool filesystem::exists(const path& p);
|
||||
bool filesystem::exists(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17851)
|
||||
|
||||
Let s be a file_status,
|
||||
determined as if by status(p) or status(p, ec), respectively[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17855)
|
||||
|
||||
*Effects*: The signature with argument ec calls ec.clear() if status_known(s)[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17860)
|
||||
|
||||
*Returns*: exists(s)[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17864)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#5.sentence-1)
|
||||
43
cppdraft/fs/op/file/size.md
Normal file
43
cppdraft/fs/op/file/size.md
Normal file
@@ -0,0 +1,43 @@
|
||||
[fs.op.file.size]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.file.size)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.file.size)
|
||||
|
||||
#### 31.12.13.15 File size [fs.op.file.size]
|
||||
|
||||
[ð](#lib:file_size)
|
||||
|
||||
`uintmax_t filesystem::file_size(const path& p);
|
||||
uintmax_t filesystem::file_size(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17879)
|
||||
|
||||
*Effects*: If exists(p) is false, an error is reported ([[fs.err.report]](fs.err.report "31.12.5 Error reporting"))[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17883)
|
||||
|
||||
*Returns*:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
If is_regular_file(p), the size in bytes of the file p resolves to, determined as if by the value of the POSIX stat class member st_size obtained as if by POSIX [stat](http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html)[.](#2.1.sentence-1)
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
Otherwise, the result is implementation-defined[.](#2.2.sentence-1)
|
||||
|
||||
The signature with argument ec returns static_cast<uintmax_t>(-1) if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17896)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
2041
cppdraft/fs/op/funcs.md
Normal file
2041
cppdraft/fs/op/funcs.md
Normal file
File diff suppressed because it is too large
Load Diff
29
cppdraft/fs/op/funcs/general.md
Normal file
29
cppdraft/fs/op/funcs/general.md
Normal file
@@ -0,0 +1,29 @@
|
||||
[fs.op.funcs.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.funcs.general)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#general)
|
||||
|
||||
#### 31.12.13.1 General [fs.op.funcs.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17152)
|
||||
|
||||
Filesystem operation functions query or modify files, including directories,
|
||||
in external storage[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17156)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Because hardware failures, network failures, file system races ([[fs.race.behavior]](fs.race.behavior "31.12.2.4 File system race behavior")),
|
||||
and many other kinds of errors occur frequently in file system operations,
|
||||
any filesystem operation function, no matter how apparently innocuous,
|
||||
can encounter an error; see [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
30
cppdraft/fs/op/hard/lk/ct.md
Normal file
30
cppdraft/fs/op/hard/lk/ct.md
Normal file
@@ -0,0 +1,30 @@
|
||||
[fs.op.hard.lk.ct]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.hard.lk.ct)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.hard.lk.ct)
|
||||
|
||||
#### 31.12.13.16 Hard link count [fs.op.hard.lk.ct]
|
||||
|
||||
[ð](#lib:hard_link_count)
|
||||
|
||||
`uintmax_t filesystem::hard_link_count(const path& p);
|
||||
uintmax_t filesystem::hard_link_count(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17911)
|
||||
|
||||
*Returns*: The number of hard links for p[.](#1.sentence-1)
|
||||
|
||||
The signature
|
||||
with argument ec returns static_cast<uintmax_t>(-1) if an error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17917)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
40
cppdraft/fs/op/is/block/file.md
Normal file
40
cppdraft/fs/op/is/block/file.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[fs.op.is.block.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.block.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.block.file)
|
||||
|
||||
#### 31.12.13.17 Is block file [fs.op.is.block.file]
|
||||
|
||||
[ð](#lib:is_block_file)
|
||||
|
||||
`bool filesystem::is_block_file(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17931)
|
||||
|
||||
*Returns*: s.type() == file_type::block[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_block_file_)
|
||||
|
||||
`bool filesystem::is_block_file(const path& p);
|
||||
bool filesystem::is_block_file(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17943)
|
||||
|
||||
*Returns*: is_block_file(status(p)) or is_block_file(status(p, ec)), respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17948)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
44
cppdraft/fs/op/is/char/file.md
Normal file
44
cppdraft/fs/op/is/char/file.md
Normal file
@@ -0,0 +1,44 @@
|
||||
[fs.op.is.char.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.char.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.char.file)
|
||||
|
||||
#### 31.12.13.18 Is character file [fs.op.is.char.file]
|
||||
|
||||
[ð](#lib:is_character_file)
|
||||
|
||||
`bool filesystem::is_character_file(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17962)
|
||||
|
||||
*Returns*: s.type() == file_type::character[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_character_file_)
|
||||
|
||||
`bool filesystem::is_character_file(const path& p);
|
||||
bool filesystem::is_character_file(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17974)
|
||||
|
||||
*Returns*: is_character_file(status(p)) or is_character_file(status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
|
||||
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17981)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
41
cppdraft/fs/op/is/directory.md
Normal file
41
cppdraft/fs/op/is/directory.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.op.is.directory]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.directory)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.directory)
|
||||
|
||||
#### 31.12.13.19 Is directory [fs.op.is.directory]
|
||||
|
||||
[ð](#lib:is_directory)
|
||||
|
||||
`bool filesystem::is_directory(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17995)
|
||||
|
||||
*Returns*: s.type() == file_type::directory[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_directory_)
|
||||
|
||||
`bool filesystem::is_directory(const path& p);
|
||||
bool filesystem::is_directory(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18007)
|
||||
|
||||
*Returns*: is_directory(status(p)) or is_directory(status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18013)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
71
cppdraft/fs/op/is/empty.md
Normal file
71
cppdraft/fs/op/is/empty.md
Normal file
@@ -0,0 +1,71 @@
|
||||
[fs.op.is.empty]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.empty)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.empty)
|
||||
|
||||
#### 31.12.13.20 Is empty [fs.op.is.empty]
|
||||
|
||||
[ð](#lib:is_empty,function)
|
||||
|
||||
`bool filesystem::is_empty(const path& p);
|
||||
bool filesystem::is_empty(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18028)
|
||||
|
||||
*Effects*:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
Determine file_status s,
|
||||
as if by status(p) or status(p, ec), respectively[.](#1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
For the signature with argument ec,
|
||||
return false if an error occurred[.](#1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
Otherwise, if is_directory(s):
|
||||
* [(1.3.1)](#1.3.1)
|
||||
|
||||
Create a variable itr,
|
||||
as if by directory_iterator itr(p) or directory_iterator itr(p, ec), respectively[.](#1.3.1.sentence-1)
|
||||
|
||||
* [(1.3.2)](#1.3.2)
|
||||
|
||||
For the signature with argument ec,
|
||||
return false if an error occurred[.](#1.3.2.sentence-1)
|
||||
|
||||
* [(1.3.3)](#1.3.3)
|
||||
|
||||
Otherwise, return itr == directory_iterator()[.](#1.3.3.sentence-1)
|
||||
|
||||
- [(1.4)](#1.4)
|
||||
|
||||
Otherwise:
|
||||
* [(1.4.1)](#1.4.1)
|
||||
|
||||
Determine uintmax_t sz,
|
||||
as if by file_size(p) or file_size(p, ec), respectively[.](#1.4.1.sentence-1)
|
||||
|
||||
* [(1.4.2)](#1.4.2)
|
||||
|
||||
For the signature with argument ec,
|
||||
return false if an error occurred[.](#1.4.2.sentence-1)
|
||||
|
||||
* [(1.4.3)](#1.4.3)
|
||||
|
||||
Otherwise, return sz == 0[.](#1.4.3.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18055)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
40
cppdraft/fs/op/is/fifo.md
Normal file
40
cppdraft/fs/op/is/fifo.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[fs.op.is.fifo]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.fifo)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.fifo)
|
||||
|
||||
#### 31.12.13.21 Is fifo [fs.op.is.fifo]
|
||||
|
||||
[ð](#lib:is_fifo)
|
||||
|
||||
`bool filesystem::is_fifo(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18069)
|
||||
|
||||
*Returns*: s.type() == file_type::fifo[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_fifo_)
|
||||
|
||||
`bool filesystem::is_fifo(const path& p);
|
||||
bool filesystem::is_fifo(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18082)
|
||||
|
||||
*Returns*: is_fifo(status(p)) or is_fifo(status(p, ec)), respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18087)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
41
cppdraft/fs/op/is/other.md
Normal file
41
cppdraft/fs/op/is/other.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.op.is.other]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.other)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.other)
|
||||
|
||||
#### 31.12.13.22 Is other [fs.op.is.other]
|
||||
|
||||
[ð](#lib:is_other)
|
||||
|
||||
`bool filesystem::is_other(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18101)
|
||||
|
||||
*Returns*: exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_other_)
|
||||
|
||||
`bool filesystem::is_other(const path& p);
|
||||
bool filesystem::is_other(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18113)
|
||||
|
||||
*Returns*: is_other(status(p)) or is_other(status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18119)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
64
cppdraft/fs/op/is/regular/file.md
Normal file
64
cppdraft/fs/op/is/regular/file.md
Normal file
@@ -0,0 +1,64 @@
|
||||
[fs.op.is.regular.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.regular.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.regular.file)
|
||||
|
||||
#### 31.12.13.23 Is regular file [fs.op.is.regular.file]
|
||||
|
||||
[ð](#lib:is_regular_file)
|
||||
|
||||
`bool filesystem::is_regular_file(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18133)
|
||||
|
||||
*Returns*: s.type() == file_type::regular[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_regular_file_)
|
||||
|
||||
`bool filesystem::is_regular_file(const path& p);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18144)
|
||||
|
||||
*Returns*: is_regular_file(status(p))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18148)
|
||||
|
||||
*Throws*: filesystem_error if status(p) would throw filesystem_error[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:is_regular_file__)
|
||||
|
||||
`bool filesystem::is_regular_file(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18159)
|
||||
|
||||
*Effects*: Sets ec as if by status(p, ec)[.](#4.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
file_type::none, file_type::not_found and file_type::unknown cases set ec to error values[.](#4.sentence-2)
|
||||
|
||||
To distinguish between cases, call the status function directly[.](#4.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18167)
|
||||
|
||||
*Returns*: is_regular_file(status(p, ec))[.](#5.sentence-1)
|
||||
|
||||
Returns false if an error occurs[.](#5.sentence-2)
|
||||
40
cppdraft/fs/op/is/socket.md
Normal file
40
cppdraft/fs/op/is/socket.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[fs.op.is.socket]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.socket)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.socket)
|
||||
|
||||
#### 31.12.13.24 Is socket [fs.op.is.socket]
|
||||
|
||||
[ð](#lib:is_socket)
|
||||
|
||||
`bool filesystem::is_socket(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18182)
|
||||
|
||||
*Returns*: s.type() == file_type::socket[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_socket_)
|
||||
|
||||
`bool filesystem::is_socket(const path& p);
|
||||
bool filesystem::is_socket(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18194)
|
||||
|
||||
*Returns*: is_socket(status(p)) or is_socket(status(p, ec)), respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18200)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
41
cppdraft/fs/op/is/symlink.md
Normal file
41
cppdraft/fs/op/is/symlink.md
Normal file
@@ -0,0 +1,41 @@
|
||||
[fs.op.is.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.is.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.is.symlink)
|
||||
|
||||
#### 31.12.13.25 Is symlink [fs.op.is.symlink]
|
||||
|
||||
[ð](#lib:is_symlink)
|
||||
|
||||
`bool filesystem::is_symlink(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18214)
|
||||
|
||||
*Returns*: s.type() == file_type::symlink[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:is_symlink_)
|
||||
|
||||
`bool filesystem::is_symlink(const path& p);
|
||||
bool filesystem::is_symlink(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18226)
|
||||
|
||||
*Returns*: is_symlink(symlink_status(p)) or is_symlink(symlink_status(p, ec)),
|
||||
respectively[.](#2.sentence-1)
|
||||
|
||||
The signature with argument ec returns false if an error occurs[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18232)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#3.sentence-1)
|
||||
61
cppdraft/fs/op/last/write/time.md
Normal file
61
cppdraft/fs/op/last/write/time.md
Normal file
@@ -0,0 +1,61 @@
|
||||
[fs.op.last.write.time]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.last.write.time)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.last.write.time)
|
||||
|
||||
#### 31.12.13.26 Last write time [fs.op.last.write.time]
|
||||
|
||||
[ð](#lib:last_write_time)
|
||||
|
||||
`file_time_type filesystem::last_write_time(const path& p);
|
||||
file_time_type filesystem::last_write_time(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18247)
|
||||
|
||||
*Returns*: The time of last data modification of p,
|
||||
determined as if by the value of the POSIX stat class member st_mtime obtained as if by POSIX stat[.](#1.sentence-1)
|
||||
|
||||
The signature with argument ec returns file_time_type::min() if an error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18255)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:last_write_time_)
|
||||
|
||||
`void filesystem::last_write_time(const path& p, file_time_type new_time);
|
||||
void filesystem::last_write_time(const path& p, file_time_type new_time,
|
||||
error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18268)
|
||||
|
||||
*Effects*: Sets the time of last data modification of the file
|
||||
resolved to by p to new_time, as if by POSIX [futimens](http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html)[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18273)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18277)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A postcondition of last_write_time(p) == new_time is not specified
|
||||
because it does not necessarily hold for file systems with coarse time granularity[.](#5.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
55
cppdraft/fs/op/permissions.md
Normal file
55
cppdraft/fs/op/permissions.md
Normal file
@@ -0,0 +1,55 @@
|
||||
[fs.op.permissions]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.permissions)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.permissions)
|
||||
|
||||
#### 31.12.13.27 Permissions [fs.op.permissions]
|
||||
|
||||
[ð](#lib:permissions)
|
||||
|
||||
`void filesystem::permissions(const path& p, perms prms, perm_options opts=perm_options::replace);
|
||||
void filesystem::permissions(const path& p, perms prms, error_code& ec) noexcept;
|
||||
void filesystem::permissions(const path& p, perms prms, perm_options opts, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18294)
|
||||
|
||||
*Preconditions*: Exactly one of the perm_options constantsreplace, add, or remove is present in opts[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18299)
|
||||
|
||||
*Effects*: Applies the action specified by opts to the file p resolves to,
|
||||
or to file p itself if p is a symbolic link
|
||||
and perm_options::nofollow is set in opts[.](#2.sentence-1)
|
||||
|
||||
The action is applied as if by POSIX fchmodat[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18307)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Conceptually permissions are viewed as bits, but the actual
|
||||
implementation can use some other mechanism[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18313)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18317)
|
||||
|
||||
*Remarks*: The second signature behaves as if it had an additional parameterperm_options opts with an argument of perm_options::replace[.](#5.sentence-1)
|
||||
46
cppdraft/fs/op/proximate.md
Normal file
46
cppdraft/fs/op/proximate.md
Normal file
@@ -0,0 +1,46 @@
|
||||
[fs.op.proximate]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.proximate)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.proximate)
|
||||
|
||||
#### 31.12.13.28 Proximate [fs.op.proximate]
|
||||
|
||||
[ð](#lib:proximate)
|
||||
|
||||
`path filesystem::proximate(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18331)
|
||||
|
||||
*Returns*: proximate(p, current_path(), ec)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18335)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:proximate_)
|
||||
|
||||
`path filesystem::proximate(const path& p, const path& base = current_path());
|
||||
path filesystem::proximate(const path& p, const path& base, error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18347)
|
||||
|
||||
*Returns*: For the first form:weakly_canonical(p).lexically_proximate(weakly_canonical(base));
|
||||
|
||||
For the second form:weakly_canonical(p, ec).lexically_proximate(weakly_canonical(base, ec)); or path() at the first error occurrence, if any[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18359)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
38
cppdraft/fs/op/read/symlink.md
Normal file
38
cppdraft/fs/op/read/symlink.md
Normal file
@@ -0,0 +1,38 @@
|
||||
[fs.op.read.symlink]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.read.symlink)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.read.symlink)
|
||||
|
||||
#### 31.12.13.29 Read symlink [fs.op.read.symlink]
|
||||
|
||||
[ð](#lib:read_symlink)
|
||||
|
||||
`path filesystem::read_symlink(const path& p);
|
||||
path filesystem::read_symlink(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18373)
|
||||
|
||||
*Returns*: If p resolves to a symbolic
|
||||
link, a path object containing the contents of that symbolic
|
||||
link[.](#1.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an error occurs[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18380)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
It is an error if p does not
|
||||
resolve to a symbolic link[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
46
cppdraft/fs/op/relative.md
Normal file
46
cppdraft/fs/op/relative.md
Normal file
@@ -0,0 +1,46 @@
|
||||
[fs.op.relative]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.relative)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.relative)
|
||||
|
||||
#### 31.12.13.30 Relative [fs.op.relative]
|
||||
|
||||
[ð](#lib:relative)
|
||||
|
||||
`path filesystem::relative(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18397)
|
||||
|
||||
*Returns*: relative(p, current_path(), ec)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18401)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:relative_)
|
||||
|
||||
`path filesystem::relative(const path& p, const path& base = current_path());
|
||||
path filesystem::relative(const path& p, const path& base, error_code& ec);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18413)
|
||||
|
||||
*Returns*: For the first form:weakly_canonical(p).lexically_relative(weakly_canonical(base));
|
||||
|
||||
For the second form:weakly_canonical(p, ec).lexically_relative(weakly_canonical(base, ec)); or path() at the first error occurrence, if any[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18425)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
53
cppdraft/fs/op/remove.md
Normal file
53
cppdraft/fs/op/remove.md
Normal file
@@ -0,0 +1,53 @@
|
||||
[fs.op.remove]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.remove)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.remove)
|
||||
|
||||
#### 31.12.13.31 Remove [fs.op.remove]
|
||||
|
||||
[ð](#lib:remove,path)
|
||||
|
||||
`bool filesystem::remove(const path& p);
|
||||
bool filesystem::remove(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18439)
|
||||
|
||||
*Effects*: If exists(symlink_status(p, ec)), the file p is
|
||||
removed as if by POSIX remove[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A symbolic link is itself removed, rather than the file it
|
||||
resolves to[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18448)
|
||||
|
||||
*Postconditions*: exists(symlink_status(p)) is false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18452)
|
||||
|
||||
*Returns*: true if a file p has been removed and false otherwise[.](#3.sentence-1)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Absence of a file p is not an error[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18459)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
50
cppdraft/fs/op/remove/all.md
Normal file
50
cppdraft/fs/op/remove/all.md
Normal file
@@ -0,0 +1,50 @@
|
||||
[fs.op.remove.all]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.remove.all)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.remove.all)
|
||||
|
||||
#### 31.12.13.32 Remove all [fs.op.remove.all]
|
||||
|
||||
[ð](#lib:remove_all)
|
||||
|
||||
`uintmax_t filesystem::remove_all(const path& p);
|
||||
uintmax_t filesystem::remove_all(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18474)
|
||||
|
||||
*Effects*: Recursively deletes the contents of p if it exists,
|
||||
then deletes file p itself, as if by POSIX remove[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A symbolic link is itself removed, rather than the file it
|
||||
resolves to[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18483)
|
||||
|
||||
*Postconditions*: exists(symlink_status(p)) is false[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18487)
|
||||
|
||||
*Returns*: The number of files removed[.](#3.sentence-1)
|
||||
|
||||
The signature with argument ec returns static_cast< uintmax_t>(-1) if an error
|
||||
occurs[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18493)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
51
cppdraft/fs/op/rename.md
Normal file
51
cppdraft/fs/op/rename.md
Normal file
@@ -0,0 +1,51 @@
|
||||
[fs.op.rename]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.rename)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.rename)
|
||||
|
||||
#### 31.12.13.33 Rename [fs.op.rename]
|
||||
|
||||
[ð](#lib:rename)
|
||||
|
||||
`void filesystem::rename(const path& old_p, const path& new_p);
|
||||
void filesystem::rename(const path& old_p, const path& new_p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18508)
|
||||
|
||||
*Effects*: Renames old_p to new_p, as if by
|
||||
POSIX rename[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
If old_p and new_p resolve to the same existing file,
|
||||
no action is taken[.](#1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
Otherwise, the rename can include the following effects:
|
||||
* [(1.2.1)](#1.2.1)
|
||||
|
||||
if new_p resolves to an existing non-directory file, new_p is removed; otherwise,
|
||||
|
||||
* [(1.2.2)](#1.2.2)
|
||||
|
||||
if new_p resolves to an existing directory, new_p is removed if empty on POSIX compliant operating systems
|
||||
but might be an error on other operating systems[.](#1.2.sentence-1)
|
||||
|
||||
A symbolic link is itself renamed, rather than the file it resolves to[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18529)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
28
cppdraft/fs/op/resize/file.md
Normal file
28
cppdraft/fs/op/resize/file.md
Normal file
@@ -0,0 +1,28 @@
|
||||
[fs.op.resize.file]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.resize.file)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.resize.file)
|
||||
|
||||
#### 31.12.13.34 Resize file [fs.op.resize.file]
|
||||
|
||||
[ð](#lib:resize_file)
|
||||
|
||||
`void filesystem::resize_file(const path& p, uintmax_t new_size);
|
||||
void filesystem::resize_file(const path& p, uintmax_t new_size, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18544)
|
||||
|
||||
*Effects*: Causes the size that would be returned by file_size(p) to be
|
||||
equal to new_size, as if by POSIX truncate[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18549)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
51
cppdraft/fs/op/space.md
Normal file
51
cppdraft/fs/op/space.md
Normal file
@@ -0,0 +1,51 @@
|
||||
[fs.op.space]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.space)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.space)
|
||||
|
||||
#### 31.12.13.35 Space [fs.op.space]
|
||||
|
||||
[ð](#lib:space)
|
||||
|
||||
`space_info filesystem::space(const path& p);
|
||||
space_info filesystem::space(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18564)
|
||||
|
||||
*Returns*: An object of type space_info[.](#1.sentence-1)
|
||||
|
||||
The value of the space_info object is determined as if by using POSIX statvfs to obtain a POSIX struct statvfs,
|
||||
and then multiplying its f_blocks, f_bfree,
|
||||
and f_bavail members by its f_frsize member,
|
||||
and assigning the results to the capacity, free,
|
||||
and available members respectively[.](#1.sentence-2)
|
||||
|
||||
Any members for which the
|
||||
value cannot be determined shall be set to static_cast<uintmax_t>(-1)[.](#1.sentence-3)
|
||||
|
||||
For the signature with argument ec, all members are set to static_cast<uintmax_t>(-1) if an error occurs[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18577)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18581)
|
||||
|
||||
*Remarks*: The value of member space_info::available is operating system dependent[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
available might be
|
||||
less than free[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
160
cppdraft/fs/op/status.md
Normal file
160
cppdraft/fs/op/status.md
Normal file
@@ -0,0 +1,160 @@
|
||||
[fs.op.status]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.status)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.status)
|
||||
|
||||
#### 31.12.13.36 Status [fs.op.status]
|
||||
|
||||
[ð](#lib:status)
|
||||
|
||||
`file_status filesystem::status(const path& p);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18600)
|
||||
|
||||
*Effects*: As if by:error_code ec;
|
||||
file_status result = status(p, ec);if (result.type() == file_type::none)throw filesystem_error(*implementation-supplied-message*, p, ec);return result;
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18611)
|
||||
|
||||
*Returns*: See above[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18615)
|
||||
|
||||
*Throws*: filesystem_error[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
result values of file_status(file_type::not_found) and file_status(file_type::unknown) are not considered failures and do not
|
||||
cause an exception to be thrown[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:status_)
|
||||
|
||||
`file_status filesystem::status(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18631)
|
||||
|
||||
*Effects*: If possible, determines the attributes
|
||||
of the file p resolves to, as if by using POSIX stat to obtain a POSIX struct stat[.](#4.sentence-1)
|
||||
|
||||
If, during attribute determination, the underlying file system API reports
|
||||
an error, sets ec to indicate the specific error reported[.](#4.sentence-2)
|
||||
|
||||
Otherwise, ec.clear()[.](#4.sentence-3)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
This allows users to inspect the specifics of underlying
|
||||
API errors even when the value returned by status is not file_status(file_type::none)[.](#4.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18645)
|
||||
|
||||
Let prms denote the result of (m & perms::mask),
|
||||
where m is determined as if by converting the st_mode member
|
||||
of the obtained struct stat to the type perms[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18650)
|
||||
|
||||
*Returns*:
|
||||
|
||||
- [(6.1)](#6.1)
|
||||
|
||||
If ec != error_code():
|
||||
* [(6.1.1)](#6.1.1)
|
||||
|
||||
If the specific error indicates that p cannot be resolved
|
||||
because some element of the path does not exist, returns file_status(file_type::not_found)[.](#6.1.1.sentence-1)
|
||||
|
||||
* [(6.1.2)](#6.1.2)
|
||||
|
||||
Otherwise, if the specific error indicates that p can be resolved
|
||||
but the attributes cannot be determined, returns file_status(file_type::unknown)[.](#6.1.2.sentence-1)
|
||||
|
||||
* [(6.1.3)](#6.1.3)
|
||||
|
||||
Otherwise, returns file_status(file_type::none)[.](#6.1.3.sentence-1)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
These semantics distinguish between p being known not to exist, p existing but not being able to determine its attributes,
|
||||
and there being an error that prevents even knowing if p exists[.](#6.1.sentence-2)
|
||||
These
|
||||
distinctions are important to some use cases[.](#6.1.sentence-3)
|
||||
â *end note*]
|
||||
|
||||
- [(6.2)](#6.2)
|
||||
|
||||
Otherwise,
|
||||
* [(6.2.1)](#6.2.1)
|
||||
|
||||
If the attributes indicate a regular file, as if by POSIX S_ISREG,
|
||||
returns file_status(file_type::regular, prms)[.](#6.2.1.sentence-1)
|
||||
[*Note [4](#note-4)*:
|
||||
file_type::regular implies appropriate [<fstream>](fstream.syn#header:%3cfstream%3e "31.10.1 Header <fstream> synopsis [fstream.syn]") operations
|
||||
would succeed, assuming no hardware, permission, access, or file system
|
||||
race errors[.](#6.2.1.sentence-2)
|
||||
Lack of file_type::regular does not necessarily imply [<fstream>](fstream.syn#header:%3cfstream%3e "31.10.1 Header <fstream> synopsis [fstream.syn]") operations would fail on a directory[.](#6.2.1.sentence-3)
|
||||
â *end note*]
|
||||
|
||||
* [(6.2.2)](#6.2.2)
|
||||
|
||||
Otherwise, if the attributes indicate a directory, as if by POSIX S_ISDIR, returns file_status(file_type::directory, prms)[.](#6.2.2.sentence-1)
|
||||
[*Note [5](#note-5)*:
|
||||
file_type::directory implies that calling directory_iterator(p) would succeed[.](#6.2.2.sentence-2)
|
||||
â *end note*]
|
||||
|
||||
* [(6.2.3)](#6.2.3)
|
||||
|
||||
Otherwise, if the attributes indicate a block special file, as if by
|
||||
POSIX S_ISBLK, returns file_status(file_type::block, prms)[.](#6.2.3.sentence-1)
|
||||
|
||||
* [(6.2.4)](#6.2.4)
|
||||
|
||||
Otherwise, if the attributes indicate a character special file, as if
|
||||
by POSIX S_ISCHR, returns file_status(file_type::character, prms)[.](#6.2.4.sentence-1)
|
||||
|
||||
* [(6.2.5)](#6.2.5)
|
||||
|
||||
Otherwise, if the attributes indicate a fifo or pipe file, as if by
|
||||
POSIX S_ISFIFO, returns file_status(file_type::fifo, prms)[.](#6.2.5.sentence-1)
|
||||
|
||||
* [(6.2.6)](#6.2.6)
|
||||
|
||||
Otherwise, if the attributes indicate a socket, as if by POSIX S_ISSOCK, returns file_status(file_type::socket, prms)[.](#6.2.6.sentence-1)
|
||||
|
||||
* [(6.2.7)](#6.2.7)
|
||||
|
||||
Otherwise, if the attributes indicate an implementation-defined
|
||||
file type ([[fs.enum.file.type]](fs.enum.file.type "31.12.8.2 Enum class file_type")),
|
||||
returns file_status(file_type::*A*, prms),
|
||||
where *A* is the constant for the implementation-defined file type[.](#6.2.7.sentence-1)
|
||||
|
||||
* [(6.2.8)](#6.2.8)
|
||||
|
||||
Otherwise, returns file_status(file_type::unknown, prms)[.](#6.2.8.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18703)
|
||||
|
||||
*Remarks*: If a symbolic link is encountered during pathname resolution,
|
||||
pathname resolution continues using the contents of the symbolic link[.](#7.sentence-1)
|
||||
20
cppdraft/fs/op/status/known.md
Normal file
20
cppdraft/fs/op/status/known.md
Normal file
@@ -0,0 +1,20 @@
|
||||
[fs.op.status.known]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.status.known)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.status.known)
|
||||
|
||||
#### 31.12.13.37 Status known [fs.op.status.known]
|
||||
|
||||
[ð](#lib:status_known)
|
||||
|
||||
`bool filesystem::status_known(file_status s) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18718)
|
||||
|
||||
*Returns*: s.type() != file_type::none[.](#1.sentence-1)
|
||||
53
cppdraft/fs/op/symlink/status.md
Normal file
53
cppdraft/fs/op/symlink/status.md
Normal file
@@ -0,0 +1,53 @@
|
||||
[fs.op.symlink.status]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.symlink.status)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.symlink.status)
|
||||
|
||||
#### 31.12.13.38 Symlink status [fs.op.symlink.status]
|
||||
|
||||
[ð](#lib:symlink_status)
|
||||
|
||||
`file_status filesystem::symlink_status(const path& p);
|
||||
file_status filesystem::symlink_status(const path& p, error_code& ec) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18733)
|
||||
|
||||
*Effects*: Same as status, above,
|
||||
except that the attributes
|
||||
of p are determined as if by using POSIX lstat to obtain a POSIX struct stat[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18740)
|
||||
|
||||
Let prms denote the result of (m & perms::mask),
|
||||
where m is determined as if by converting the st_mode member
|
||||
of the obtained struct stat to the type perms[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18745)
|
||||
|
||||
*Returns*: Same as status, above, except
|
||||
that if the attributes indicate a symbolic link, as if by POSIX S_ISLNK,
|
||||
returns file_status(file_type::symlink, prms)[.](#3.sentence-1)
|
||||
|
||||
The signature with argument ec returns file_status(file_type::none) if an error occurs[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18753)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18757)
|
||||
|
||||
*Remarks*: Pathname resolution terminates if p names a symbolic link[.](#5.sentence-1)
|
||||
58
cppdraft/fs/op/temp/dir/path.md
Normal file
58
cppdraft/fs/op/temp/dir/path.md
Normal file
@@ -0,0 +1,58 @@
|
||||
[fs.op.temp.dir.path]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.temp.dir.path)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.temp.dir.path)
|
||||
|
||||
#### 31.12.13.39 Temporary directory path [fs.op.temp.dir.path]
|
||||
|
||||
[ð](#lib:temp_directory_path)
|
||||
|
||||
`path filesystem::temp_directory_path();
|
||||
path filesystem::temp_directory_path(error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18772)
|
||||
|
||||
Let p be an unspecified directory path suitable for temporary files[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18775)
|
||||
|
||||
*Effects*: If exists(p) is false or is_directory(p) is false, an error is reported ([[fs.err.report]](fs.err.report "31.12.5 Error reporting"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18780)
|
||||
|
||||
*Returns*: The path p[.](#3.sentence-1)
|
||||
|
||||
The signature with argument ec returns path() if an
|
||||
error occurs[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18786)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18790)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
For POSIX-based operating systems, an implementation might
|
||||
return the path
|
||||
supplied by the first environment variable found in the list TMPDIR, TMP, TEMP, TEMPDIR,
|
||||
or if none of these are found, "/tmp"[.](#5.sentence-1)
|
||||
|
||||
For Windows-based operating systems, an implementation might return the path
|
||||
reported by the Windows GetTempPath API function[.](#5.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
49
cppdraft/fs/op/weakly/canonical.md
Normal file
49
cppdraft/fs/op/weakly/canonical.md
Normal file
@@ -0,0 +1,49 @@
|
||||
[fs.op.weakly.canonical]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.op.weakly.canonical)
|
||||
|
||||
### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.weakly.canonical)
|
||||
|
||||
#### 31.12.13.40 Weakly canonical [fs.op.weakly.canonical]
|
||||
|
||||
[ð](#lib:weakly_canonical)
|
||||
|
||||
`path filesystem::weakly_canonical(const path& p);
|
||||
path filesystem::weakly_canonical(const path& p, error_code& ec);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18811)
|
||||
|
||||
*Effects*: Using status(p) or status(p, ec), respectively,
|
||||
to determine existence,
|
||||
return a path composed by operator/= from the result of calling canonical with a path argument composed of
|
||||
the leading elements of p that exist, if any, followed by
|
||||
the elements of p that do not exist, if any[.](#1.sentence-1)
|
||||
|
||||
For the first form, canonical is called without an error_code argument[.](#1.sentence-2)
|
||||
|
||||
For the second form, canonical is called
|
||||
with ec as an error_code argument, and path() is returned at the first error occurrence, if any[.](#1.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18827)
|
||||
|
||||
*Postconditions*: The returned path is in normal form ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18831)
|
||||
|
||||
*Returns*: p with symlinks resolved and
|
||||
the result normalized ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18836)
|
||||
|
||||
*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
|
||||
96
cppdraft/fs/path/append.md
Normal file
96
cppdraft/fs/path/append.md
Normal file
@@ -0,0 +1,96 @@
|
||||
[fs.path.append]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.append)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.append)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.append)
|
||||
|
||||
#### 31.12.6.5.3 Appends [fs.path.append]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14340)
|
||||
|
||||
The append operations use operator/= to denote their semantic effect of appending[*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]") when needed[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:operator/=,path)
|
||||
|
||||
`path& operator/=(const path& p);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14350)
|
||||
|
||||
*Effects*: If p.is_absolute() || (p.has_root_name() && p.root_name() != root_name()),
|
||||
then operator=(p)[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14355)
|
||||
|
||||
Otherwise, modifies *this as if by these steps:
|
||||
|
||||
- [(3.1)](#3.1)
|
||||
|
||||
If p.has_root_directory(),
|
||||
then removes any root directory and relative path
|
||||
from the generic format pathname[.](#3.1.sentence-1)
|
||||
Otherwise,
|
||||
if !has_root_directory() && is_absolute() is true or if has_filename() is true,
|
||||
then appends path::preferred_separator to the generic format pathname[.](#3.1.sentence-2)
|
||||
|
||||
- [(3.2)](#3.2)
|
||||
|
||||
Then appends the native format pathname of p,
|
||||
omitting any [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") from its generic format pathname,
|
||||
to the native format pathname[.](#3.2.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14370)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
Even if //host is interpreted as a [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]"),
|
||||
both of the paths path("//host")/"foo" and path("//host/")/"foo" equal "//host/foo" (although the former might use backslash as the
|
||||
preferred separator)[.](#4.sentence-1)
|
||||
|
||||
Expression examples:// On POSIX, path("foo") /= path(""); // yields path("foo/") path("foo") /= path("/bar"); // yields path("/bar")// On Windows, path("foo") /= path(""); // yields path("foo\\") path("foo") /= path("/bar"); // yields path("/bar") path("foo") /= path("c:/bar"); // yields path("c:/bar") path("foo") /= path("c:"); // yields path("c:") path("c:") /= path(""); // yields path("c:") path("c:foo") /= path("/bar"); // yields path("c:/bar") path("c:foo") /= path("c:bar"); // yields path("c:foo\\bar")
|
||||
|
||||
â *end example*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14394)
|
||||
|
||||
*Returns*: *this[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator/=,path_)
|
||||
|
||||
`template<class Source>
|
||||
path& operator/=(const Source& source);
|
||||
template<class Source>
|
||||
path& append(const Source& source);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14409)
|
||||
|
||||
*Effects*: Equivalent to: return operator/=(path(source));
|
||||
|
||||
[ð](#lib:operator/=,path__)
|
||||
|
||||
`template<class InputIterator>
|
||||
path& append(InputIterator first, InputIterator last);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14422)
|
||||
|
||||
*Effects*: Equivalent to: return operator/=(path(first, last));
|
||||
107
cppdraft/fs/path/assign.md
Normal file
107
cppdraft/fs/path/assign.md
Normal file
@@ -0,0 +1,107 @@
|
||||
[fs.path.assign]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.assign)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.assign)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.assign)
|
||||
|
||||
#### 31.12.6.5.2 Assignments [fs.path.assign]
|
||||
|
||||
[ð](#lib:operator=,path)
|
||||
|
||||
`path& operator=(const path& p);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14260)
|
||||
|
||||
*Effects*: If *this and p are the same
|
||||
object, has no effect[.](#1.sentence-1)
|
||||
|
||||
Otherwise,
|
||||
sets both respective pathnames of *this to the respective pathnames of p[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14268)
|
||||
|
||||
*Returns*: *this[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,path_)
|
||||
|
||||
`path& operator=(path&& p) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14279)
|
||||
|
||||
*Effects*: If *this and p are the same
|
||||
object, has no effect[.](#3.sentence-1)
|
||||
|
||||
Otherwise,
|
||||
sets both respective pathnames of *this to the respective pathnames of p[.](#3.sentence-2)
|
||||
|
||||
p is left in a valid but unspecified state[.](#3.sentence-3)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
A valid implementation is swap(p)[.](#3.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14290)
|
||||
|
||||
*Returns*: *this[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,path__)
|
||||
|
||||
`path& operator=(string_type&& source);
|
||||
path& assign(string_type&& source);
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14303)
|
||||
|
||||
*Effects*: Sets the pathname in the detected-format of source to the original value of source[.](#5.sentence-1)
|
||||
|
||||
source is left in a valid but unspecified state[.](#5.sentence-2)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14309)
|
||||
|
||||
*Returns*: *this[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:operator=,path___)
|
||||
|
||||
`template<class Source>
|
||||
path& operator=(const Source& source);
|
||||
template<class Source>
|
||||
path& assign(const Source& source);
|
||||
template<class InputIterator>
|
||||
path& assign(InputIterator first, InputIterator last);
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14326)
|
||||
|
||||
*Effects*: Let s be the effective range of source ([[fs.path.req]](fs.path.req "31.12.6.4 Requirements"))
|
||||
or the range [first, last), with the encoding converted if required ([[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions"))[.](#7.sentence-1)
|
||||
|
||||
Finds the detected-format of s ([[fs.path.fmt.cvt]](fs.path.fmt.cvt "31.12.6.3.1 Argument format conversions"))
|
||||
and sets the pathname in that format to s[.](#7.sentence-2)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14333)
|
||||
|
||||
*Returns*: *this[.](#8.sentence-1)
|
||||
64
cppdraft/fs/path/compare.md
Normal file
64
cppdraft/fs/path/compare.md
Normal file
@@ -0,0 +1,64 @@
|
||||
[fs.path.compare]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.compare)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.compare)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.compare)
|
||||
|
||||
#### 31.12.6.5.8 Compare [fs.path.compare]
|
||||
|
||||
[ð](#lib:compare,path)
|
||||
|
||||
`int compare(const path& p) const noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14805)
|
||||
|
||||
*Returns*:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
Let rootNameComparison be the result of this->root_name().native().compare(p.root_name().native())[.](#1.1.sentence-1)
|
||||
If rootNameComparison is not 0, rootNameComparison[.](#1.1.sentence-2)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
Otherwise, if !this->has_root_directory() and p.has_root_directory(),
|
||||
a value less than 0[.](#1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
Otherwise, if this->has_root_directory() and !p.has_root_directory(),
|
||||
a value greater than 0[.](#1.3.sentence-1)
|
||||
|
||||
- [(1.4)](#1.4)
|
||||
|
||||
Otherwise, if native() for the elements of this->relative_path() are lexicographically less than native() for the elements of p.relative_path(),
|
||||
a value less than 0[.](#1.4.sentence-1)
|
||||
|
||||
- [(1.5)](#1.5)
|
||||
|
||||
Otherwise, if native() for the elements of this->relative_path() are lexicographically greater than native() for the elements of p.relative_path(),
|
||||
a value greater than 0[.](#1.5.sentence-1)
|
||||
|
||||
- [(1.6)](#1.6)
|
||||
|
||||
Otherwise, 0[.](#1.6.sentence-1)
|
||||
|
||||
[ð](#lib:compare,path_)
|
||||
|
||||
`int compare(const string_type& s) const;
|
||||
int compare(basic_string_view<value_type> s) const;
|
||||
int compare(const value_type* s) const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14846)
|
||||
|
||||
*Effects*: Equivalent to: return compare(path(s));
|
||||
67
cppdraft/fs/path/concat.md
Normal file
67
cppdraft/fs/path/concat.md
Normal file
@@ -0,0 +1,67 @@
|
||||
[fs.path.concat]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.concat)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.concat)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.concat)
|
||||
|
||||
#### 31.12.6.5.4 Concatenation [fs.path.concat]
|
||||
|
||||
[ð](#lib:operator+=,path)
|
||||
|
||||
`path& operator+=(const path& x);
|
||||
path& operator+=(const string_type& x);
|
||||
path& operator+=(basic_string_view<value_type> x);
|
||||
path& operator+=(const value_type* x);
|
||||
template<class Source>
|
||||
path& operator+=(const Source& x);
|
||||
template<class Source>
|
||||
path& concat(const Source& x);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14443)
|
||||
|
||||
*Effects*: Appends path(x).native() to the pathname in the native format[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
This directly manipulates the value of native(),
|
||||
which is not necessarily portable between operating systems[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14451)
|
||||
|
||||
*Returns*: *this[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator+=,path_)
|
||||
|
||||
`path& operator+=(value_type x);
|
||||
template<class EcharT>
|
||||
path& operator+=(EcharT x);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14465)
|
||||
|
||||
*Effects*: Equivalent to: return *this += basic_string_view(&x, 1);
|
||||
|
||||
[ð](#lib:concat,path__)
|
||||
|
||||
`template<class InputIterator>
|
||||
path& concat(InputIterator first, InputIterator last);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14477)
|
||||
|
||||
*Effects*: Equivalent to: return *this += path(first, last);
|
||||
139
cppdraft/fs/path/construct.md
Normal file
139
cppdraft/fs/path/construct.md
Normal file
@@ -0,0 +1,139 @@
|
||||
[fs.path.construct]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.construct)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.construct)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.construct)
|
||||
|
||||
#### 31.12.6.5.1 Constructors [fs.path.construct]
|
||||
|
||||
[ð](#lib:path,constructor)
|
||||
|
||||
`path() noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14134)
|
||||
|
||||
*Postconditions*: empty() is true[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:path,constructor_)
|
||||
|
||||
`path(const path& p);
|
||||
path(path&& p) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14146)
|
||||
|
||||
*Effects*: Constructs an object of class path having the same pathname in the native and generic formats, respectively,
|
||||
as the original value of p[.](#2.sentence-1)
|
||||
|
||||
In the second form, p is left in a valid but unspecified state[.](#2.sentence-2)
|
||||
|
||||
[ð](#lib:path,constructor__)
|
||||
|
||||
`path(string_type&& source, format fmt = auto_format);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14160)
|
||||
|
||||
*Effects*: Constructs an object of class path for which the pathname in the detected-format of source has the original value of source ([[fs.path.fmt.cvt]](fs.path.fmt.cvt "31.12.6.3.1 Argument format conversions")),
|
||||
converting format if required ([[fs.path.fmt.cvt]](fs.path.fmt.cvt "31.12.6.3.1 Argument format conversions"))[.](#3.sentence-1)
|
||||
|
||||
source is left in a valid but unspecified state[.](#3.sentence-2)
|
||||
|
||||
[ð](#lib:path,constructor___)
|
||||
|
||||
`template<class Source>
|
||||
path(const Source& source, format fmt = auto_format);
|
||||
template<class InputIterator>
|
||||
path(InputIterator first, InputIterator last, format fmt = auto_format);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14178)
|
||||
|
||||
*Effects*: Let s be the effective range of source ([[fs.path.req]](fs.path.req "31.12.6.4 Requirements"))
|
||||
or the range [first, last), with the encoding converted if required ([[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions"))[.](#4.sentence-1)
|
||||
|
||||
Finds the detected-format of s ([[fs.path.fmt.cvt]](fs.path.fmt.cvt "31.12.6.3.1 Argument format conversions"))
|
||||
and constructs an object of class path for which the pathname in that format is s[.](#4.sentence-2)
|
||||
|
||||
[ð](#lib:path,constructor____)
|
||||
|
||||
`template<class Source>
|
||||
path(const Source& source, const locale& loc, format fmt = auto_format);
|
||||
template<class InputIterator>
|
||||
path(InputIterator first, InputIterator last, const locale& loc, format fmt = auto_format);
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14196)
|
||||
|
||||
*Mandates*: The value type of Source and InputIterator ischar[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14201)
|
||||
|
||||
*Effects*: Let s be the effective range of source or the range [first, last),
|
||||
after converting the encoding as
|
||||
follows:
|
||||
|
||||
- [(6.1)](#6.1)
|
||||
|
||||
If value_type is wchar_t, converts to the native
|
||||
wide encoding ([[fs.path.type.cvt]](fs.path.type.cvt "31.12.6.3.2 Type and encoding conversions")) using the codecvt<wchar_t, char, mbstate_t> facet of loc[.](#6.1.sentence-1)
|
||||
|
||||
- [(6.2)](#6.2)
|
||||
|
||||
Otherwise a conversion is performed using thecodecvt<wchar_t, char, mbstate_t> facet of loc, and then a second
|
||||
conversion to the current ordinary encoding[.](#6.2.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14218)
|
||||
|
||||
Finds the detected-format of s ([[fs.path.fmt.cvt]](fs.path.fmt.cvt "31.12.6.3.1 Argument format conversions"))
|
||||
and constructs an object of class path for which the pathname in that format is s[.](#7.sentence-1)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
A string is to be read from a database
|
||||
that is encoded in ISO/IEC 8859-1, and used to create a directory:namespace fs = std::filesystem;
|
||||
std::string latin1_string = read_latin1_data();
|
||||
codecvt_8859_1<wchar_t> latin1_facet;
|
||||
std::locale latin1_locale(std::locale(), latin1_facet);
|
||||
fs::create_directory(fs::path(latin1_string, latin1_locale));
|
||||
|
||||
For POSIX-based operating systems, the path is constructed by first usinglatin1_facet to convert ISO/IEC 8859-1 encodedlatin1_string to a wide character string in the native wide
|
||||
encoding ([[fs.path.type.cvt]](fs.path.type.cvt "31.12.6.3.2 Type and encoding conversions"))[.](#7.sentence-3)
|
||||
|
||||
The resulting wide string is then
|
||||
converted to an ordinary character
|
||||
pathname string in the current native ordinary encoding[.](#7.sentence-4)
|
||||
|
||||
If the
|
||||
native wide encoding is UTF-16 or UTF-32, and the current native ordinary
|
||||
encoding is UTF-8, all of the characters in the ISO/IEC 8859-1 character set
|
||||
will be converted to their Unicode representation, but for other native
|
||||
ordinary encodings some characters may have no representation[.](#7.sentence-5)
|
||||
|
||||
For Windows-based operating systems, the path is constructed by
|
||||
using latin1_facet to convert ISO/IEC 8859-1 encodedlatin1_string to a UTF-16 encoded wide character pathname
|
||||
string[.](#7.sentence-6)
|
||||
|
||||
All of the characters in the ISO/IEC 8859-1 character set will be
|
||||
converted to their Unicode representation[.](#7.sentence-7)
|
||||
|
||||
â *end example*]
|
||||
216
cppdraft/fs/path/cvt.md
Normal file
216
cppdraft/fs/path/cvt.md
Normal file
@@ -0,0 +1,216 @@
|
||||
[fs.path.cvt]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.cvt)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.cvt)
|
||||
|
||||
#### 31.12.6.3 Conversions [fs.path.cvt]
|
||||
|
||||
#### [31.12.6.3.1](#fs.path.fmt.cvt) Argument format conversions [[fs.path.fmt.cvt]](fs.path.fmt.cvt)
|
||||
|
||||
[1](#fs.path.fmt.cvt-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13935)
|
||||
|
||||
[*Note [1](#fs.path.fmt.cvt-note-1)*:
|
||||
|
||||
The format conversions described in this subclause
|
||||
are not applied on POSIX-based operating systems
|
||||
because on these systems:
|
||||
|
||||
- [(1.1)](#fs.path.fmt.cvt-1.1)
|
||||
|
||||
The generic format is acceptable as a native path[.](#fs.path.fmt.cvt-1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#fs.path.fmt.cvt-1.2)
|
||||
|
||||
There is no need to distinguish between native format and generic format in function arguments[.](#fs.path.fmt.cvt-1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#fs.path.fmt.cvt-1.3)
|
||||
|
||||
Paths for regular files and paths for directories share the same syntax[.](#fs.path.fmt.cvt-1.3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#fs.path.fmt.cvt-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13947)
|
||||
|
||||
Several functions are defined to accept [*detected-format*](#def:detected-format) arguments,
|
||||
which are character sequences[.](#fs.path.fmt.cvt-2.sentence-1)
|
||||
|
||||
A detected-format argument represents a path
|
||||
using either a pathname in the generic format ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))
|
||||
or a pathname in the native format ([[fs.class.path]](fs.class.path "31.12.6 Class path"))[.](#fs.path.fmt.cvt-2.sentence-2)
|
||||
|
||||
Such an argument is taken to be in the generic format if and only if
|
||||
it matches the generic format and is not acceptable to the operating system
|
||||
as a native path[.](#fs.path.fmt.cvt-2.sentence-3)
|
||||
|
||||
[3](#fs.path.fmt.cvt-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13956)
|
||||
|
||||
[*Note [2](#fs.path.fmt.cvt-note-2)*:
|
||||
|
||||
Some operating systems have no unambiguous way to distinguish between native format and generic format arguments[.](#fs.path.fmt.cvt-3.sentence-1)
|
||||
|
||||
This is by design as it simplifies use for operating systems that do not require
|
||||
disambiguation[.](#fs.path.fmt.cvt-3.sentence-2)
|
||||
|
||||
It is possible that an implementation for an operating system
|
||||
where disambiguation is needed distinguishes between the formats[.](#fs.path.fmt.cvt-3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#fs.path.fmt.cvt-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13964)
|
||||
|
||||
Pathnames are converted as needed between the generic and native formats
|
||||
in an operating-system-dependent manner[.](#fs.path.fmt.cvt-4.sentence-1)
|
||||
|
||||
Let *G(n)* and *N(g)* in a mathematical sense
|
||||
be the implementation's functions that convert native-to-generic
|
||||
and generic-to-native formats respectively[.](#fs.path.fmt.cvt-4.sentence-2)
|
||||
|
||||
If *g=G(n)* for some *n*, then *G(N(g))=g*;
|
||||
if *n=N(g)* for some *g*, then *N(G(n))=n*[.](#fs.path.fmt.cvt-4.sentence-3)
|
||||
|
||||
[*Note [3](#fs.path.fmt.cvt-note-3)*:
|
||||
|
||||
Neither *G* nor *N* need be invertible[.](#fs.path.fmt.cvt-4.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#fs.path.fmt.cvt-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13976)
|
||||
|
||||
If the native format requires paths for regular files to be formatted
|
||||
differently from paths for directories, the path shall be treated as a directory
|
||||
path if its last element is a [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]"),
|
||||
otherwise it shall be treated as a path to a regular file[.](#fs.path.fmt.cvt-5.sentence-1)
|
||||
|
||||
[6](#fs.path.fmt.cvt-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13982)
|
||||
|
||||
[*Note [4](#fs.path.fmt.cvt-note-4)*:
|
||||
|
||||
A path stores a native format pathname ([[fs.path.native.obs]](fs.path.native.obs "31.12.6.5.6 Native format observers"))
|
||||
and acts as if it also stores a generic format pathname,
|
||||
related as given below[.](#fs.path.fmt.cvt-6.sentence-1)
|
||||
|
||||
The implementation can generate the generic format pathname
|
||||
based on the native format pathname (and possibly other information)
|
||||
when requested[.](#fs.path.fmt.cvt-6.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[7](#fs.path.fmt.cvt-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13992)
|
||||
|
||||
When a path is constructed from or is assigned a single representation
|
||||
separate from any path, the other representation is selected
|
||||
by the appropriate conversion function (*G* or *N*)[.](#fs.path.fmt.cvt-7.sentence-1)
|
||||
|
||||
[8](#fs.path.fmt.cvt-8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13997)
|
||||
|
||||
When the (new) value *p* of one representation of a path
|
||||
is derived from the representation of that or another path,
|
||||
a value *q* is chosen for the other representation[.](#fs.path.fmt.cvt-8.sentence-1)
|
||||
|
||||
The value *q* converts to *p* (by *G* or *N* as appropriate)
|
||||
if any such value does so;*q* is otherwise unspecified[.](#fs.path.fmt.cvt-8.sentence-2)
|
||||
|
||||
[*Note [5](#fs.path.fmt.cvt-note-5)*:
|
||||
|
||||
If *q* is the result of converting any path at all,
|
||||
it is the result of converting *p*[.](#fs.path.fmt.cvt-8.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [31.12.6.3.2](#fs.path.type.cvt) Type and encoding conversions [[fs.path.type.cvt]](fs.path.type.cvt)
|
||||
|
||||
[1](#fs.path.type.cvt-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14013)
|
||||
|
||||
The [*native encoding*](#def:native_encoding "31.12.6.3.2 Type and encoding conversions [fs.path.type.cvt]") of an ordinary character string is
|
||||
the operating system dependent current encoding
|
||||
for pathnames ([[fs.class.path]](fs.class.path "31.12.6 Class path"))[.](#fs.path.type.cvt-1.sentence-1)
|
||||
|
||||
The [*native encoding*](#def:native_encoding "31.12.6.3.2 Type and encoding conversions [fs.path.type.cvt]") for wide character strings is
|
||||
the implementation-defined execution
|
||||
wide-character set encoding ([[character.seq]](character.seq "16.3.3.3.4 Character sequences"))[.](#fs.path.type.cvt-1.sentence-2)
|
||||
|
||||
[2](#fs.path.type.cvt-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14021)
|
||||
|
||||
For member function arguments that take character sequences representing
|
||||
paths and for member functions returning strings, value type and encoding
|
||||
conversion is performed if the value type of the argument or return value differs frompath::value_type[.](#fs.path.type.cvt-2.sentence-1)
|
||||
|
||||
For the argument or return value, the method of conversion and the encoding
|
||||
to be converted to is determined
|
||||
by its value type:
|
||||
|
||||
- [(2.1)](#fs.path.type.cvt-2.1)
|
||||
|
||||
char: The encoding is the native ordinary encoding[.](#fs.path.type.cvt-2.1.sentence-1)
|
||||
The method of conversion, if any, is operating system dependent[.](#fs.path.type.cvt-2.1.sentence-2)
|
||||
[*Note [1](#fs.path.type.cvt-note-1)*:
|
||||
For POSIX-based operating systems path::value_type is char so no conversion from char value type arguments or to char value type return values is performed[.](#fs.path.type.cvt-2.1.sentence-3)
|
||||
For Windows-based operating systems, the
|
||||
native ordinary encoding is determined by calling a Windows API function[.](#fs.path.type.cvt-2.1.sentence-4)
|
||||
â *end note*]
|
||||
[*Note [2](#fs.path.type.cvt-note-2)*:
|
||||
This results in behavior identical to other C and C++
|
||||
standard library functions that perform file operations using ordinary character
|
||||
strings to identify paths[.](#fs.path.type.cvt-2.1.sentence-5)
|
||||
Changing this behavior would be surprising and
|
||||
error-prone[.](#fs.path.type.cvt-2.1.sentence-6)
|
||||
â *end note*]
|
||||
|
||||
- [(2.2)](#fs.path.type.cvt-2.2)
|
||||
|
||||
wchar_t: The encoding is the native wide encoding[.](#fs.path.type.cvt-2.2.sentence-1)
|
||||
The method of conversion is unspecified[.](#fs.path.type.cvt-2.2.sentence-2)
|
||||
[*Note [3](#fs.path.type.cvt-note-3)*:
|
||||
For Windows-based operating systems path::value_type is wchar_t so no conversion from wchar_t value type arguments or to wchar_t value type return values is performed[.](#fs.path.type.cvt-2.2.sentence-3)
|
||||
â *end note*]
|
||||
|
||||
- [(2.3)](#fs.path.type.cvt-2.3)
|
||||
|
||||
char8_t: The encoding is UTF-8[.](#fs.path.type.cvt-2.3.sentence-1)
|
||||
The method of conversion
|
||||
is unspecified[.](#fs.path.type.cvt-2.3.sentence-2)
|
||||
|
||||
- [(2.4)](#fs.path.type.cvt-2.4)
|
||||
|
||||
char16_t: The encoding is UTF-16[.](#fs.path.type.cvt-2.4.sentence-1)
|
||||
The method of conversion
|
||||
is unspecified[.](#fs.path.type.cvt-2.4.sentence-2)
|
||||
|
||||
- [(2.5)](#fs.path.type.cvt-2.5)
|
||||
|
||||
char32_t: The encoding is UTF-32[.](#fs.path.type.cvt-2.5.sentence-1)
|
||||
The method of conversion
|
||||
is unspecified[.](#fs.path.type.cvt-2.5.sentence-2)
|
||||
|
||||
[3](#fs.path.type.cvt-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14066)
|
||||
|
||||
If the encoding being converted to has no representation for source
|
||||
characters, the resulting converted characters, if any, are unspecified[.](#fs.path.type.cvt-3.sentence-1)
|
||||
|
||||
Implementations should not modify member function arguments
|
||||
if already of type path::value_type[.](#fs.path.type.cvt-3.sentence-2)
|
||||
160
cppdraft/fs/path/decompose.md
Normal file
160
cppdraft/fs/path/decompose.md
Normal file
@@ -0,0 +1,160 @@
|
||||
[fs.path.decompose]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.decompose)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.decompose)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.decompose)
|
||||
|
||||
#### 31.12.6.5.9 Decomposition [fs.path.decompose]
|
||||
|
||||
[ð](#lib:root_name,path)
|
||||
|
||||
`path root_name() const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14859)
|
||||
|
||||
*Returns*: [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]"), if the pathname in the generic format
|
||||
includes [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]"), otherwise path()[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:root_directory,path)
|
||||
|
||||
`path root_directory() const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14871)
|
||||
|
||||
*Returns*: [*root-directory*](fs.path.generic#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]"), if the pathname in the generic format
|
||||
includes [*root-directory*](fs.path.generic#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]"), otherwise path()[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:root_path,path)
|
||||
|
||||
`path root_path() const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14883)
|
||||
|
||||
*Returns*: root_name() / root_directory()[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:relative_path,path)
|
||||
|
||||
`path relative_path() const;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14894)
|
||||
|
||||
*Returns*: A path composed from the pathname in the generic format,
|
||||
if empty() is false, beginning
|
||||
with the first [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") after root_path()[.](#4.sentence-1)
|
||||
|
||||
Otherwise, path()[.](#4.sentence-2)
|
||||
|
||||
[ð](#lib:parent_path,path)
|
||||
|
||||
`path parent_path() const;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14907)
|
||||
|
||||
*Returns*: *this if has_relative_path() is false,
|
||||
otherwise a path whose generic format pathname is
|
||||
the longest prefix of the generic format pathname of *this that produces one fewer element in its iteration[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:filename,path)
|
||||
|
||||
`path filename() const;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14921)
|
||||
|
||||
*Returns*: relative_path().empty() ? path() : *--end()[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14925)
|
||||
|
||||
[*Example [1](#example-1)*: path("/foo/bar.txt").filename(); // yields "bar.txt" path("/foo/bar").filename(); // yields "bar" path("/foo/bar/").filename(); // yields "" path("/").filename(); // yields "" path("//host").filename(); // yields "" path(".").filename(); // yields "." path("..").filename(); // yields ".." â *end example*]
|
||||
|
||||
[ð](#lib:stem,path)
|
||||
|
||||
`path stem() const;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14945)
|
||||
|
||||
*Returns*: Let f be the generic format pathname of filename()[.](#8.sentence-1)
|
||||
|
||||
Returns a path whose pathname in the generic format is
|
||||
|
||||
- [(8.1)](#8.1)
|
||||
|
||||
f, if it contains no periods other than a leading period
|
||||
or consists solely of one or two periods;
|
||||
|
||||
- [(8.2)](#8.2)
|
||||
|
||||
otherwise, the prefix of f ending before its last period[.](#8.sentence-2)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14955)
|
||||
|
||||
[*Example [2](#example-2)*: std::cout << path("/foo/bar.txt").stem(); // outputs "bar" path p = "foo.bar.baz.tar";for (; !p.extension().empty(); p = p.stem()) std::cout << p.extension() << '\n'; // outputs: .tar// .baz// .bar â *end example*]
|
||||
|
||||
[ð](#lib:extension,path)
|
||||
|
||||
`path extension() const;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14975)
|
||||
|
||||
*Returns*: A path whose pathname in the generic format is
|
||||
the suffix of filename() not included in stem()[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14980)
|
||||
|
||||
[*Example [3](#example-3)*: path("/foo/bar.txt").extension(); // yields ".txt" and stem() is "bar" path("/foo/bar").extension(); // yields "" and stem() is "bar" path("/foo/.profile").extension(); // yields "" and stem() is ".profile" path(".bar").extension(); // yields "" and stem() is ".bar" path("..bar").extension(); // yields ".bar" and stem() is "." â *end example*]
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14991)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The period is included in the return value so that it is
|
||||
possible to distinguish between no extension and an empty extension[.](#12.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14997)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
On non-POSIX operating systems, for a path p,
|
||||
it is possible that p.stem() + p.extension() == p.filename() is false,
|
||||
even though the generic format pathnames are the same[.](#13.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
137
cppdraft/fs/path/fmt/cvt.md
Normal file
137
cppdraft/fs/path/fmt/cvt.md
Normal file
@@ -0,0 +1,137 @@
|
||||
[fs.path.fmt.cvt]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.fmt.cvt)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.fmt.cvt)
|
||||
|
||||
#### 31.12.6.3 Conversions [[fs.path.cvt]](fs.path.cvt#fs.path.fmt.cvt)
|
||||
|
||||
#### 31.12.6.3.1 Argument format conversions [fs.path.fmt.cvt]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13935)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The format conversions described in this subclause
|
||||
are not applied on POSIX-based operating systems
|
||||
because on these systems:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
The generic format is acceptable as a native path[.](#1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
There is no need to distinguish between native format and generic format in function arguments[.](#1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
Paths for regular files and paths for directories share the same syntax[.](#1.3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13947)
|
||||
|
||||
Several functions are defined to accept [*detected-format*](#def:detected-format) arguments,
|
||||
which are character sequences[.](#2.sentence-1)
|
||||
|
||||
A detected-format argument represents a path
|
||||
using either a pathname in the generic format ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format"))
|
||||
or a pathname in the native format ([[fs.class.path]](fs.class.path "31.12.6 Class path"))[.](#2.sentence-2)
|
||||
|
||||
Such an argument is taken to be in the generic format if and only if
|
||||
it matches the generic format and is not acceptable to the operating system
|
||||
as a native path[.](#2.sentence-3)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13956)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Some operating systems have no unambiguous way to distinguish between native format and generic format arguments[.](#3.sentence-1)
|
||||
|
||||
This is by design as it simplifies use for operating systems that do not require
|
||||
disambiguation[.](#3.sentence-2)
|
||||
|
||||
It is possible that an implementation for an operating system
|
||||
where disambiguation is needed distinguishes between the formats[.](#3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13964)
|
||||
|
||||
Pathnames are converted as needed between the generic and native formats
|
||||
in an operating-system-dependent manner[.](#4.sentence-1)
|
||||
|
||||
Let *G(n)* and *N(g)* in a mathematical sense
|
||||
be the implementation's functions that convert native-to-generic
|
||||
and generic-to-native formats respectively[.](#4.sentence-2)
|
||||
|
||||
If *g=G(n)* for some *n*, then *G(N(g))=g*;
|
||||
if *n=N(g)* for some *g*, then *N(G(n))=n*[.](#4.sentence-3)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
Neither *G* nor *N* need be invertible[.](#4.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13976)
|
||||
|
||||
If the native format requires paths for regular files to be formatted
|
||||
differently from paths for directories, the path shall be treated as a directory
|
||||
path if its last element is a [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]"),
|
||||
otherwise it shall be treated as a path to a regular file[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13982)
|
||||
|
||||
[*Note [4](#note-4)*:
|
||||
|
||||
A path stores a native format pathname ([[fs.path.native.obs]](fs.path.native.obs "31.12.6.5.6 Native format observers"))
|
||||
and acts as if it also stores a generic format pathname,
|
||||
related as given below[.](#6.sentence-1)
|
||||
|
||||
The implementation can generate the generic format pathname
|
||||
based on the native format pathname (and possibly other information)
|
||||
when requested[.](#6.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13992)
|
||||
|
||||
When a path is constructed from or is assigned a single representation
|
||||
separate from any path, the other representation is selected
|
||||
by the appropriate conversion function (*G* or *N*)[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13997)
|
||||
|
||||
When the (new) value *p* of one representation of a path
|
||||
is derived from the representation of that or another path,
|
||||
a value *q* is chosen for the other representation[.](#8.sentence-1)
|
||||
|
||||
The value *q* converts to *p* (by *G* or *N* as appropriate)
|
||||
if any such value does so;*q* is otherwise unspecified[.](#8.sentence-2)
|
||||
|
||||
[*Note [5](#note-5)*:
|
||||
|
||||
If *q* is the result of converting any path at all,
|
||||
it is the result of converting *p*[.](#8.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
99
cppdraft/fs/path/fmtr.md
Normal file
99
cppdraft/fs/path/fmtr.md
Normal file
@@ -0,0 +1,99 @@
|
||||
[fs.path.fmtr]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.fmtr)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.fmtr)
|
||||
|
||||
#### 31.12.6.9 Formatting support [fs.path.fmtr]
|
||||
|
||||
#### [31.12.6.9.1](#general) Formatting support overview [[fs.path.fmtr.general]](fs.path.fmtr.general)
|
||||
|
||||
[ð](#lib:formatter)
|
||||
|
||||
namespace std {template<class charT> struct formatter<filesystem::path, charT> {constexpr void set_debug_format(); constexpr typename basic_format_parse_context<charT>::iterator
|
||||
parse(basic_format_parse_context<charT>& ctx); template<class FormatContext>typename FormatContext::iterator
|
||||
format(const filesystem::path& path, FormatContext& ctx) const; };}
|
||||
|
||||
#### [31.12.6.9.2](#funcs) Formatting support functions [[fs.path.fmtr.funcs]](fs.path.fmtr.funcs)
|
||||
|
||||
[1](#funcs-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15483)
|
||||
|
||||
Formatting of paths uses formatting specifiers of the form
|
||||
|
||||
[path-format-spec:](#nt:path-format-spec "31.12.6.9.2 Formatting support functions [fs.path.fmtr.funcs]")
|
||||
fill-and-alignopt widthopt ?opt gopt
|
||||
|
||||
where the productions *fill-and-align* and *width* are described in [[format.string]](format.string "28.5.2 Format string")[.](#funcs-1.sentence-1)
|
||||
|
||||
If the ? option is used then
|
||||
the path is formatted as an escaped string ([[format.string.escaped]](format.string.escaped "28.5.6.5 Formatting escaped characters and strings"))[.](#funcs-1.sentence-2)
|
||||
|
||||
[ð](#lib:formatter,set_debug_format)
|
||||
|
||||
`constexpr void set_debug_format();
|
||||
`
|
||||
|
||||
[2](#funcs-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15500)
|
||||
|
||||
*Effects*: Modifies the state of the formatter to be as if
|
||||
the *path-format-spec* parsed by the last call to parse contained the ? option[.](#funcs-2.sentence-1)
|
||||
|
||||
[ð](#lib:formatter,basic_format_parse_context)
|
||||
|
||||
`constexpr typename basic_format_parse_context<charT>::iterator
|
||||
parse(basic_format_parse_context<charT>& ctx);
|
||||
`
|
||||
|
||||
[3](#funcs-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15514)
|
||||
|
||||
*Effects*: Parses the format specifier as a *path-format-spec* and
|
||||
stores the parsed specifiers in *this[.](#funcs-3.sentence-1)
|
||||
|
||||
[4](#funcs-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15519)
|
||||
|
||||
*Returns*: An iterator past the end of the *path-format-spec*[.](#funcs-4.sentence-1)
|
||||
|
||||
[ð](#lib:formatter,format)
|
||||
|
||||
`template<class FormatContext>
|
||||
typename FormatContext::iterator
|
||||
format(const filesystem::path& p, FormatContext& ctx) const;
|
||||
`
|
||||
|
||||
[5](#funcs-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15532)
|
||||
|
||||
*Effects*: Let s be p.generic_string<filesystem::path::value_type>() if the g option is used,
|
||||
otherwise p.native()[.](#funcs-5.sentence-1)
|
||||
|
||||
Writes s into ctx.out(),
|
||||
adjusted according to the *path-format-spec*[.](#funcs-5.sentence-2)
|
||||
|
||||
If charT is char,path::value_type is wchar_t, and
|
||||
the literal encoding is UTF-8,
|
||||
then the escaped path is transcoded from the native encoding for
|
||||
wide character strings to UTF-8 with
|
||||
maximal subparts of ill-formed subsequences
|
||||
substituted with U+fffd replacement character per the Unicode Standard, Chapter 3.9 U+fffd Substitution in Conversion[.](#funcs-5.sentence-3)
|
||||
|
||||
If charT and path::value_type are the same
|
||||
then no transcoding is performed[.](#funcs-5.sentence-4)
|
||||
|
||||
Otherwise, transcoding isimplementation-defined[.](#funcs-5.sentence-5)
|
||||
|
||||
[6](#funcs-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15552)
|
||||
|
||||
*Returns*: An iterator past the end of the output range[.](#funcs-6.sentence-1)
|
||||
91
cppdraft/fs/path/fmtr/funcs.md
Normal file
91
cppdraft/fs/path/fmtr/funcs.md
Normal file
@@ -0,0 +1,91 @@
|
||||
[fs.path.fmtr.funcs]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.fmtr.funcs)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.fmtr.funcs)
|
||||
|
||||
#### 31.12.6.9 Formatting support [[fs.path.fmtr]](fs.path.fmtr#funcs)
|
||||
|
||||
#### 31.12.6.9.2 Formatting support functions [fs.path.fmtr.funcs]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15483)
|
||||
|
||||
Formatting of paths uses formatting specifiers of the form
|
||||
|
||||
[path-format-spec:](#nt:path-format-spec "31.12.6.9.2 Formatting support functions [fs.path.fmtr.funcs]")
|
||||
fill-and-alignopt widthopt ?opt gopt
|
||||
|
||||
where the productions *fill-and-align* and *width* are described in [[format.string]](format.string "28.5.2 Format string")[.](#1.sentence-1)
|
||||
|
||||
If the ? option is used then
|
||||
the path is formatted as an escaped string ([[format.string.escaped]](format.string.escaped "28.5.6.5 Formatting escaped characters and strings"))[.](#1.sentence-2)
|
||||
|
||||
[ð](#lib:formatter,set_debug_format)
|
||||
|
||||
`constexpr void set_debug_format();
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15500)
|
||||
|
||||
*Effects*: Modifies the state of the formatter to be as if
|
||||
the *path-format-spec* parsed by the last call to parse contained the ? option[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:formatter,basic_format_parse_context)
|
||||
|
||||
`constexpr typename basic_format_parse_context<charT>::iterator
|
||||
parse(basic_format_parse_context<charT>& ctx);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15514)
|
||||
|
||||
*Effects*: Parses the format specifier as a *path-format-spec* and
|
||||
stores the parsed specifiers in *this[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15519)
|
||||
|
||||
*Returns*: An iterator past the end of the *path-format-spec*[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:formatter,format)
|
||||
|
||||
`template<class FormatContext>
|
||||
typename FormatContext::iterator
|
||||
format(const filesystem::path& p, FormatContext& ctx) const;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15532)
|
||||
|
||||
*Effects*: Let s be p.generic_string<filesystem::path::value_type>() if the g option is used,
|
||||
otherwise p.native()[.](#5.sentence-1)
|
||||
|
||||
Writes s into ctx.out(),
|
||||
adjusted according to the *path-format-spec*[.](#5.sentence-2)
|
||||
|
||||
If charT is char,path::value_type is wchar_t, and
|
||||
the literal encoding is UTF-8,
|
||||
then the escaped path is transcoded from the native encoding for
|
||||
wide character strings to UTF-8 with
|
||||
maximal subparts of ill-formed subsequences
|
||||
substituted with U+fffd replacement character per the Unicode Standard, Chapter 3.9 U+fffd Substitution in Conversion[.](#5.sentence-3)
|
||||
|
||||
If charT and path::value_type are the same
|
||||
then no transcoding is performed[.](#5.sentence-4)
|
||||
|
||||
Otherwise, transcoding isimplementation-defined[.](#5.sentence-5)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15552)
|
||||
|
||||
*Returns*: An iterator past the end of the output range[.](#6.sentence-1)
|
||||
17
cppdraft/fs/path/fmtr/general.md
Normal file
17
cppdraft/fs/path/fmtr/general.md
Normal file
@@ -0,0 +1,17 @@
|
||||
[fs.path.fmtr.general]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.fmtr.general)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.fmtr.general)
|
||||
|
||||
#### 31.12.6.9 Formatting support [[fs.path.fmtr]](fs.path.fmtr#general)
|
||||
|
||||
#### 31.12.6.9.1 Formatting support overview [fs.path.fmtr.general]
|
||||
|
||||
[ð](#lib:formatter)
|
||||
|
||||
namespace std {template<class charT> struct formatter<filesystem::path, charT> {constexpr void set_debug_format(); constexpr typename basic_format_parse_context<charT>::iterator
|
||||
parse(basic_format_parse_context<charT>& ctx); template<class FormatContext>typename FormatContext::iterator
|
||||
format(const filesystem::path& path, FormatContext& ctx) const; };}
|
||||
193
cppdraft/fs/path/gen.md
Normal file
193
cppdraft/fs/path/gen.md
Normal file
@@ -0,0 +1,193 @@
|
||||
[fs.path.gen]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.gen)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.gen)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.gen)
|
||||
|
||||
#### 31.12.6.5.11 Generation [fs.path.gen]
|
||||
|
||||
[ð](#lib:lexically_normal,path)
|
||||
|
||||
`path lexically_normal() const;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15144)
|
||||
|
||||
*Returns*: A path whose pathname in the generic format is
|
||||
the normal form ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format")) of the pathname
|
||||
in the generic format of *this[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15150)
|
||||
|
||||
[*Example [1](#example-1)*: assert(path("foo/./bar/..").lexically_normal() == "foo/");
|
||||
assert(path("foo/.///bar/../").lexically_normal() == "foo/");
|
||||
|
||||
The above assertions will succeed[.](#2.sentence-1)
|
||||
|
||||
On Windows, the returned path's [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") characters
|
||||
will be backslashes rather than slashes,
|
||||
but that does not affect path equality[.](#2.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:lexically_relative,path)
|
||||
|
||||
`path lexically_relative(const path& base) const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15169)
|
||||
|
||||
*Effects*: If:
|
||||
|
||||
- [(3.1)](#3.1)
|
||||
|
||||
root_name() != base.root_name() is true, or
|
||||
|
||||
- [(3.2)](#3.2)
|
||||
|
||||
is_absolute() != base.is_absolute() is true, or
|
||||
|
||||
- [(3.3)](#3.3)
|
||||
|
||||
!has_root_directory() && base.has_root_directory() is true, or
|
||||
|
||||
- [(3.4)](#3.4)
|
||||
|
||||
any [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") inrelative_path() or base.relative_path() can be interpreted as a [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]"),
|
||||
|
||||
returns path()[.](#3.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
On a POSIX implementation, no [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") in a [*relative-path*](fs.path.generic#nt:relative-path "31.12.6.2 Generic pathname format [fs.path.generic]") is acceptable as a [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#3.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
Determines the first mismatched element of *this and base as if by:auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
|
||||
|
||||
Then,
|
||||
|
||||
- [(3.5)](#3.5)
|
||||
|
||||
if a == end() and b == base.end(), returns path("."); otherwise
|
||||
|
||||
- [(3.6)](#3.6)
|
||||
|
||||
let n be the number of [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") elements in [b, base.end())
|
||||
that are not dot or dot-dot or empty, minus the number that are dot-dot[.](#3.6.sentence-1)
|
||||
If n<0, returns path(); otherwise
|
||||
|
||||
- [(3.7)](#3.7)
|
||||
|
||||
if n == 0 and (a == end() || a->empty()),
|
||||
returns path("."); otherwise
|
||||
|
||||
- [(3.8)](#3.8)
|
||||
|
||||
returns an object of class path that is default-constructed, followed by
|
||||
* [(3.8.1)](#3.8.1)
|
||||
|
||||
application of operator/=(path(".."))n times, and then
|
||||
|
||||
* [(3.8.2)](#3.8.2)
|
||||
|
||||
application of operator/= for each element in [a, end())[.](#3.8.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15215)
|
||||
|
||||
*Returns*: *this made relative to base[.](#4.sentence-1)
|
||||
|
||||
Does not resolve ([[fs.class.path]](fs.class.path "31.12.6 Class path")) symlinks[.](#4.sentence-2)
|
||||
|
||||
Does not first normalize ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format")) *this or base[.](#4.sentence-3)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15221)
|
||||
|
||||
[*Example [2](#example-2)*: assert(path("/a/d").lexically_relative("/a/b/c") == "../../d");
|
||||
assert(path("/a/b/c").lexically_relative("/a/d") == "../b/c");
|
||||
assert(path("a/b/c").lexically_relative("a") == "b/c");
|
||||
assert(path("a/b/c").lexically_relative("a/b/c/x/y") == "../..");
|
||||
assert(path("a/b/c").lexically_relative("a/b/c") == ".");
|
||||
assert(path("a/b").lexically_relative("c/d") == "../../a/b");
|
||||
|
||||
The above assertions will succeed[.](#5.sentence-1)
|
||||
|
||||
On Windows, the returned path's [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") characters
|
||||
will be backslashes rather than slashes,
|
||||
but that does not affect path equality[.](#5.sentence-2)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15237)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
If symlink following semantics are desired,
|
||||
use the operational function relative()[.](#6.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15243)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
If normalization ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format")) is needed
|
||||
to ensure consistent matching of elements,
|
||||
apply lexically_normal() to *this, base, or both[.](#7.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:lexically_proximate,path)
|
||||
|
||||
`path lexically_proximate(const path& base) const;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15258)
|
||||
|
||||
*Returns*: If the value of lexically_relative(base) is not an empty path,
|
||||
return it[.](#8.sentence-1)
|
||||
|
||||
Otherwise return *this[.](#8.sentence-2)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15263)
|
||||
|
||||
[*Note [4](#note-4)*:
|
||||
|
||||
If symlink following semantics are desired,
|
||||
use the operational function proximate()[.](#9.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15269)
|
||||
|
||||
[*Note [5](#note-5)*:
|
||||
|
||||
If normalization ([[fs.path.generic]](fs.path.generic "31.12.6.2 Generic pathname format")) is needed
|
||||
to ensure consistent matching of elements,
|
||||
apply lexically_normal() to *this, base, or both[.](#10.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
161
cppdraft/fs/path/generic.md
Normal file
161
cppdraft/fs/path/generic.md
Normal file
@@ -0,0 +1,161 @@
|
||||
[fs.path.generic]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.generic)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.generic)
|
||||
|
||||
#### 31.12.6.2 Generic pathname format [fs.path.generic]
|
||||
|
||||
[pathname:](#nt:pathname "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
[*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]")opt [*root-directory*](#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]")opt [*relative-path*](#nt:relative-path "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
|
||||
[root-name:](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
operating system dependent sequences of characters
|
||||
implementation-defined sequences of characters
|
||||
|
||||
[root-directory:](#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
[*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
|
||||
[relative-path:](#nt:relative-path "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
[*filename*](#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
[*filename*](#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") [*relative-path*](#nt:relative-path "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
an empty path
|
||||
|
||||
[filename:](#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
non-empty sequence of characters other than [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") characters
|
||||
|
||||
[directory-separator:](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
[*preferred-separator*](#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]") [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")opt
|
||||
[*fallback-separator*](#nt:fallback-separator "31.12.6.2 Generic pathname format [fs.path.generic]") [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")opt
|
||||
|
||||
[preferred-separator:](#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
operating system dependent directory separator character
|
||||
|
||||
[fallback-separator:](#nt:fallback-separator "31.12.6.2 Generic pathname format [fs.path.generic]")
|
||||
/, if [*preferred-separator*](#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]") is not /
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13843)
|
||||
|
||||
A [*filename*](#def:filename "31.12.6.2 Generic pathname format [fs.path.generic]") is
|
||||
the name of a file[.](#1.sentence-1)
|
||||
|
||||
The [*dot*](#def:dot,filename "31.12.6.2 Generic pathname format [fs.path.generic]") and [*dot-dot*](#def:dot-dot,filename "31.12.6.2 Generic pathname format [fs.path.generic]") filenames,
|
||||
consisting solely of one and two period characters respectively,
|
||||
have special meaning[.](#1.sentence-2)
|
||||
|
||||
The following characteristics of filenames are operating system dependent:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
The permitted characters[.](#1.1.sentence-1)
|
||||
[*Example [1](#example-1)*:
|
||||
Some operating systems prohibit
|
||||
the ASCII control characters (0x00 â 0x1F) in filenames[.](#1.1.sentence-2)
|
||||
â *end example*]
|
||||
[*Note [1](#note-1)*:
|
||||
Wider portability can be achieved by limiting [*filename*](#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") characters to the POSIX Portable Filename Character Set:
|
||||
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z
|
||||
0 1 2 3 4 5 6 7 8 9 . _ -
|
||||
â *end note*]
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
The maximum permitted length[.](#1.2.sentence-1)
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
Filenames that are not permitted[.](#1.3.sentence-1)
|
||||
|
||||
- [(1.4)](#1.4)
|
||||
|
||||
Filenames that have special meaning[.](#1.4.sentence-1)
|
||||
|
||||
- [(1.5)](#1.5)
|
||||
|
||||
Case awareness and sensitivity during path resolution[.](#1.5.sentence-1)
|
||||
|
||||
- [(1.6)](#1.6)
|
||||
|
||||
Special rules that may apply to file types other than regular
|
||||
files, such as directories[.](#1.6.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13870)
|
||||
|
||||
Except in a [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]"),
|
||||
multiple successive [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") characters are considered to
|
||||
be the same as one [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") character[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13875)
|
||||
|
||||
The dot filename is treated as a reference to the current directory[.](#3.sentence-1)
|
||||
|
||||
The dot-dot filename is treated as a reference to the parent directory[.](#3.sentence-2)
|
||||
|
||||
What the dot-dot filename refers to
|
||||
relative to [*root-directory*](#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]") is implementation-defined[.](#3.sentence-3)
|
||||
|
||||
Specific filenames may have special meanings for a particular operating system[.](#3.sentence-4)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13882)
|
||||
|
||||
A [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") identifies the
|
||||
starting location for pathname resolution ([[fs.class.path]](fs.class.path "31.12.6 Class path"))[.](#4.sentence-1)
|
||||
|
||||
If there are no operating system dependent [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]")*s*,
|
||||
at least one implementation-defined [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") is required[.](#4.sentence-2)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
Many operating systems define a name
|
||||
beginning with two [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") characters
|
||||
as a [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") that identifies
|
||||
network or other resource locations[.](#4.sentence-3)
|
||||
|
||||
Some operating systems
|
||||
define a single letter followed by a colon
|
||||
as a drive specifier â a [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") identifying a specific device such as a disk drive[.](#4.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13898)
|
||||
|
||||
If a [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") is otherwise ambiguous,
|
||||
the possibility with the longest sequence of characters is chosen[.](#5.sentence-1)
|
||||
|
||||
[*Note [3](#note-3)*:
|
||||
|
||||
On a POSIX-like operating system, it is impossible to have a[*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") and a [*relative-path*](#nt:relative-path "31.12.6.2 Generic pathname format [fs.path.generic]") without an intervening [*root-directory*](#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]") element[.](#5.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13907)
|
||||
|
||||
[*Normalization*](#def:normalization,path "31.12.6.2 Generic pathname format [fs.path.generic]") of a generic format pathname means:
|
||||
|
||||
| [1.](#6.1) | If the path is empty, stop[.](#6.1.sentence-1) |
|
||||
| --- | --- |
|
||||
| [2.](#6.2) | Replace each slash character in the [*root-name*](#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") with a [*preferred-separator*](#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#6.2.sentence-1) |
|
||||
| [3.](#6.3) | Replace each [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") with a [*preferred-separator*](#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#6.3.sentence-1)<br>[*Note [4](#note-4)*:<br>The generic pathname grammar defines [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") as one or more slashes and [*preferred-separator*](#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]")*s*[.](#6.3.sentence-2) â *end note*] |
|
||||
| [4.](#6.4) | Remove each dot filename and any immediately following [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#6.4.sentence-1) |
|
||||
| [5.](#6.5) | As long as any appear, remove a non-dot-dot filename immediately followed by a [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") and a dot-dot filename, along with any immediately following [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#6.5.sentence-1) |
|
||||
| [6.](#6.6) | If there is a [*root-directory*](#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]"), remove all dot-dot filenames and any [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")*s* immediately following them[.](#6.6.sentence-1)<br>[*Note [5](#note-5)*:<br>These dot-dot filenames attempt to refer to nonexistent parent directories[.](#6.6.sentence-2) â *end note*] |
|
||||
| [7.](#6.7) | If the last filename is dot-dot, remove any trailing [*directory-separator*](#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#6.7.sentence-1) |
|
||||
| [8.](#6.8) | If the path is empty, add a dot[.](#6.8.sentence-1) |
|
||||
|
||||
The result of normalization is a path in [*normal form*](#def:normal_form,path "31.12.6.2 Generic pathname format [fs.path.generic]"),
|
||||
which is said to be [*normalized*](#def:normalized)[.](#6.sentence-2)
|
||||
91
cppdraft/fs/path/generic/obs.md
Normal file
91
cppdraft/fs/path/generic/obs.md
Normal file
@@ -0,0 +1,91 @@
|
||||
[fs.path.generic.obs]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.generic.obs)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.generic.obs)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.generic.obs)
|
||||
|
||||
#### 31.12.6.5.7 Generic format observers [fs.path.generic.obs]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14725)
|
||||
|
||||
Generic format observer functions return strings formatted according to the[generic pathname format](fs.path.generic "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#1.sentence-1)
|
||||
|
||||
A single slash ('/') character is used as
|
||||
the [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14731)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
On an operating system that uses backslash as
|
||||
its [*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]"),path("foo\\bar").generic_string() returns "foo/bar"[.](#2.sentence-1)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:generic_string,path)
|
||||
|
||||
`template<class EcharT, class traits = char_traits<EcharT>, class Allocator = allocator<EcharT>>
|
||||
basic_string<EcharT, traits, Allocator> generic_string(const Allocator& a = Allocator()) const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14748)
|
||||
|
||||
*Returns*: The pathname in the generic format[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14752)
|
||||
|
||||
*Remarks*: All memory allocation, including for the return value, shall
|
||||
be performed by a[.](#4.sentence-1)
|
||||
|
||||
Conversion, if any, is specified by[[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions")[.](#4.sentence-2)
|
||||
|
||||
[ð](#lib:generic_system_encoded_string,path)
|
||||
|
||||
`std::string generic_system_encoded_string() const;
|
||||
std::wstring generic_wstring() const;
|
||||
std::u8string generic_u8string() const;
|
||||
std::u16string generic_u16string() const;
|
||||
std::u32string generic_u32string() const;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14773)
|
||||
|
||||
*Returns*: The pathname in the generic format[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14777)
|
||||
|
||||
*Remarks*: Conversion, if any, is specified by [[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions")[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:generic_display_string,path)
|
||||
|
||||
`std::string generic_display_string() const;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14788)
|
||||
|
||||
*Returns*: format("{:g}", *this)[.](#7.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The returned string is suitable for use with formatting ([[format.functions]](format.functions "28.5.5 Formatting functions"))
|
||||
and print functions ([[print.fun]](print.fun "31.7.10 Print functions"))[.](#7.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
20
cppdraft/fs/path/hash.md
Normal file
20
cppdraft/fs/path/hash.md
Normal file
@@ -0,0 +1,20 @@
|
||||
[fs.path.hash]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.hash)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.hash)
|
||||
|
||||
#### 31.12.6.10 Hash support [fs.path.hash]
|
||||
|
||||
[ð](#itemdecl:1)
|
||||
|
||||
`template<> struct hash<filesystem::path>;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15564)
|
||||
|
||||
For an object p of type filesystem::path,hash<filesystem::path>()(p) evaluates to the same result asfilesystem::hash_value(p)[.](#1.sentence-1)
|
||||
55
cppdraft/fs/path/io.md
Normal file
55
cppdraft/fs/path/io.md
Normal file
@@ -0,0 +1,55 @@
|
||||
[fs.path.io]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.io)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.io)
|
||||
|
||||
#### 31.12.6.7 Inserter and extractor [fs.path.io]
|
||||
|
||||
[ð](#lib:operator%3c%3c,path)
|
||||
|
||||
`template<class charT, class traits>
|
||||
friend basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os, const path& p);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15351)
|
||||
|
||||
*Effects*: Equivalent to os << quoted(p.string<charT, traits>())[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The quoted function is described in [[quoted.manip]](quoted.manip "31.7.9 Quoted manipulators")[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15358)
|
||||
|
||||
*Returns*: os[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:operator%3e%3e,path)
|
||||
|
||||
`template<class charT, class traits>
|
||||
friend basic_istream<charT, traits>&
|
||||
operator>>(basic_istream<charT, traits>& is, path& p);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15371)
|
||||
|
||||
*Effects*: Equivalent to:basic_string<charT, traits> tmp;
|
||||
is >> quoted(tmp);
|
||||
p = tmp;
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15380)
|
||||
|
||||
*Returns*: is[.](#4.sentence-1)
|
||||
92
cppdraft/fs/path/itr.md
Normal file
92
cppdraft/fs/path/itr.md
Normal file
@@ -0,0 +1,92 @@
|
||||
[fs.path.itr]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.itr)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.itr)
|
||||
|
||||
#### 31.12.6.6 Iterators [fs.path.itr]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15281)
|
||||
|
||||
Path iterators iterate over the elements of the pathname
|
||||
in the [generic format](fs.path.generic "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15285)
|
||||
|
||||
A path::iterator is a constant iterator meeting all the
|
||||
requirements of a [bidirectional iterator](bidirectional.iterators "24.3.5.6 Bidirectional iterators [bidirectional.iterators]") except that,
|
||||
for dereferenceable iterators a and b of type path::iterator with a == b,
|
||||
there is no requirement that *a and *b are bound to the same object[.](#2.sentence-1)
|
||||
|
||||
Its value_type is path[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15296)
|
||||
|
||||
Calling any non-const member function of a path object
|
||||
invalidates all iterators referring to elements of that object[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15300)
|
||||
|
||||
For the elements of the pathname in the generic format,
|
||||
the forward traversal order is as follows:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
The [*root-name*](fs.path.generic#nt:root-name "31.12.6.2 Generic pathname format [fs.path.generic]") element, if present[.](#4.1.sentence-1)
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
The [*root-directory*](fs.path.generic#nt:root-directory "31.12.6.2 Generic pathname format [fs.path.generic]") element, if present[.](#4.2.sentence-1)
|
||||
[*Note [1](#note-1)*:
|
||||
It is possible that the use of the generic format is needed
|
||||
to ensure correct lexicographical comparison[.](#4.2.sentence-2)
|
||||
â *end note*]
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
Each successive [*filename*](fs.path.generic#nt:filename "31.12.6.2 Generic pathname format [fs.path.generic]") element, if present[.](#4.3.sentence-1)
|
||||
|
||||
- [(4.4)](#4.4)
|
||||
|
||||
An empty element, if a trailing non-root [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") is present[.](#4.4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15315)
|
||||
|
||||
The backward traversal order is the reverse of forward traversal[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:begin,path)
|
||||
|
||||
`iterator begin() const;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15324)
|
||||
|
||||
*Returns*: An iterator for the first present element in the traversal
|
||||
list above[.](#6.sentence-1)
|
||||
|
||||
If no elements are present, the end iterator[.](#6.sentence-2)
|
||||
|
||||
[ð](#lib:end,path)
|
||||
|
||||
`iterator end() const;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15336)
|
||||
|
||||
*Returns*: The end iterator[.](#7.sentence-1)
|
||||
1240
cppdraft/fs/path/member.md
Normal file
1240
cppdraft/fs/path/member.md
Normal file
File diff suppressed because it is too large
Load Diff
158
cppdraft/fs/path/modifiers.md
Normal file
158
cppdraft/fs/path/modifiers.md
Normal file
@@ -0,0 +1,158 @@
|
||||
[fs.path.modifiers]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.modifiers)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.modifiers)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.modifiers)
|
||||
|
||||
#### 31.12.6.5.5 Modifiers [fs.path.modifiers]
|
||||
|
||||
[ð](#lib:clear,path)
|
||||
|
||||
`void clear() noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14490)
|
||||
|
||||
*Postconditions*: empty() is true[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:make_preferred,path)
|
||||
|
||||
`path& make_preferred();
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14501)
|
||||
|
||||
*Effects*: Each [*directory-separator*](fs.path.generic#nt:directory-separator "31.12.6.2 Generic pathname format [fs.path.generic]") of the pathname in the generic format
|
||||
is converted to [*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]")[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14507)
|
||||
|
||||
*Returns*: *this[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14511)
|
||||
|
||||
[*Example [1](#example-1)*: path p("foo/bar");
|
||||
std::cout << p << '\n';
|
||||
p.make_preferred();
|
||||
std::cout << p << '\n';
|
||||
|
||||
On an operating system where [*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]") is a slash,
|
||||
the output is:"foo/bar""foo/bar"
|
||||
|
||||
On an operating system where [*preferred-separator*](fs.path.generic#nt:preferred-separator "31.12.6.2 Generic pathname format [fs.path.generic]") is a backslash, the
|
||||
output is:"foo/bar""foo\bar"
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:remove_filename,path)
|
||||
|
||||
`path& remove_filename();
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14540)
|
||||
|
||||
*Effects*: Remove the generic format pathname of filename() from the generic format pathname[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14544)
|
||||
|
||||
*Postconditions*: !has_filename()[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14548)
|
||||
|
||||
*Returns*: *this[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14552)
|
||||
|
||||
[*Example [2](#example-2)*: path("foo/bar").remove_filename(); // yields "foo/" path("foo/").remove_filename(); // yields "foo/" path("/foo").remove_filename(); // yields "/" path("/").remove_filename(); // yields "/" â *end example*]
|
||||
|
||||
[ð](#lib:replace_filename,path)
|
||||
|
||||
`path& replace_filename(const path& replacement);
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14569)
|
||||
|
||||
*Effects*: Equivalent to:remove_filename();operator/=(replacement);
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14577)
|
||||
|
||||
*Returns*: *this[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14581)
|
||||
|
||||
[*Example [3](#example-3)*: path("/foo").replace_filename("bar"); // yields "/bar" on POSIX path("/").replace_filename("bar"); // yields "/bar" on POSIX â *end example*]
|
||||
|
||||
[ð](#lib:replace_extension,path)
|
||||
|
||||
`path& replace_extension(const path& replacement = path());
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14596)
|
||||
|
||||
*Effects*:
|
||||
|
||||
- [(12.1)](#12.1)
|
||||
|
||||
Any existing extension() ([[fs.path.decompose]](fs.path.decompose "31.12.6.5.9 Decomposition")) is removed from the
|
||||
pathname in the generic format,
|
||||
then
|
||||
|
||||
- [(12.2)](#12.2)
|
||||
|
||||
If replacement is not empty and does not begin with a dot
|
||||
character, a dot character is appended to the pathname in the generic format, then
|
||||
|
||||
- [(12.3)](#12.3)
|
||||
|
||||
operator+=(replacement);[.](#12.sentence-1)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14608)
|
||||
|
||||
*Returns*: *this[.](#13.sentence-1)
|
||||
|
||||
[ð](#lib:swap,path)
|
||||
|
||||
`void swap(path& rhs) noexcept;
|
||||
`
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14619)
|
||||
|
||||
*Effects*: Swaps the contents (in all formats) of the two paths[.](#14.sentence-1)
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14623)
|
||||
|
||||
*Complexity*: Constant time[.](#15.sentence-1)
|
||||
111
cppdraft/fs/path/native/obs.md
Normal file
111
cppdraft/fs/path/native/obs.md
Normal file
@@ -0,0 +1,111 @@
|
||||
[fs.path.native.obs]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.native.obs)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.native.obs)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.native.obs)
|
||||
|
||||
#### 31.12.6.5.6 Native format observers [fs.path.native.obs]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14630)
|
||||
|
||||
The string returned by all native format observers is in the native pathname format ([[fs.class.path]](fs.class.path "31.12.6 Class path"))[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:native,path)
|
||||
|
||||
`const string_type& native() const noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14639)
|
||||
|
||||
*Returns*: The pathname in the native format[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:c_str,path)
|
||||
|
||||
`const value_type* c_str() const noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14650)
|
||||
|
||||
*Effects*: Equivalent to: return native().c_str();
|
||||
|
||||
[ð](#lib:operator_string_type,path)
|
||||
|
||||
`operator string_type() const;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14661)
|
||||
|
||||
*Returns*: native()[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:string,path)
|
||||
|
||||
`template<class EcharT, class traits = char_traits<EcharT>, class Allocator = allocator<EcharT>>
|
||||
basic_string<EcharT, traits, Allocator> string(const Allocator& a = Allocator()) const;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14673)
|
||||
|
||||
*Returns*: native()[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14677)
|
||||
|
||||
*Remarks*: All memory allocation, including for the return value, shall
|
||||
be performed by a[.](#6.sentence-1)
|
||||
|
||||
Conversion, if any, is specified by[[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions")[.](#6.sentence-2)
|
||||
|
||||
[ð](#lib:system_encoded_string,path)
|
||||
|
||||
`std::string system_encoded_string() const;
|
||||
std::wstring wstring() const;
|
||||
std::u8string u8string() const;
|
||||
std::u16string u16string() const;
|
||||
std::u32string u32string() const;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14698)
|
||||
|
||||
*Returns*: native()[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14702)
|
||||
|
||||
*Remarks*: Conversion, if any, is performed as specified
|
||||
by [[fs.path.cvt]](fs.path.cvt "31.12.6.3 Conversions")[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:display_string,path)
|
||||
|
||||
`std::string display_string() const;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14714)
|
||||
|
||||
*Returns*: format("{}", *this)[.](#9.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
The returned string is suitable for use with formatting ([[format.functions]](format.functions "28.5.5 Formatting functions"))
|
||||
and print functions ([[print.fun]](print.fun "31.7.10 Print functions"))[.](#9.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
93
cppdraft/fs/path/nonmember.md
Normal file
93
cppdraft/fs/path/nonmember.md
Normal file
@@ -0,0 +1,93 @@
|
||||
[fs.path.nonmember]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.nonmember)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.nonmember)
|
||||
|
||||
#### 31.12.6.8 Non-member functions [fs.path.nonmember]
|
||||
|
||||
[ð](#lib:swap,path)
|
||||
|
||||
`void swap(path& lhs, path& rhs) noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15393)
|
||||
|
||||
*Effects*: Equivalent to lhs.swap(rhs)[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:hash_value,path)
|
||||
|
||||
`size_t hash_value(const path& p) noexcept;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15404)
|
||||
|
||||
*Returns*: A hash value for the path p[.](#2.sentence-1)
|
||||
|
||||
If
|
||||
for two paths, p1 == p2 then hash_value(p1) == hash_value(p2)[.](#2.sentence-2)
|
||||
|
||||
[ð](#lib:operator==,path)
|
||||
|
||||
`friend bool operator==(const path& lhs, const path& rhs) noexcept;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15416)
|
||||
|
||||
*Returns*: lhs.compare(rhs) == 0[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15421)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Path equality and path equivalence have different semantics[.](#4.sentence-1)
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
Equality is determined by the path non-member operator==,
|
||||
which considers the two paths' lexical representations only[.](#4.1.sentence-1)
|
||||
[*Example [1](#example-1)*:
|
||||
path("foo") == "bar" is never true[.](#4.1.sentence-2)
|
||||
â *end example*]
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
Equivalence is determined by the equivalent() non-member function, which
|
||||
determines if two paths resolve ([[fs.class.path]](fs.class.path "31.12.6 Class path")) to the same file system entity[.](#4.2.sentence-1)
|
||||
[*Example [2](#example-2)*:
|
||||
equivalent("foo", "bar") will be true when both paths resolve to the same file[.](#4.2.sentence-2)
|
||||
â *end example*]
|
||||
|
||||
â *end note*]
|
||||
|
||||
[ð](#lib:operator%3c=%3e,path)
|
||||
|
||||
`friend strong_ordering operator<=>(const path& lhs, const path& rhs) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15445)
|
||||
|
||||
*Returns*: lhs.compare(rhs) <=> 0[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:operator/,path)
|
||||
|
||||
`friend path operator/(const path& lhs, const path& rhs);
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15456)
|
||||
|
||||
*Effects*: Equivalent to: return path(lhs) /= rhs;
|
||||
144
cppdraft/fs/path/query.md
Normal file
144
cppdraft/fs/path/query.md
Normal file
@@ -0,0 +1,144 @@
|
||||
[fs.path.query]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.query)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.query)
|
||||
|
||||
#### 31.12.6.5 Members [[fs.path.member]](fs.path.member#fs.path.query)
|
||||
|
||||
#### 31.12.6.5.10 Query [fs.path.query]
|
||||
|
||||
[ð](#lib:empty,path)
|
||||
|
||||
`bool empty() const noexcept;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15013)
|
||||
|
||||
*Returns*: true if the pathname in the generic format is empty, otherwise false[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:has_root_path,path)
|
||||
|
||||
`bool has_root_path() const;
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15024)
|
||||
|
||||
*Returns*: !root_path().empty()[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:has_root_name,path)
|
||||
|
||||
`bool has_root_name() const;
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15035)
|
||||
|
||||
*Returns*: !root_name().empty()[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:has_root_directory,path)
|
||||
|
||||
`bool has_root_directory() const;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15046)
|
||||
|
||||
*Returns*: !root_directory().empty()[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:has_relative_path,path)
|
||||
|
||||
`bool has_relative_path() const;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15057)
|
||||
|
||||
*Returns*: !relative_path().empty()[.](#5.sentence-1)
|
||||
|
||||
[ð](#lib:has_parent_path,path)
|
||||
|
||||
`bool has_parent_path() const;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15068)
|
||||
|
||||
*Returns*: !parent_path().empty()[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:has_filename,path)
|
||||
|
||||
`bool has_filename() const;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15079)
|
||||
|
||||
*Returns*: !filename().empty()[.](#7.sentence-1)
|
||||
|
||||
[ð](#lib:has_stem,path)
|
||||
|
||||
`bool has_stem() const;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15090)
|
||||
|
||||
*Returns*: !stem().empty()[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:has_extension,path)
|
||||
|
||||
`bool has_extension() const;
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15101)
|
||||
|
||||
*Returns*: !extension().empty()[.](#9.sentence-1)
|
||||
|
||||
[ð](#lib:is_absolute,path)
|
||||
|
||||
`bool is_absolute() const;
|
||||
`
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15112)
|
||||
|
||||
*Returns*: true if the pathname in the native format
|
||||
contains an absolute path ([[fs.class.path]](fs.class.path "31.12.6 Class path")), otherwise false[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15117)
|
||||
|
||||
[*Example [1](#example-1)*:
|
||||
|
||||
path("/").is_absolute() is true for POSIX-based operating systems, and false for Windows-based
|
||||
operating systems[.](#11.sentence-1)
|
||||
|
||||
â *end example*]
|
||||
|
||||
[ð](#lib:is_relative,path)
|
||||
|
||||
`bool is_relative() const;
|
||||
`
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L15131)
|
||||
|
||||
*Returns*: !is_absolute()[.](#12.sentence-1)
|
||||
79
cppdraft/fs/path/req.md
Normal file
79
cppdraft/fs/path/req.md
Normal file
@@ -0,0 +1,79 @@
|
||||
[fs.path.req]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.12 File systems [[filesystems]](filesystems#fs.path.req)
|
||||
|
||||
### 31.12.6 Class path [[fs.class.path]](fs.class.path#fs.path.req)
|
||||
|
||||
#### 31.12.6.4 Requirements [fs.path.req]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14074)
|
||||
|
||||
In addition to the requirements ([[fs.req]](fs.req "31.12.3 Requirements")),
|
||||
function template parameters named Source shall be one of:
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
basic_string<EcharT, traits, Allocator>[.](#1.1.sentence-1)
|
||||
A function
|
||||
argument const Source& source shall have an
|
||||
effective range [source.begin(), source.end())[.](#1.1.sentence-2)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
basic_string_view<EcharT, traits>[.](#1.2.sentence-1)
|
||||
A function
|
||||
argument const Source& source shall have an
|
||||
effective range [source.begin(), source.end())[.](#1.2.sentence-2)
|
||||
|
||||
- [(1.3)](#1.3)
|
||||
|
||||
A type meeting the [*Cpp17InputIterator*](input.iterators#:Cpp17InputIterator "24.3.5.3 Input iterators [input.iterators]") requirements that iterates over an NTCTS[.](#1.3.sentence-1)
|
||||
The value type shall be an encoded character type[.](#1.3.sentence-2)
|
||||
A function argument const Source& source shall have an effective range
|
||||
[source, end) where end is the first
|
||||
iterator value with an element value equal to iterator_traits<Source>::value_type()[.](#1.3.sentence-3)
|
||||
|
||||
- [(1.4)](#1.4)
|
||||
|
||||
A character array that after array-to-pointer decay results in a
|
||||
pointer to the start of an NTCTS[.](#1.4.sentence-1)
|
||||
The value type shall be an encoded character type[.](#1.4.sentence-2)
|
||||
A
|
||||
function argument const Source& source shall
|
||||
have an effective range [source, end) where end is the first iterator value with an element value equal to iterator_traits<decay_t<Source>>::value_type()[.](#1.4.sentence-3)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14099)
|
||||
|
||||
Functions taking template parameters named Source shall not participate in overload resolution unlessSource denotes a type other than path, and
|
||||
either
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
Source is a specialization ofbasic_string or basic_string_view, or
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
the [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") iterator_traits<decay_t<Source>>::value_type is valid and
|
||||
denotes a possibly const encoded character type ([[temp.deduct]](temp.deduct "13.10.3 Template argument deduction"))[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14113)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
See [path conversions](fs.path.cvt "31.12.6.3 Conversions [fs.path.cvt]") for how the value types above and their encodings convert topath::value_type and its encoding[.](#3.sentence-1)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L14120)
|
||||
|
||||
Arguments of type Source shall not be null pointers[.](#4.sentence-1)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user