From Jason Turner

[fs.class.directory.entry]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp9rlv9ubr/{from.md → to.md} +9 -13
tmp/tmp9rlv9ubr/{from.md → to.md} RENAMED
@@ -65,12 +65,11 @@ namespace std::filesystem {
65
  template<class charT, class traits>
66
  friend basic_ostream<charT, traits>&
67
  operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
68
 
69
  private:
70
- filesystem::path pathobject; // exposition only
71
- friend class directory_iterator; // exposition only
72
  };
73
  }
74
  ```
75
 
76
  A `directory_entry` object stores a `path` object and may store
@@ -81,16 +80,13 @@ Implementations should store such additional file attributes during
81
  directory iteration if their values are available and storing the values
82
  would allow the implementation to eliminate file system accesses by
83
  `directory_entry` observer functions [[fs.op.funcs]]. Such stored file
84
  attribute values are said to be *cached*.
85
 
86
- [*Note 1*: For purposes of exposition, class `directory_iterator`
87
- [[fs.class.directory.iterator]] is shown above as a friend of class
88
- `directory_entry`. Friendship allows the `directory_iterator`
89
- implementation to cache already available attribute values directly into
90
- a `directory_entry` object without the cost of an unneeded call to
91
- `refresh()`. — *end note*]
92
 
93
  [*Example 1*:
94
 
95
  ``` cpp
96
  using namespace std::filesystem;
@@ -139,22 +135,22 @@ directory_entry(const filesystem::path& p, error_code& ec);
139
  ``` cpp
140
  void assign(const filesystem::path& p);
141
  void assign(const filesystem::path& p, error_code& ec);
142
  ```
143
 
144
- *Effects:* Equivalent to `pathobject = p`, then `refresh()` or
145
  `refresh(ec)`, respectively. If an error occurs, the values of any
146
  cached attributes are unspecified.
147
 
148
  *Throws:* As specified in  [[fs.err.report]].
149
 
150
  ``` cpp
151
  void replace_filename(const filesystem::path& p);
152
  void replace_filename(const filesystem::path& p, error_code& ec);
153
  ```
154
 
155
- *Effects:* Equivalent to `pathobject.replace_filename(p)`, then
156
  `refresh()` or `refresh(ec)`, respectively. If an error occurs, the
157
  values of any cached attributes are unspecified.
158
 
159
  *Throws:* As specified in  [[fs.err.report]].
160
 
@@ -184,11 +180,11 @@ Unqualified function names in the *Returns:* elements of the
184
  ``` cpp
185
  const filesystem::path& path() const noexcept;
186
  operator const filesystem::path&() const noexcept;
187
  ```
188
 
189
- *Returns:* `pathobject`.
190
 
191
  ``` cpp
192
  bool exists() const;
193
  bool exists(error_code& ec) const noexcept;
194
  ```
@@ -332,17 +328,17 @@ file_status symlink_status(error_code& ec) const noexcept;
332
 
333
  ``` cpp
334
  bool operator==(const directory_entry& rhs) const noexcept;
335
  ```
336
 
337
- *Returns:* `pathobject == rhs.pathobject`.
338
 
339
  ``` cpp
340
  strong_ordering operator<=>(const directory_entry& rhs) const noexcept;
341
  ```
342
 
343
- *Returns:* `pathobject <=> rhs.pathobject`.
344
 
345
  #### Inserter <a id="fs.dir.entry.io">[[fs.dir.entry.io]]</a>
346
 
347
  ``` cpp
348
  template<class charT, class traits>
 
65
  template<class charT, class traits>
66
  friend basic_ostream<charT, traits>&
67
  operator<<(basic_ostream<charT, traits>& os, const directory_entry& d);
68
 
69
  private:
70
+ filesystem::path path-object; // exposition only
 
71
  };
72
  }
73
  ```
74
 
75
  A `directory_entry` object stores a `path` object and may store
 
80
  directory iteration if their values are available and storing the values
81
  would allow the implementation to eliminate file system accesses by
82
  `directory_entry` observer functions [[fs.op.funcs]]. Such stored file
83
  attribute values are said to be *cached*.
84
 
85
+ [*Note 1*: `directory_iterator` can cache already available attribute
86
+ values directly into a `directory_entry` object without the cost of a
87
+ call to `refresh()`. *end note*]
 
 
 
88
 
89
  [*Example 1*:
90
 
91
  ``` cpp
92
  using namespace std::filesystem;
 
135
  ``` cpp
136
  void assign(const filesystem::path& p);
137
  void assign(const filesystem::path& p, error_code& ec);
138
  ```
139
 
140
+ *Effects:* Equivalent to *`path-object`*` = p`, then `refresh()` or
141
  `refresh(ec)`, respectively. If an error occurs, the values of any
142
  cached attributes are unspecified.
143
 
144
  *Throws:* As specified in  [[fs.err.report]].
145
 
146
  ``` cpp
147
  void replace_filename(const filesystem::path& p);
148
  void replace_filename(const filesystem::path& p, error_code& ec);
149
  ```
150
 
151
+ *Effects:* Equivalent to *`path-object`*`.replace_filename(p)`, then
152
  `refresh()` or `refresh(ec)`, respectively. If an error occurs, the
153
  values of any cached attributes are unspecified.
154
 
155
  *Throws:* As specified in  [[fs.err.report]].
156
 
 
180
  ``` cpp
181
  const filesystem::path& path() const noexcept;
182
  operator const filesystem::path&() const noexcept;
183
  ```
184
 
185
+ *Returns:* *path-object*.
186
 
187
  ``` cpp
188
  bool exists() const;
189
  bool exists(error_code& ec) const noexcept;
190
  ```
 
328
 
329
  ``` cpp
330
  bool operator==(const directory_entry& rhs) const noexcept;
331
  ```
332
 
333
+ *Returns:* *`path-object`*` == rhs.`*`path-object`*.
334
 
335
  ``` cpp
336
  strong_ordering operator<=>(const directory_entry& rhs) const noexcept;
337
  ```
338
 
339
+ *Returns:* *`path-object`*` <=> rhs.`*`path-object`*.
340
 
341
  #### Inserter <a id="fs.dir.entry.io">[[fs.dir.entry.io]]</a>
342
 
343
  ``` cpp
344
  template<class charT, class traits>