\brief Performs a depth-first traversal of the file-system subtree rooted at \p root. Traverses the entire tree if \p root is "". Calls \p visitor.file() with the path to each file relative to the filesystem root. Calls \p visitor.directory() with the path to each directory relative to the filesystem root.
| 165 | /// Calls \p visitor.file() with the path to each file relative to the filesystem root. |
| 166 | /// Calls \p visitor.directory() with the path to each directory relative to the filesystem root. |
| 167 | void traverse(IArchive::Visitor& visitor, const std::string& root, IArchiveFileInfoProvider& infoProvider) |
| 168 | { |
| 169 | unsigned int start_depth = getPathDepth(root.c_str()); |
| 170 | unsigned int skip_depth = 0; |
| 171 | |
| 172 | for (iterator i = begin(root); i != end() && i->first.depth() > start_depth; ++i) |
| 173 | { |
| 174 | if (i->first.depth() == skip_depth) |
| 175 | { |
| 176 | skip_depth = 0; |
| 177 | } |
| 178 | |
| 179 | if (skip_depth == 0) |
| 180 | { |
| 181 | if (!i->second.isDirectory()) |
| 182 | { |
| 183 | visitor.visitFile(i->first.string(), infoProvider); |
| 184 | } |
| 185 | else if (visitor.visitDirectory(i->first.string(), i->first.depth() - start_depth)) |
| 186 | { |
| 187 | skip_depth = i->first.depth(); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | private: |
| 194 | iterator begin(const std::string& root) |
nothing calls this directly
no test coverage detected