tmp/tmpbaq6s1ca/{from.md → to.md}
RENAMED
|
@@ -226,12 +226,12 @@ template<class Source>
|
|
| 226 |
```
|
| 227 |
|
| 228 |
*Effects:* Appends `path(x).native()` to the pathname in the native
|
| 229 |
format.
|
| 230 |
|
| 231 |
-
[*Note 2*: This directly manipulates the value of `native()`
|
| 232 |
-
not
|
| 233 |
|
| 234 |
*Returns:* `*this`.
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
path& operator+=(value_type x);
|
|
@@ -380,14 +380,10 @@ const value_type* c_str() const noexcept;
|
|
| 380 |
operator string_type() const;
|
| 381 |
```
|
| 382 |
|
| 383 |
*Returns:* `native()`.
|
| 384 |
|
| 385 |
-
[*Note 3*: Conversion to `string_type` is provided so that an object of
|
| 386 |
-
class `path` can be given as an argument to existing standard library
|
| 387 |
-
file stream constructors and open functions. — *end note*]
|
| 388 |
-
|
| 389 |
``` cpp
|
| 390 |
template<class EcharT, class traits = char_traits<EcharT>,
|
| 391 |
class Allocator = allocator<EcharT>>
|
| 392 |
basic_string<EcharT, traits, Allocator>
|
| 393 |
string(const Allocator& a = Allocator()) const;
|
|
@@ -587,17 +583,17 @@ path(".bar").extension(); // yields "" and stem() is ".bar"
|
|
| 587 |
path("..bar").extension(); // yields ".bar" and stem() is "."
|
| 588 |
```
|
| 589 |
|
| 590 |
— *end example*]
|
| 591 |
|
| 592 |
-
[*Note
|
| 593 |
possible to distinguish between no extension and an empty
|
| 594 |
extension. — *end note*]
|
| 595 |
|
| 596 |
-
[*Note
|
| 597 |
-
|
| 598 |
-
the generic format pathnames are the same. — *end note*]
|
| 599 |
|
| 600 |
##### Query <a id="fs.path.query">[[fs.path.query]]</a>
|
| 601 |
|
| 602 |
``` cpp
|
| 603 |
[[nodiscard]] bool empty() const noexcept;
|
|
@@ -696,25 +692,21 @@ slashes, but that does not affect `path` equality.
|
|
| 696 |
|
| 697 |
``` cpp
|
| 698 |
path lexically_relative(const path& base) const;
|
| 699 |
```
|
| 700 |
|
| 701 |
-
*Returns:* `*this` made relative to `base`. Does not
|
| 702 |
-
resolve [[fs.class.path]] symlinks. Does not first
|
| 703 |
-
normalize [[fs.path.generic]] `*this` or `base`.
|
| 704 |
-
|
| 705 |
*Effects:* If:
|
| 706 |
|
| 707 |
- `root_name() != base.root_name()` is `true`, or
|
| 708 |
- `is_absolute() != base.is_absolute()` is `true`, or
|
| 709 |
- `!has_root_directory() && base.has_root_directory()` is `true`, or
|
| 710 |
- any *filename* in `relative_path()` or `base.relative_path()` can be
|
| 711 |
interpreted as a *root-name*,
|
| 712 |
|
| 713 |
returns `path()`.
|
| 714 |
|
| 715 |
-
[*Note
|
| 716 |
*relative-path* is acceptable as a *root-name*. — *end note*]
|
| 717 |
|
| 718 |
Determines the first mismatched element of `*this` and `base` as if by:
|
| 719 |
|
| 720 |
``` cpp
|
|
@@ -732,10 +724,14 @@ Then,
|
|
| 732 |
- returns an object of class `path` that is default-constructed,
|
| 733 |
followed by
|
| 734 |
- application of `operator/=(path(".."))` `n` times, and then
|
| 735 |
- application of `operator/=` for each element in \[`a`, `end()`).
|
| 736 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 737 |
[*Example 11*:
|
| 738 |
|
| 739 |
``` cpp
|
| 740 |
assert(path("/a/d").lexically_relative("/a/b/c") == "../../d");
|
| 741 |
assert(path("/a/b/c").lexically_relative("/a/d") == "../b/c");
|
|
@@ -749,26 +745,26 @@ The above assertions will succeed. On Windows, the returned path’s
|
|
| 749 |
*directory-separator* characters will be backslashes rather than
|
| 750 |
slashes, but that does not affect `path` equality.
|
| 751 |
|
| 752 |
— *end example*]
|
| 753 |
|
| 754 |
-
[*Note
|
| 755 |
operational function `relative()`. — *end note*]
|
| 756 |
|
| 757 |
-
[*Note
|
| 758 |
consistent matching of elements, apply `lexically_normal()` to `*this`,
|
| 759 |
`base`, or both. — *end note*]
|
| 760 |
|
| 761 |
``` cpp
|
| 762 |
path lexically_proximate(const path& base) const;
|
| 763 |
```
|
| 764 |
|
| 765 |
*Returns:* If the value of `lexically_relative(base)` is not an empty
|
| 766 |
path, return it. Otherwise return `*this`.
|
| 767 |
|
| 768 |
-
[*Note
|
| 769 |
operational function `proximate()`. — *end note*]
|
| 770 |
|
| 771 |
-
[*Note
|
| 772 |
consistent matching of elements, apply `lexically_normal()` to `*this`,
|
| 773 |
`base`, or both. — *end note*]
|
| 774 |
|
|
|
|
| 226 |
```
|
| 227 |
|
| 228 |
*Effects:* Appends `path(x).native()` to the pathname in the native
|
| 229 |
format.
|
| 230 |
|
| 231 |
+
[*Note 2*: This directly manipulates the value of `native()`, which is
|
| 232 |
+
not necessarily portable between operating systems. — *end note*]
|
| 233 |
|
| 234 |
*Returns:* `*this`.
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
path& operator+=(value_type x);
|
|
|
|
| 380 |
operator string_type() const;
|
| 381 |
```
|
| 382 |
|
| 383 |
*Returns:* `native()`.
|
| 384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
``` cpp
|
| 386 |
template<class EcharT, class traits = char_traits<EcharT>,
|
| 387 |
class Allocator = allocator<EcharT>>
|
| 388 |
basic_string<EcharT, traits, Allocator>
|
| 389 |
string(const Allocator& a = Allocator()) const;
|
|
|
|
| 583 |
path("..bar").extension(); // yields ".bar" and stem() is "."
|
| 584 |
```
|
| 585 |
|
| 586 |
— *end example*]
|
| 587 |
|
| 588 |
+
[*Note 3*: The period is included in the return value so that it is
|
| 589 |
possible to distinguish between no extension and an empty
|
| 590 |
extension. — *end note*]
|
| 591 |
|
| 592 |
+
[*Note 4*: On non-POSIX operating systems, for a path `p`, it is
|
| 593 |
+
possible that `p.stem() + p.extension() == p.filename()` is `false`,
|
| 594 |
+
even though the generic format pathnames are the same. — *end note*]
|
| 595 |
|
| 596 |
##### Query <a id="fs.path.query">[[fs.path.query]]</a>
|
| 597 |
|
| 598 |
``` cpp
|
| 599 |
[[nodiscard]] bool empty() const noexcept;
|
|
|
|
| 692 |
|
| 693 |
``` cpp
|
| 694 |
path lexically_relative(const path& base) const;
|
| 695 |
```
|
| 696 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 697 |
*Effects:* If:
|
| 698 |
|
| 699 |
- `root_name() != base.root_name()` is `true`, or
|
| 700 |
- `is_absolute() != base.is_absolute()` is `true`, or
|
| 701 |
- `!has_root_directory() && base.has_root_directory()` is `true`, or
|
| 702 |
- any *filename* in `relative_path()` or `base.relative_path()` can be
|
| 703 |
interpreted as a *root-name*,
|
| 704 |
|
| 705 |
returns `path()`.
|
| 706 |
|
| 707 |
+
[*Note 5*: On a POSIX implementation, no *filename* in a
|
| 708 |
*relative-path* is acceptable as a *root-name*. — *end note*]
|
| 709 |
|
| 710 |
Determines the first mismatched element of `*this` and `base` as if by:
|
| 711 |
|
| 712 |
``` cpp
|
|
|
|
| 724 |
- returns an object of class `path` that is default-constructed,
|
| 725 |
followed by
|
| 726 |
- application of `operator/=(path(".."))` `n` times, and then
|
| 727 |
- application of `operator/=` for each element in \[`a`, `end()`).
|
| 728 |
|
| 729 |
+
*Returns:* `*this` made relative to `base`. Does not
|
| 730 |
+
resolve [[fs.class.path]] symlinks. Does not first
|
| 731 |
+
normalize [[fs.path.generic]] `*this` or `base`.
|
| 732 |
+
|
| 733 |
[*Example 11*:
|
| 734 |
|
| 735 |
``` cpp
|
| 736 |
assert(path("/a/d").lexically_relative("/a/b/c") == "../../d");
|
| 737 |
assert(path("/a/b/c").lexically_relative("/a/d") == "../b/c");
|
|
|
|
| 745 |
*directory-separator* characters will be backslashes rather than
|
| 746 |
slashes, but that does not affect `path` equality.
|
| 747 |
|
| 748 |
— *end example*]
|
| 749 |
|
| 750 |
+
[*Note 6*: If symlink following semantics are desired, use the
|
| 751 |
operational function `relative()`. — *end note*]
|
| 752 |
|
| 753 |
+
[*Note 7*: If normalization [[fs.path.generic]] is needed to ensure
|
| 754 |
consistent matching of elements, apply `lexically_normal()` to `*this`,
|
| 755 |
`base`, or both. — *end note*]
|
| 756 |
|
| 757 |
``` cpp
|
| 758 |
path lexically_proximate(const path& base) const;
|
| 759 |
```
|
| 760 |
|
| 761 |
*Returns:* If the value of `lexically_relative(base)` is not an empty
|
| 762 |
path, return it. Otherwise return `*this`.
|
| 763 |
|
| 764 |
+
[*Note 8*: If symlink following semantics are desired, use the
|
| 765 |
operational function `proximate()`. — *end note*]
|
| 766 |
|
| 767 |
+
[*Note 9*: If normalization [[fs.path.generic]] is needed to ensure
|
| 768 |
consistent matching of elements, apply `lexically_normal()` to `*this`,
|
| 769 |
`base`, or both. — *end note*]
|
| 770 |
|