From 1b29e4a6e8fb9a27a96bdfadb69b12cc2436db6e Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Tue, 9 Dec 2014 22:56:15 +0100 Subject: add a checkall --- tests/hawd/modules/check.cpp | 30 ++++++++++++++++++++---------- tests/hawd/modules/check.h | 11 ++++++++++- 2 files changed, 30 insertions(+), 11 deletions(-) (limited to 'tests/hawd/modules') diff --git a/tests/hawd/modules/check.cpp b/tests/hawd/modules/check.cpp index 1359b3d..e334fb8 100644 --- a/tests/hawd/modules/check.cpp +++ b/tests/hawd/modules/check.cpp @@ -29,12 +29,30 @@ namespace HAWD { +CheckAll::CheckAll() + : Module() +{ + setSyntax(Syntax("checkall", &CheckAll::check)); +} + +bool CheckAll::check(const QStringList &commands, State &state) +{ + QDir project(state.projectPath()); + project.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks); + for (const QString &entry: project.entryList()) { + Check::checkFile(entry, state); + } + + return true; +} + Check::Check() : Module() { Syntax top("check", &Check::check); - setDescription(QObject::tr("Checks a dataset description for validity and prints out any errors it finds")); setSyntax(top); + + setDescription(QObject::tr("Checks a dataset description for validity and prints out any errors it finds")); } bool Check::check(const QStringList &commands, State &state) @@ -43,15 +61,7 @@ bool Check::check(const QStringList &commands, State &state) std::cout << QObject::tr("Please provide the name of a dataset definition file. (Use the 'list' command to see available datasets.)").toStdString() << std::endl; } else { for (const QString &name: commands) { - if (name == "*") { - QDir project(state.projectPath()); - project.setFilter(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot | QDir::NoSymLinks); - for (const QString &entry: project.entryList()) { - checkFile(entry, state); - } - } else { - checkFile(name, state); - } + checkFile(name, state); } } diff --git a/tests/hawd/modules/check.h b/tests/hawd/modules/check.h index 035f45a..44721f4 100644 --- a/tests/hawd/modules/check.h +++ b/tests/hawd/modules/check.h @@ -28,10 +28,19 @@ class Check : public Module { public: Check(); + static void checkFile(const QString &name, State &state); + +private: + static bool check(const QStringList &commands, State &state); +}; + +class CheckAll : public Module +{ +public: + CheckAll(); private: static bool check(const QStringList &commands, State &state); - static void checkFile(const QString &name, State &state); }; } // namespace HAWD -- cgit v1.2.3