From d13f6bb870cdda71257f665367be8ef9fca86255 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Tue, 17 May 2022 11:47:01 +0200 Subject: Apply clang-format. --- src/qdirfiletree.cpp | 80 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 30 deletions(-) (limited to 'src/qdirfiletree.cpp') diff --git a/src/qdirfiletree.cpp b/src/qdirfiletree.cpp index 6fd370bf..f7bb11a7 100644 --- a/src/qdirfiletree.cpp +++ b/src/qdirfiletree.cpp @@ -4,31 +4,51 @@ using namespace MOBase; -class QDirFileTreeImpl : public QDirFileTree { +class QDirFileTreeImpl : public QDirFileTree +{ public: - - QDirFileTreeImpl(std::shared_ptr parent, QDir dir) : - FileTreeEntry(parent, dir.dirName()), QDirFileTree(), qDir(dir) { } + QDirFileTreeImpl(std::shared_ptr parent, QDir dir) + : FileTreeEntry(parent, dir.dirName()), QDirFileTree(), qDir(dir) + {} protected: - /** * No mutable operations allowed. */ - bool beforeReplace(IFileTree const* dstTree, FileTreeEntry const* destination, FileTreeEntry const* source) override { return false; } - bool beforeInsert(IFileTree const* entry, FileTreeEntry const* name) override { return false; } - bool beforeRemove(IFileTree const* entry, FileTreeEntry const* name) override { return false; } - std::shared_ptr makeFile(std::shared_ptr parent, QString name) const override { return nullptr; } - std::shared_ptr makeDirectory(std::shared_ptr parent, QString name) const override { return nullptr; } + bool beforeReplace(IFileTree const* dstTree, FileTreeEntry const* destination, + FileTreeEntry const* source) override + { + return false; + } + bool beforeInsert(IFileTree const* entry, FileTreeEntry const* name) override + { + return false; + } + bool beforeRemove(IFileTree const* entry, FileTreeEntry const* name) override + { + return false; + } + std::shared_ptr makeFile(std::shared_ptr parent, + QString name) const override + { + return nullptr; + } + std::shared_ptr makeDirectory(std::shared_ptr parent, + QString name) const override + { + return nullptr; + } - bool doPopulate(std::shared_ptr parent, std::vector>& entries) const override + bool doPopulate(std::shared_ptr parent, + std::vector>& entries) const override { - auto infoList = qDir.entryInfoList(qDir.filter() | QDir::NoDotAndDotDot, QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); + auto infoList = qDir.entryInfoList(qDir.filter() | QDir::NoDotAndDotDot, + QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); for (auto& info : infoList) { if (info.isDir()) { - entries.push_back(std::make_shared(parent, QDir(info.absoluteFilePath()))); - } - else { + entries.push_back( + std::make_shared(parent, QDir(info.absoluteFilePath()))); + } else { entries.push_back(createFileEntry(parent, info.fileName())); } } @@ -44,28 +64,29 @@ protected: protected: QDir qDir; - }; // subclass of QDirFileTreeImpl that ignores meta.ini // // only used for the root folder, subdirectories are actually QDirFileTreeImpl -class QDirRootFileTreeImpl : public QDirFileTreeImpl { +class QDirRootFileTreeImpl : public QDirFileTreeImpl +{ public: - - - QDirRootFileTreeImpl(QDir dir) : FileTreeEntry(nullptr, dir.dirName()), QDirFileTreeImpl(nullptr, dir) { } + QDirRootFileTreeImpl(QDir dir) + : FileTreeEntry(nullptr, dir.dirName()), QDirFileTreeImpl(nullptr, dir) + {} protected: - - bool doPopulate(std::shared_ptr parent, std::vector>& entries) const override + bool doPopulate(std::shared_ptr parent, + std::vector>& entries) const override { - auto infoList = qDir.entryInfoList(qDir.filter() | QDir::NoDotAndDotDot, QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); + auto infoList = qDir.entryInfoList(qDir.filter() | QDir::NoDotAndDotDot, + QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); for (auto& info : infoList) { if (info.isDir()) { - entries.push_back(std::make_shared(parent, QDir(info.absoluteFilePath()))); - } - else if (info.fileName().compare("meta.ini", Qt::CaseInsensitive) != 0) { + entries.push_back( + std::make_shared(parent, QDir(info.absoluteFilePath()))); + } else if (info.fileName().compare("meta.ini", Qt::CaseInsensitive) != 0) { entries.push_back(createFileEntry(parent, info.fileName())); } } @@ -78,18 +99,17 @@ protected: { return std::make_shared(qDir); } - }; /** * */ -std::shared_ptr QDirFileTree::makeTree(QDir directory, bool ignoreRootMeta) +std::shared_ptr QDirFileTree::makeTree(QDir directory, + bool ignoreRootMeta) { if (ignoreRootMeta) { return std::make_shared(directory); - } - else { + } else { return std::make_shared(nullptr, directory); } } -- cgit v1.3.1