This class is used internally by DirectoryList to store single path in format of pre-parsed elements of that path & perform basic operations with this path representation. Because of it's internal nature it has only internally required subset of possible operators.
| 37 | // internally required subset of possible operators. |
| 38 | // |
| 39 | class ParsedPath : public ObjectsArray<PathName> |
| 40 | { |
| 41 | typedef ObjectsArray<PathName> inherited; |
| 42 | public: |
| 43 | explicit ParsedPath(MemoryPool& p) : ObjectsArray<PathName>(p) { } |
| 44 | ParsedPath(MemoryPool& p, const PathName& path) |
| 45 | : ObjectsArray<PathName>(p) |
| 46 | { |
| 47 | parse(path); |
| 48 | } |
| 49 | ParsedPath() : ObjectsArray<PathName>() { } |
| 50 | explicit ParsedPath(const PathName& path) |
| 51 | : ObjectsArray<PathName>() |
| 52 | { |
| 53 | parse(path); |
| 54 | } |
| 55 | // Take new path inside |
| 56 | void parse(const PathName& path); |
| 57 | // Convert internal representation to traditional one |
| 58 | operator PathName() const; |
| 59 | // Compare with path given by constant |
| 60 | bool operator==(const char* path) const |
| 61 | { |
| 62 | return this->operator PathName() == path; |
| 63 | } |
| 64 | // Check, whether pPath lies inside directory tree, |
| 65 | // specified by *this ParsedPath. Also checks against |
| 66 | // possible symbolic links. |
| 67 | bool contains(const ParsedPath& pPath) const; |
| 68 | // Returns path, containing elements from 0 to n-1 |
| 69 | PathName subPath(FB_SIZE_T n) const; |
| 70 | }; |
| 71 | |
| 72 | |
| 73 | class DirectoryList : public ObjectsArray<ParsedPath> |