mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Mark one-parameter constructors as explicit & use override where possible
This commit marks (hopefully) ever one-parameter constructor as explicit. It also uses override in (hopefully) all circumstances where a virtual method is overridden. There are a very few other minor changes - most of them were necessary to get everything to compile (like one additional constructor). In one case I changed an implicit operation to an explicit string conversion - I think the automatically chosen conversion was much more convoluted. This took longer than I want to admit but not as long as I feared :)
This commit is contained in:
parent
1f2bf50b49
commit
6d612ced3d
173 changed files with 1052 additions and 1046 deletions
|
@ -24,13 +24,13 @@ public:
|
|||
// Implements the "event" keyword.
|
||||
class RuleActionEvent : public RuleAction {
|
||||
public:
|
||||
RuleActionEvent(const char* arg_msg) { msg = copy_string(arg_msg); }
|
||||
virtual ~RuleActionEvent() { delete [] msg; }
|
||||
explicit RuleActionEvent(const char* arg_msg) { msg = copy_string(arg_msg); }
|
||||
~RuleActionEvent() override { delete [] msg; }
|
||||
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len);
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len) override;
|
||||
|
||||
virtual void PrintDebug();
|
||||
void PrintDebug() override;
|
||||
|
||||
private:
|
||||
const char* msg;
|
||||
|
@ -38,17 +38,17 @@ private:
|
|||
|
||||
class RuleActionMIME : public RuleAction {
|
||||
public:
|
||||
RuleActionMIME(const char* arg_mime, int arg_strength = 0)
|
||||
explicit RuleActionMIME(const char* arg_mime, int arg_strength = 0)
|
||||
{ mime = copy_string(arg_mime); strength = arg_strength; }
|
||||
|
||||
virtual ~RuleActionMIME()
|
||||
~RuleActionMIME() override
|
||||
{ delete [] mime; }
|
||||
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len)
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len) override
|
||||
{ }
|
||||
|
||||
virtual void PrintDebug();
|
||||
void PrintDebug() override;
|
||||
|
||||
string GetMIME() const
|
||||
{ return mime; }
|
||||
|
@ -64,12 +64,12 @@ private:
|
|||
// Base class for enable/disable actions.
|
||||
class RuleActionAnalyzer : public RuleAction {
|
||||
public:
|
||||
RuleActionAnalyzer(const char* analyzer);
|
||||
explicit RuleActionAnalyzer(const char* analyzer);
|
||||
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len) = 0;
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len) override = 0;
|
||||
|
||||
virtual void PrintDebug();
|
||||
void PrintDebug() override;
|
||||
|
||||
analyzer::Tag Analyzer() const { return analyzer; }
|
||||
analyzer::Tag ChildAnalyzer() const { return child_analyzer; }
|
||||
|
@ -81,22 +81,22 @@ private:
|
|||
|
||||
class RuleActionEnable : public RuleActionAnalyzer {
|
||||
public:
|
||||
RuleActionEnable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
|
||||
explicit RuleActionEnable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
|
||||
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len);
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len) override;
|
||||
|
||||
virtual void PrintDebug();
|
||||
void PrintDebug() override;
|
||||
};
|
||||
|
||||
class RuleActionDisable : public RuleActionAnalyzer {
|
||||
public:
|
||||
RuleActionDisable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
|
||||
explicit RuleActionDisable(const char* analyzer) : RuleActionAnalyzer(analyzer) {}
|
||||
|
||||
virtual void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len);
|
||||
void DoAction(const Rule* parent, RuleEndpointState* state,
|
||||
const u_char* data, int len) override;
|
||||
|
||||
virtual void PrintDebug();
|
||||
void PrintDebug() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue