1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 22:12:58 +02:00

Replace virtual with override wherever possible; eliminate needless virtual...

... for functions in final classes.

override is like const -- it's not necessary, but it helps the compiler to
catch mistakes.

There may be some overriding functions not explicitly declared virtual and I did
not identify such cases, in which I might also add override.
This commit is contained in:
Paul Licameli
2016-02-24 01:06:47 -05:00
parent 74121c1494
commit 990080ae7d
169 changed files with 1652 additions and 1639 deletions

View File

@@ -34,7 +34,7 @@ public:
AppCommandEvent(const AppCommandEvent &event);
~AppCommandEvent();
virtual wxEvent *Clone() const;
wxEvent *Clone() const override;
void SetCommand(Command *cmd);
Command *GetCommand();

View File

@@ -29,9 +29,9 @@ to that system.
class BatchEvalCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class BatchEvalCommand final : public CommandImplementation
@@ -43,7 +43,7 @@ public:
{ }
virtual ~BatchEvalCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __BATCHEVALCOMMAND__ */

View File

@@ -76,9 +76,9 @@ class DecoratedCommand /* not final */ : public Command
protected:
Command *mCommand;
public:
virtual void Progress(double completed);
virtual void Status(const wxString &message) override;
virtual void Error(const wxString &message) override;
void Progress(double completed) override;
void Status(const wxString &message) override;
void Error(const wxString &message) override;
DecoratedCommand(Command *cmd)
: mCommand(cmd)
@@ -86,10 +86,9 @@ public:
wxASSERT(cmd != NULL);
}
virtual ~DecoratedCommand();
virtual wxString GetName();
virtual CommandSignature &GetSignature();
virtual bool SetParameter(const wxString &paramName, const wxVariant &paramValue);
virtual bool Apply(CommandExecutionContext context) = 0;
wxString GetName() override;
CommandSignature &GetSignature() override;
bool SetParameter(const wxString &paramName, const wxVariant &paramValue) override;
};
// Decorator command that performs the given command and then outputs a status
@@ -101,7 +100,7 @@ public:
: DecoratedCommand(cmd)
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
class CommandImplementation /* not final */ : public Command
@@ -155,7 +154,7 @@ public:
/// Actually carry out the command. Return true if successful and false
/// otherwise.
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __COMMAND__ */

View File

@@ -247,7 +247,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
// Loading/Saving
//
virtual void WriteXML(XMLWriter &xmlFile);
void WriteXML(XMLWriter &xmlFile) /* not override */;
protected:
@@ -299,9 +299,9 @@ protected:
// Loading/Saving
//
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs);
virtual void HandleXMLEndTag(const wxChar *tag);
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
void HandleXMLEndTag(const wxChar *tag) override;
XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
private:
MenuBarList mMenuBarList;

View File

