| 48 | /// \param file_type The data type which represents a file. |
| 49 | template<typename RecordType> |
| 50 | class GenericFileSystem |
| 51 | { |
| 52 | class Path |
| 53 | { |
| 54 | private: |
| 55 | std::string _path; |
| 56 | unsigned int _depth; |
| 57 | public: |
| 58 | Path(const std::string& path) : |
| 59 | _path(path), |
| 60 | _depth(getPathDepth(_path.c_str())) |
| 61 | {} |
| 62 | |
| 63 | Path(const char* start, std::size_t length) : |
| 64 | Path(std::string(start, length)) |
| 65 | {} |
| 66 | |
| 67 | bool operator<(const Path& other) const |
| 68 | { |
| 69 | return string_less_nocase(c_str(), other.c_str()); |
| 70 | } |
| 71 | |
| 72 | unsigned int depth() const |
| 73 | { |
| 74 | return _depth; |
| 75 | } |
| 76 | |
| 77 | const char* c_str() const |
| 78 | { |
| 79 | return _path.c_str(); |
| 80 | } |
| 81 | |
| 82 | const std::string& string() const |
| 83 | { |
| 84 | return _path; |
| 85 | } |
| 86 | }; |
| 87 | |
| 88 | public: |
| 89 | class Entry |
| 90 | { |
| 91 | std::shared_ptr<RecordType> _record; |
| 92 | public: |
| 93 | Entry() |
| 94 | {} |
| 95 | |
| 96 | Entry(const std::shared_ptr<RecordType>& record) : |
| 97 | _record(record) |
| 98 | {} |
| 99 | |
| 100 | std::shared_ptr<RecordType>& getRecord() |
| 101 | { |
| 102 | return _record; |
| 103 | } |
| 104 | |
| 105 | bool isDirectory() const |
| 106 | { |
| 107 | return !_record; |
nothing calls this directly
no test coverage detected