File: pathmembers.yo

package info (click to toggle)
c%2B%2B-annotations 12.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,044 kB
  • sloc: cpp: 24,337; makefile: 1,517; ansic: 165; sh: 121; perl: 90
file content (133 lines) | stat: -rw-r--r-- 6,399 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
    The class tt(path) provides the following operators and members:
    
    bf(Operators:)
    itemization(
    itt(path &operator/=(Type const &arg)):nl()
       the arguments that can be passed to the constructors can also be passed
        to this member. The tt(arg) argument is separated from the path's
        current content by a directory separator (unless the path is initially
        empty as in tt(cout << path{}.append("entry"))). See also the members
        tt(append) and tt(concat), below. The free operator tt(/) accepts two
        tt(path) (promotable) arguments, returning a tt(path) containing both
        paths separated by a directory separator (e.g., tt(lhs / rhs) returns
        a tt(path) object containing tt(lhs/rhs));

    itt(path &operator+=(Type const &arg)):nl()
       similar to tt(/=), but em(no) directory separator is used when
        adding tt(arg) to the current tt(path);

    it() comparison operators: tt(path) objects can be compared using the
        (operators implied by the) tt(==) and tt(<=>) operators. Path objects
        are compared by lexicographical comparing their ascii-character
        content.
    )

    bf(Accessors:) 

    Accessors return specific tt(path) components. If a path doesn't contain
    the requested component then an empty tt(path) is returned.
    itemization(
    itt(char const *c_str()): the path's content as an NTBS is returned; 

    itt(path extension()) returns the dot-extension of the path's last
        component (including the dot);

    itt(path filename()) returns the last path-content of the current tt(path)
        object. See also the tt(stem()) accessor, below;

    itt(bool is_absolute()): returns tt(true) if the tt(path) object contains
        an absolute path specification;

    itt(bool is_relative()): returns tt(true) if the tt(path) object contains
        a relative path specification;

    itt(path parent_path()) returns the current path-content from which the
        last element has been removed. Note that if the tt(path) object
        contains a filename's path (like tt("/usr/bin/zip")) then
        tt(parent_path) removes tt(/zip) and returns tt(/usr/bin), so not
        tt(zip's) parent directory, but its actual directory;

    itt(path relative_path()): returns the path's content beyond
        the path's root-directory component of the tt(path) object. E.g., if
        the tt(path ulb{ "/usr/local/bin" }) is defined then
        tt(ulb.relative_path()) returns a path containing tt("usr/local/bin");

    itt(path relative_path()): returns the path's content beyond
        the path's root-directory component of the tt(path) object. E.g., if
        the tt(path ulb{ "/usr/local/bin" }) is defined then
        tt(ulb.relative_path()) returns a path containing tt("usr/local/bin");

    itt(path root_directory()): returns the root-directory component of the
        tt(path) object;

    itt(path root_name()): returns the root-name's component of the tt(path)
        object;

    itt(path root_path()): returns the root-path component of the tt(path)
        object;

    itt(path stem()) returns the last path-content of the current tt(path)
        object from which the dot-extension hash been removed;

    itt(string()): returns the path's content as a tt(std::string).nl()
       Similar accessors are available for the following string-types:
        tt(wstring, u8string, u16string, , u32string, generic_string,
        generic_wstring, generic_u8string, generic_u16string,) and
        tt(generic_u32string);
    )

    Except for the family of tt(string()) and the tt(is_...) accessors, there
    are also tt(bool has_...) members returning tt(true) if the tt(path)
    contains the specified component (e.g., tt(has_extension) returns tt(true)
    if the tt(path) contains an extension).

    bf(Member functions:)
    itemization(
    itt(path &append(Type const &arg)) acts like the tt(/=) operator;
        
    itt(path::iterator begin()) returns an iterator containing the first path
        component; Dereferencing a tt(path::iterator) returns a tt(path)
        object.nl()
       When available root names and root directories are returned as initial
        components. When incrementing tt(path::iterators) the individual
        directories and finally filename components are returned. The
        directory separators themselves are not returned when dereferencing
        subsequent tt(path::iterators);

    itt(void clear()): the tt(path's) content is erased;

    itt(int compare(Type const &other)):nl()
       returns the result of lexicographically comparing the current path's
        content with tt(other). tt(Other) can be a tt(path), a string-type or
        an NTBS;

    itt(path &concat(Type const &arg)) acts like the tt(+=) operator;

    itt(ostream &operator<<(ostream &out, path const &path)) (stream
        insertion) inserts tt(path's) content, surrounded by double quotes,
        into tt(out);

    itt(istream &operator>>(istream &in, path &path)) extracts
        tt(path's) content from tt(in). The extracted path name may optionally
        be surrounded by double quotes. When inserting a previously extracted
        tt(path) object only one set of surrounding quotes are shown.

    itt(path &remove_filename()):nl()
       removes the last component of the stored path. If only a root-directory
        is stored, then the root directory is removed. Note that the last
        directory separator is kept, unless it is the only path element;

    itt(path &replace_extension(path const &replacement = path{} )):nl()
       replaces the extension of the last component of the stored path
        (including the extension's dot) with tt(replacement). The extension is
        removed if tt(replacement) is empty. If the tt(path) calling
        tt(replace_extension) has no extension then tt(replacement) is added.
        The replacement may optionally start with a dot. The path object's
        extension receives only one dot;

    itt(path &replace_filename(path const &replacement)):nl()
       replaces the last component of the stored path with tt(replacement),
        which itself may contain multiple path elements.  If only a
        root-directory is stored, then it is replaced by tt(replacement). The
        member's behavior is undefined if the current path object is empty;
    )