@@ -42,7 +42,7 @@ class NullProgressTarget final : public CommandProgressTarget
{
public:
virtual ~NullProgressTarget() {}
virtual void Update(double WXUNUSED(completed)) {}
void Update(double WXUNUSED(completed)) override {}
};
/// Sends command progress information to a ProgressDialog
@@ -55,7 +55,7 @@ public:
: mProgress(pd)
{}
virtual ~GUIProgressTarget() {}
virtual void Update(double completed)
void Update(double completed) override
{
mProgress.Update(completed);
}
@@ -82,7 +82,7 @@ public:
{
// delete &mTarget;
}
virtual void Update(double completed)
void Update(double completed) override
{
mTarget.Update(wxString::Format(wxT("%.2f%%"), completed*100));
}
@@ -93,7 +93,7 @@ class NullMessageTarget final : public CommandMessageTarget
{
public:
virtual ~NullMessageTarget() {}
virtual void Update(const wxString &message) override {}
void Update(const wxString &message) override {}
};
/// Displays messages from a command in a wxMessageBox
@@ -101,7 +101,7 @@ class MessageBoxTarget final : public CommandMessageTarget
{
public:
virtual ~MessageBoxTarget() {}
virtual void Update(const wxString &message) override
void Update(const wxString &message) override
{
wxMessageBox(message);
}
@@ -116,7 +116,7 @@ public:
StatusBarTarget(wxStatusBar &sb)
: mStatus(sb)
{}
virtual void Update(const wxString &message) override
void Update(const wxString &message) override
{
mStatus.SetStatusText(message, 0);
}
@@ -135,7 +135,7 @@ public:
{
mResponseQueue.AddResponse(wxString(wxT("\n")));
}
virtual void Update(const wxString &message) override
void Update(const wxString &message) override
{
mResponseQueue.AddResponse(message);
}
@@ -158,7 +158,7 @@ public:
delete m1;
delete m2;
}
virtual void Update(const wxString &message) override
void Update(const wxString &message) override
{
m1->Update(message);
m2->Update(message);

View File

@@ -25,9 +25,9 @@ class WaveTrack;
class CompareAudioCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class CompareAudioCommand final : public CommandImplementation
@@ -41,13 +41,13 @@ private:
bool GetSelection(AudacityProject &proj);
protected:
virtual double CompareSample(double value1, double value2);
double CompareSample(double value1, double value2) /* not override */;
public:
CompareAudioCommand(CommandType &type, CommandOutputTarget *target)
: CommandImplementation(type, target)
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __COMPAREAUDIOCOMMAND__ */

View File

@@ -26,9 +26,9 @@ name.
class ExecMenuCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class ExecMenuCommand final : public CommandImplementation
@@ -39,7 +39,7 @@ public:
: CommandImplementation(type, target)
{ }
virtual ~ExecMenuCommand() { }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __EXECMENUCOMMAND__ */

View File

@@ -26,9 +26,9 @@ channel.
class GetAllMenuCommandsType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class GetAllMenuCommands final : public CommandImplementation
@@ -42,7 +42,7 @@ public:
virtual ~GetAllMenuCommands()
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __GETALLMENUCOMMANDS__ */

View File

@@ -22,9 +22,9 @@
class GetProjectInfoCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
@@ -37,7 +37,7 @@ public:
virtual ~GetProjectInfoCommand()
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
private:
int SendNumberOfTracks(CommandExecutionContext context);

View File

@@ -22,9 +22,9 @@
class GetTrackInfoCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class GetTrackInfoCommand final : public CommandImplementation
@@ -36,7 +36,7 @@ public:
virtual ~GetTrackInfoCommand()
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
private:
void SendBooleanStatus(bool BooleanValue);

View File

@@ -25,9 +25,9 @@
class HelpCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class HelpCommand final : public CommandImplementation
@@ -35,7 +35,7 @@ class HelpCommand final : public CommandImplementation
public:
HelpCommand(HelpCommandType &type, CommandOutputTarget *target)
: CommandImplementation(type, target) { }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __HELPCOMMAND__ */

View File

@@ -25,9 +25,9 @@
class ImportCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class ImportCommand final : public CommandImplementation
@@ -39,7 +39,7 @@ public:
{ }
virtual ~ImportCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
// Export
@@ -47,9 +47,9 @@ public:
class ExportCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class ExportCommand final : public CommandImplementation
@@ -61,5 +61,5 @@ public:
{ }
virtual ~ExportCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};

View File

@@ -27,9 +27,9 @@
class MessageCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class MessageCommand final : public CommandImplementation
@@ -38,7 +38,7 @@ public:
MessageCommand(CommandType &type,
CommandOutputTarget *target)
: CommandImplementation(type, target) {}
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __MESSAGECOMMAND__ */

View File

@@ -25,9 +25,9 @@
class OpenProjectCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class OpenProjectCommand final : public CommandImplementation
@@ -39,7 +39,7 @@ public:
{ }
virtual ~OpenProjectCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
// Save
@@ -47,9 +47,9 @@ public:
class SaveProjectCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class SaveProjectCommand final : public CommandImplementation
@@ -61,5 +61,5 @@ public:
{ }
virtual ~SaveProjectCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};

View File

@@ -28,9 +28,9 @@
class GetPreferenceCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class GetPreferenceCommand final : public CommandImplementation
@@ -42,7 +42,7 @@ public:
{ }
virtual ~GetPreferenceCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
// SetPreference
@@ -50,9 +50,9 @@ public:
class SetPreferenceCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class SetPreferenceCommand final : public CommandImplementation
@@ -64,7 +64,7 @@ public:
{ }
virtual ~SetPreferenceCommand();
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __PREFERENCECOMMANDS__ */

View File

@@ -26,9 +26,9 @@ class CommandOutputTarget;
class ScreenshotCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class ScreenshotCommand final : public CommandImplementation

View File

