3 This file is part of libmspfs
4 Copyright © 2006-2008 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
37 Iterator(const Path &);
39 Iterator &operator++();
40 Iterator &operator--();
41 std::string operator*() const;
42 bool operator==(const Iterator &i) const { return (start==i.start && end==i.end); }
43 bool operator!=(const Iterator &i) const { return !(*this==i); }
51 Path(const std::string &);
54 const std::string &str() const { return path; }
56 /// Returns the number of components in the path.
57 unsigned size() const;
59 bool empty() const { return path.empty(); }
61 /// Determines whether the path starts from the root directory
62 bool is_absolute() const;
64 /// Extracts a range of components from the path.
65 Path subpath(unsigned start, unsigned count=static_cast<unsigned>(-1)) const;
67 /// Concatenates this path with another one, with usual filesystem semantics
68 Path operator/(const Path &p) const;
69 Path &operator/=(const Path &);
72 Extracts a single component from the path. Negative indices count from the
75 std::string operator[](int) const;
77 bool operator==(const Path &) const;
78 Iterator begin() const;
81 void init(const std::string &);
82 void add_component(const std::string &);
85 inline std::ostream &operator<<(std::ostream &o, const Path &p) { o<<p.str(); return o; }