20 Stores a filesystem path. Paths are always stored in a normalized form; there
21 are never any "." or ".." components in the middle of the path, and relative
22 paths always begin with a single "." component or a sequence ".." components.
33 std::string::size_type start,end;
35 Iterator(const Path &);
37 Iterator &operator++();
38 Iterator &operator--();
39 std::string operator*() const;
40 bool operator==(const Iterator &i) const { return (start==i.start && end==i.end); }
41 bool operator!=(const Iterator &i) const { return !(*this==i); }
49 Path(const std::string &);
52 const std::string &str() const { return path; }
54 /// Returns the number of components in the path.
55 unsigned size() const;
57 bool empty() const { return path.empty(); }
59 /// Determines whether the path starts from the root directory
60 bool is_absolute() const;
62 /// Extracts a range of components from the path.
63 Path subpath(unsigned start, unsigned count = static_cast<unsigned>(-1)) const;
65 /// Concatenates this path with another one, with usual filesystem semantics
66 Path operator/(const Path &p) const;
67 Path &operator/=(const Path &);
70 Extracts a single component from the path. Negative indices count from the
73 std::string operator[](int) const;
75 bool operator==(const Path &) const;
76 Iterator begin() const;
79 void init(const std::string &);
80 void add_component(const std::string &);
83 inline std::ostream &operator<<(std::ostream &o, const Path &p) { o<<p.str(); return o; }