@@ -22,9 +22,9 @@
class SelectCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class SelectCommand final : public CommandImplementation
@@ -32,7 +32,7 @@ class SelectCommand final : public CommandImplementation
public:
SelectCommand(SelectCommandType &type, CommandOutputTarget *target)
: CommandImplementation(type, target) { }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __SELECTCOMMAND__ */

View File

@@ -26,9 +26,9 @@ class TrackList;
class SetProjectInfoCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
@@ -41,7 +41,7 @@ public:
virtual ~SetProjectInfoCommand()
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
private:
// Function pointer to set a particular Track parameter

View File

@@ -22,9 +22,9 @@
class SetTrackInfoCommandType final : public CommandType
{
public:
virtual wxString BuildName();
virtual void BuildSignature(CommandSignature &signature);
virtual Command *Create(CommandOutputTarget *target);
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
Command *Create(CommandOutputTarget *target) override;
};
class SetTrackInfoCommand final : public CommandImplementation
@@ -36,7 +36,7 @@ public:
virtual ~SetTrackInfoCommand()
{ }
virtual bool Apply(CommandExecutionContext context);
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __SETTRACKINFOCOMMAND__ */

View File

@@ -95,12 +95,12 @@ public:
{
mOptions.insert(mOptions.begin(), options.begin(), options.end());
}
virtual bool Validate(const wxVariant &v)
bool Validate(const wxVariant &v) override
{
SetConverted(v);
return (mOptions.Index(v.GetString()) != wxNOT_FOUND);
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
wxString desc = wxT("one of: ");
int optionCount = mOptions.GetCount();
@@ -112,7 +112,7 @@ public:
desc += mOptions[optionCount-1];
return desc;
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
OptionValidator *v = new OptionValidator();
v->mOptions = mOptions;
@@ -123,18 +123,18 @@ public:
class BoolValidator final : public Validator
{
public:
virtual bool Validate(const wxVariant &v)
bool Validate(const wxVariant &v) override
{
bool val;
if (!v.Convert(&val)) return false;
SetConverted(val);
return GetConverted().IsType(wxT("bool"));
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
return wxT("true/false or 1/0 or yes/no");
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
return new BoolValidator();
}
@@ -154,11 +154,11 @@ public:
return false;
return true;
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
return wxT("0X101XX101...etc. where 0=false, 1=true, and X=don't care. Numbering starts at leftmost = track 0");
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
return new BoolArrayValidator();
}
@@ -167,18 +167,18 @@ public:
class DoubleValidator final : public Validator
{
public:
virtual bool Validate(const wxVariant &v)
bool Validate(const wxVariant &v) override
{
double val;
if (!v.Convert(&val)) return false;
SetConverted(val);
return GetConverted().IsType(wxT("double"));
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
return wxT("a floating-point number");
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
return new DoubleValidator();
}
@@ -192,18 +192,18 @@ public:
RangeValidator(double l, double u)
: mLower(l), mUpper(u)
{ }
virtual bool Validate(const wxVariant &v)
bool Validate(const wxVariant &v) override
{
double val;
if (!v.Convert(&val)) return false;
SetConverted(val);
return ((mLower < val) && (val < mUpper));
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
return wxString::Format(wxT("between %f and %f"), mLower, mUpper);
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
return new RangeValidator(mLower, mUpper);
}
@@ -212,7 +212,7 @@ public:
class IntValidator final : public Validator
{
public:
virtual bool Validate(const wxVariant &v)
bool Validate(const wxVariant &v) override
{
double val;
if (!v.Convert(&val)) return false;
@@ -220,11 +220,11 @@ public:
if (!GetConverted().IsType(wxT("double"))) return false;
return ((long)val == val);
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
return wxT("an integer");
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
return new IntValidator();
}
@@ -239,16 +239,16 @@ public:
AndValidator(Validator *u1, Validator *u2)
: v1(*u1), v2(*u2)
{ }
virtual bool Validate(const wxVariant &v)
bool Validate(const wxVariant &v) override
{
if (!v1.Validate(v)) return false;
return v2.Validate(v);
}
virtual wxString GetDescription() const
wxString GetDescription() const override
{
return v1.GetDescription() + wxT(" and ") + v2.GetDescription();
}
virtual Validator *GetClone() const
Validator *GetClone() const override
{
return new AndValidator(v1.GetClone(), v2.GetClone());
}