From Jason Turner

[fs.path.decompose]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpnsewauyy/{from.md → to.md} +110 -0
tmp/tmpnsewauyy/{from.md → to.md} RENAMED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### `path` decomposition <a id="fs.path.decompose">[[fs.path.decompose]]</a>
2
+
3
+ ``` cpp
4
+ path root_name() const;
5
+ ```
6
+
7
+ *Returns:* *root-name*, if the pathname in the generic format includes
8
+ *root-name*, otherwise `path()`.
9
+
10
+ ``` cpp
11
+ path root_directory() const;
12
+ ```
13
+
14
+ *Returns:* *root-directory*, if the pathname in the generic format
15
+ includes *root-directory*, otherwise `path()`.
16
+
17
+ ``` cpp
18
+ path root_path() const;
19
+ ```
20
+
21
+ *Returns:* `root_name() / root_directory()`.
22
+
23
+ ``` cpp
24
+ path relative_path() const;
25
+ ```
26
+
27
+ *Returns:* A `path` composed from the pathname in the generic format, if
28
+ `!empty()`, beginning with the first *filename* after *root-path*.
29
+ Otherwise, `path()`.
30
+
31
+ ``` cpp
32
+ path parent_path() const;
33
+ ```
34
+
35
+ *Returns:* `*this` if `!has_relative_path()`, otherwise a path whose
36
+ generic format pathname is the longest prefix of the generic format
37
+ pathname of `*this` that produces one fewer element in its iteration.
38
+
39
+ ``` cpp
40
+ path filename() const;
41
+ ```
42
+
43
+ *Returns:* `relative_path().empty() ? path() : *–end()`.
44
+
45
+ [*Example 6*:
46
+
47
+ ``` cpp
48
+ path("/foo/bar.txt").filename(); // yields "bar.txt"
49
+ path("/foo/bar").filename(); // yields "bar"
50
+ path("/foo/bar/").filename(); // yields ""
51
+ path("/").filename(); // yields ""
52
+ path("//host").filename(); // yields ""
53
+ path(".").filename(); // yields "."
54
+ path("..").filename(); // yields ".."
55
+ ```
56
+
57
+ — *end example*]
58
+
59
+ ``` cpp
60
+ path stem() const;
61
+ ```
62
+
63
+ *Returns:* Let `f` be the generic format pathname of `filename()`.
64
+ Returns a path whose pathname in the generic format is
65
+
66
+ - `f`, if it contains no periods other than a leading period or consists
67
+ solely of one or two periods;
68
+ - otherwise, the prefix of `f` ending before its last period.
69
+
70
+ [*Example 7*:
71
+
72
+ ``` cpp
73
+ std::cout << path("/foo/bar.txt").stem(); // outputs "bar"
74
+ path p = "foo.bar.baz.tar";
75
+ for (; !p.extension().empty(); p = p.stem())
76
+ std::cout << p.extension() << '\n';
77
+ // outputs: .tar
78
+ // .baz
79
+ // .bar
80
+ ```
81
+
82
+ — *end example*]
83
+
84
+ ``` cpp
85
+ path extension() const;
86
+ ```
87
+
88
+ *Returns:* a path whose pathname in the generic format is the suffix of
89
+ `filename()` not included in `stem()`.
90
+
91
+ [*Example 8*:
92
+
93
+ ``` cpp
94
+ path("/foo/bar.txt").extension(); // yields ".txt" and stem() is "bar"
95
+ path("/foo/bar").extension(); // yields "" and stem() is "bar"
96
+ path("/foo/.profile").extension(); // yields "" and stem() is ".profile"
97
+ path(".bar").extension(); // yields "" and stem() is ".bar"
98
+ path("..bar").extension(); // yields ".bar" and stem() is "."
99
+ ```
100
+
101
+ — *end example*]
102
+
103
+ [*Note 4*: The period is included in the return value so that it is
104
+ possible to distinguish between no extension and an empty
105
+ extension. — *end note*]
106
+
107
+ [*Note 5*: On non-POSIX operating systems, for a path `p`, it may not
108
+ be the case that `p.stem() + p.extension() == p.filename()`, even though
109
+ the generic format pathnames are the same. — *end note*]
110
+