From Jason Turner

[fs.path.gen]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpw5c8nr2q/{from.md → to.md} +31 -20
tmp/tmpw5c8nr2q/{from.md → to.md} RENAMED
@@ -1,13 +1,13 @@
1
- ##### `path` generation <a id="fs.path.gen">[[fs.path.gen]]</a>
2
 
3
  ``` cpp
4
  path lexically_normal() const;
5
  ```
6
 
7
  *Returns:* A path whose pathname in the generic format is the normal
8
- form ([[fs.def.normal.form]]) of the pathname in the generic format of
9
  `*this`.
10
 
11
  [*Example 10*:
12
 
13
  ``` cpp
@@ -24,29 +24,40 @@ slashes, but that does not affect `path` equality.
24
  ``` cpp
25
  path lexically_relative(const path& base) const;
26
  ```
27
 
28
  *Returns:* `*this` made relative to `base`. Does not
29
- resolve ([[fs.def.pathres]]) symlinks. Does not first
30
- normalize ([[fs.def.normal.form]]) `*this` or `base`.
31
-
32
- *Effects:* If `root_name() != base.root_name()` is `true` or
33
- `is_absolute() != base.is_absolute()` is `true` or
34
- `!has_root_directory() && base.has_root_directory()` is `true`, returns
35
- `path()`. Determines the first mismatched element of `*this` and `base`
36
- as if by:
 
 
 
 
 
 
 
 
 
37
 
38
  ``` cpp
39
  auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
40
  ```
41
 
42
  Then,
43
 
44
  - if `a == end()` and `b == base.end()`, returns `path(".")`; otherwise
45
  - let `n` be the number of *filename* elements in \[`b`, `base.end()`)
46
- that are not *dot* or *dot-dot* minus the number that are *dot-dot*.
47
- If `n<0,` returns `path()`; otherwise
 
 
48
  - returns an object of class `path` that is default-constructed,
49
  followed by
50
  - application of `operator/=(path(".."))` `n` times, and then
51
  - application of `operator/=` for each element in \[`a`, `end()`).
52
 
@@ -65,26 +76,26 @@ The above assertions will succeed. On Windows, the returned path’s
65
  *directory-separator* characters will be backslashes rather than
66
  slashes, but that does not affect `path` equality.
67
 
68
  — *end example*]
69
 
70
- [*Note 6*: If symlink following semantics are desired, use the
71
  operational function `relative()`. — *end note*]
72
 
73
- [*Note 7*: If normalization ([[fs.def.normal.form]]) is needed to
74
- ensure consistent matching of elements, apply `lexically_normal()` to
75
- `*this`, `base`, or both. — *end note*]
76
 
77
  ``` cpp
78
  path lexically_proximate(const path& base) const;
79
  ```
80
 
81
  *Returns:* If the value of `lexically_relative(base)` is not an empty
82
  path, return it. Otherwise return `*this`.
83
 
84
- [*Note 8*: If symlink following semantics are desired, use the
85
  operational function `proximate()`. — *end note*]
86
 
87
- [*Note 9*: If normalization ([[fs.def.normal.form]]) is needed to
88
- ensure consistent matching of elements, apply `lexically_normal()` to
89
- `*this`, `base`, or both. — *end note*]
90
 
 
1
+ ##### Generation <a id="fs.path.gen">[[fs.path.gen]]</a>
2
 
3
  ``` cpp
4
  path lexically_normal() const;
5
  ```
6
 
7
  *Returns:* A path whose pathname in the generic format is the normal
8
+ form [[fs.path.generic]] of the pathname in the generic format of
9
  `*this`.
10
 
11
  [*Example 10*:
12
 
13
  ``` cpp
 
24
  ``` cpp
25
  path lexically_relative(const path& base) const;
26
  ```
27
 
28
  *Returns:* `*this` made relative to `base`. Does not
29
+ resolve [[fs.class.path]] symlinks. Does not first
30
+ normalize [[fs.path.generic]] `*this` or `base`.
31
+
32
+ *Effects:* If:
33
+
34
+ - `root_name() != base.root_name()` is `true`, or
35
+ - `is_absolute() != base.is_absolute()` is `true`, or
36
+ - `!has_root_directory() && base.has_root_directory()` is `true`, or
37
+ - any *filename* in `relative_path()` or `base.relative_path()` can be
38
+ interpreted as a *root-name*,
39
+
40
+ returns `path()`.
41
+
42
+ [*Note 6*: On a POSIX implementation, no *filename* in a
43
+ *relative-path* is acceptable as a *root-name*. — *end note*]
44
+
45
+ Determines the first mismatched element of `*this` and `base` as if by:
46
 
47
  ``` cpp
48
  auto [a, b] = mismatch(begin(), end(), base.begin(), base.end());
49
  ```
50
 
51
  Then,
52
 
53
  - if `a == end()` and `b == base.end()`, returns `path(".")`; otherwise
54
  - let `n` be the number of *filename* elements in \[`b`, `base.end()`)
55
+ that are not dot or dot-dot or empty, minus the number that are
56
+ dot-dot. If `n<0,` returns `path()`; otherwise
57
+ - if `n == 0` and `(a == end() || a->empty())`, returns `path(".")`;
58
+ otherwise
59
  - returns an object of class `path` that is default-constructed,
60
  followed by
61
  - application of `operator/=(path(".."))` `n` times, and then
62
  - application of `operator/=` for each element in \[`a`, `end()`).
63
 
 
76
  *directory-separator* characters will be backslashes rather than
77
  slashes, but that does not affect `path` equality.
78
 
79
  — *end example*]
80
 
81
+ [*Note 7*: If symlink following semantics are desired, use the
82
  operational function `relative()`. — *end note*]
83
 
84
+ [*Note 8*: If normalization [[fs.path.generic]] is needed to ensure
85
+ consistent matching of elements, apply `lexically_normal()` to `*this`,
86
+ `base`, or both. — *end note*]
87
 
88
  ``` cpp
89
  path lexically_proximate(const path& base) const;
90
  ```
91
 
92
  *Returns:* If the value of `lexically_relative(base)` is not an empty
93
  path, return it. Otherwise return `*this`.
94
 
95
+ [*Note 9*: If symlink following semantics are desired, use the
96
  operational function `proximate()`. — *end note*]
97
 
98
+ [*Note 10*: If normalization [[fs.path.generic]] is needed to ensure
99
+ consistent matching of elements, apply `lexically_normal()` to `*this`,
100
+ `base`, or both. — *end note*]
101