* */
| 56 | * |
| 57 | */ |
| 58 | class ArchiveFileTreeImpl : public virtual ArchiveFileTree, |
| 59 | public virtual ArchiveFileEntry |
| 60 | { |
| 61 | public: |
| 62 | using File = std::tuple<QStringList, bool, int>; |
| 63 | |
| 64 | public |
| 65 | : // Public for make_shared (but not accessible by other since not exposed in .h): |
| 66 | ArchiveFileTreeImpl(std::shared_ptr<const IFileTree> parent, QString name, int index, |
| 67 | std::vector<File> files) |
| 68 | : FileTreeEntry(parent, name), ArchiveFileEntry(parent, name, index), IFileTree(), |
| 69 | m_Files(std::move(files)) |
| 70 | {} |
| 71 | |
| 72 | public: // Override to avoid VS warnings: |
| 73 | virtual std::shared_ptr<IFileTree> astree() override { return IFileTree::astree(); } |
| 74 | |
| 75 | virtual std::shared_ptr<const IFileTree> astree() const override |
| 76 | { |
| 77 | return IFileTree::astree(); |
| 78 | } |
| 79 | |
| 80 | protected: |
| 81 | virtual std::shared_ptr<FileTreeEntry> clone() const override |
| 82 | { |
| 83 | return IFileTree::clone(); |
| 84 | } |
| 85 | |
| 86 | public: // Overrides: |
| 87 | /** |
| 88 | * |
| 89 | */ |
| 90 | static void mapToArchive(IFileTree const& tree, QString path, |
| 91 | std::vector<FileData*> const& data) |
| 92 | { |
| 93 | if (path.length() > 0) { |
| 94 | // when using a long windows path (starting with \\?\) we apparently can have |
| 95 | // redundant . components in the path. This wasn't a problem with "regular" path |
| 96 | // names. |
| 97 | if (path == ".") { |
| 98 | path.clear(); |
| 99 | } else { |
| 100 | path.append("\\"); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | for (auto const& entry : tree) { |
| 105 | if (entry->isDir()) { |
| 106 | const ArchiveFileTreeImpl& archiveEntry = |
| 107 | dynamic_cast<const ArchiveFileTreeImpl&>(*entry); |
| 108 | QString tmp = path + archiveEntry.name(); |
| 109 | if (archiveEntry.m_Index != -1) { |
| 110 | data[archiveEntry.m_Index]->addOutputFilePath(tmp.toStdWString()); |
| 111 | } |
| 112 | mapToArchive(*archiveEntry.astree(), tmp, data); |
| 113 | } else { |
| 114 | const ArchiveFileEntry& archiveFileEntry = |
| 115 | dynamic_cast<const ArchiveFileEntry&>(*entry); |
nothing calls this directly
no outgoing calls
no test coverage detected