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

View File

@ -13,7 +13,7 @@ class ToolCook final : public ToolBase {
bool m_fast = false;
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 */
for (hecl::SystemChar arg : info.flags)
if (arg == _SYS_STR('r'))

View File

@ -27,7 +27,7 @@ class ToolExtract final : public ToolBase {
hecl::Database::Project* m_useProj = nullptr;
public:
ToolExtract(const ToolPassInfo& info) : ToolBase(info) {
explicit ToolExtract(const ToolPassInfo& info) : ToolBase(info) {
if (!m_info.args.size())
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 {
public:
ToolHelp(const ToolPassInfo& info) : ToolBase(info) {
explicit ToolHelp(const ToolPassInfo& info) : ToolBase(info) {
if (m_info.args.empty()) {
LogModule.report(logvisor::Error, fmt("help requires a tool name argument"));
return;

View File

@ -15,7 +15,7 @@ class ToolImage final : public ToolBase {
hecl::Database::Project* m_useProj;
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)
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;
public:
ToolInit(const ToolPassInfo& info) : ToolBase(info) {
explicit ToolInit(const ToolPassInfo& info) : ToolBase(info) {
hecl::Sstat theStat;
const hecl::SystemString* dir;
if (info.args.size())

View File

@ -59,7 +59,7 @@ class ToolPackage final : public ToolBase {
}
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)
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;
public:
ToolSpec(const ToolPassInfo& info) : ToolBase(info) {
explicit ToolSpec(const ToolPassInfo& info) : ToolBase(info) {
if (info.args.empty())
return;