2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-03 07:55:52 +00:00

driver: Make tool constructors explicit

Enforces being explicit when constructing instances of these types.
This commit is contained in:
Lioncash 2019-08-19 22:49:24 -04:00
parent 11364cbd53
commit f746b30b03
8 changed files with 9 additions and 9 deletions

View File

@ -88,7 +88,7 @@ protected:
} }
public: public:
ToolBase(const ToolPassInfo& info) : m_info(info) { explicit ToolBase(const ToolPassInfo& info) : m_info(info) {
hecl::VerbosityLevel = info.verbosityLevel; hecl::VerbosityLevel = info.verbosityLevel;
hecl::GuiMode = info.gui; hecl::GuiMode = info.gui;
} }
@ -156,7 +156,7 @@ private:
} }
public: public:
HelpOutput(HelpFunc helpFunc) explicit HelpOutput(HelpFunc helpFunc)
: m_sout(NULL), m_helpFunc(helpFunc), m_lineWidth(hecl::GuiMode ? 120 : hecl::ConsoleWidth()) {} : m_sout(NULL), m_helpFunc(helpFunc), m_lineWidth(hecl::GuiMode ? 120 : hecl::ConsoleWidth()) {}
void go() { void go() {

View File

@ -13,7 +13,7 @@ class ToolCook final : public ToolBase {
bool m_fast = false; bool m_fast = false;
public: public:
ToolCook(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) { explicit ToolCook(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
/* Check for recursive flag */ /* Check for recursive flag */
for (hecl::SystemChar arg : info.flags) for (hecl::SystemChar arg : info.flags)
if (arg == _SYS_STR('r')) if (arg == _SYS_STR('r'))

View File

@ -27,7 +27,7 @@ class ToolExtract final : public ToolBase {
hecl::Database::Project* m_useProj = nullptr; hecl::Database::Project* m_useProj = nullptr;
public: public:
ToolExtract(const ToolPassInfo& info) : ToolBase(info) { explicit ToolExtract(const ToolPassInfo& info) : ToolBase(info) {
if (!m_info.args.size()) if (!m_info.args.size())
LogModule.report(logvisor::Fatal, fmt("hecl extract needs a source path as its first argument")); LogModule.report(logvisor::Fatal, fmt("hecl extract needs a source path as its first argument"));

View File

@ -7,7 +7,7 @@
class ToolHelp final : public ToolBase { class ToolHelp final : public ToolBase {
public: public:
ToolHelp(const ToolPassInfo& info) : ToolBase(info) { explicit ToolHelp(const ToolPassInfo& info) : ToolBase(info) {
if (m_info.args.empty()) { if (m_info.args.empty()) {
LogModule.report(logvisor::Error, fmt("help requires a tool name argument")); LogModule.report(logvisor::Error, fmt("help requires a tool name argument"));
return; return;

View File

@ -15,7 +15,7 @@ class ToolImage final : public ToolBase {
hecl::Database::Project* m_useProj; hecl::Database::Project* m_useProj;
public: public:
ToolImage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) { explicit ToolImage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
if (!info.project) if (!info.project)
LogModule.report(logvisor::Fatal, fmt("hecl image must be ran within a project directory")); LogModule.report(logvisor::Fatal, fmt("hecl image must be ran within a project directory"));

View File

@ -7,7 +7,7 @@ class ToolInit final : public ToolBase {
const hecl::SystemString* m_dir = NULL; const hecl::SystemString* m_dir = NULL;
public: public:
ToolInit(const ToolPassInfo& info) : ToolBase(info) { explicit ToolInit(const ToolPassInfo& info) : ToolBase(info) {
hecl::Sstat theStat; hecl::Sstat theStat;
const hecl::SystemString* dir; const hecl::SystemString* dir;
if (info.args.size()) if (info.args.size())

View File

@ -59,7 +59,7 @@ class ToolPackage final : public ToolBase {
} }
public: public:
ToolPackage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) { explicit ToolPackage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
if (!info.project) if (!info.project)
LogModule.report(logvisor::Fatal, fmt("hecl package must be ran within a project directory")); LogModule.report(logvisor::Fatal, fmt("hecl package must be ran within a project directory"));

View File

@ -8,7 +8,7 @@ class ToolSpec final : public ToolBase {
enum Mode { MLIST = 0, MENABLE, MDISABLE } mode = MLIST; enum Mode { MLIST = 0, MENABLE, MDISABLE } mode = MLIST;
public: public:
ToolSpec(const ToolPassInfo& info) : ToolBase(info) { explicit ToolSpec(const ToolPassInfo& info) : ToolBase(info) {
if (info.args.empty()) if (info.args.empty())
return; return;