Cleanup: use override specifier everywhere, and enable gcc warning to check for it.

This commit is contained in:
Twan van Laarhoven
2020-05-16 00:23:18 +02:00
parent a7c47729c1
commit 5deaeeeb3e
113 changed files with 710 additions and 714 deletions
+11 -11
View File
@@ -43,7 +43,7 @@ public:
/// Update the progress bar
/** if the operation should be aborted, throws an AbortException
*/
virtual void onProgress(float progress, const String& message);
void onProgress(float progress, const String& message) override;
};
ExportProgressDialog::ExportProgressDialog(Window* parent, const String& title, const String& message)
@@ -133,8 +133,8 @@ public:
: ApprDatabase(progress_target, _("Expan.dat"))
{}
protected:
virtual void doRead(wxInputStream& in);
virtual void doWrite(wxOutputStream& out);
void doRead(wxInputStream& in) override;
void doWrite(wxOutputStream& out) override;
public:
map<String,String> expansions; ///< code -> name
@@ -196,8 +196,8 @@ public:
void removeSet(const String& code);
protected:
virtual void doRead(wxInputStream& in);
virtual void doWrite(wxOutputStream& out);
void doRead(wxInputStream& in) override;
void doWrite(wxOutputStream& out) override;
private:
vector<ApprFormat> formats;
@@ -280,8 +280,8 @@ public:
void removeSet(const String& code);
protected:
virtual void doRead(wxInputStream& in);
virtual void doWrite(wxOutputStream& out);
void doRead(wxInputStream& in) override;
void doWrite(wxOutputStream& out) override;
public:
map<String,ApprDistro> distros;
@@ -295,7 +295,7 @@ void ApprDistroDatabase::removeSet(const String& code) {
void ApprDistroDatabase::doRead(wxInputStream& in) {
wxTextInputStream tin(in);
ApprDistro* last = 0;
ApprDistro* last = nullptr;
while (!in.Eof()) {
String l = trim(tin.ReadLine());
if (l.size() > 2 && l.GetChar(0) == _('<')) {
@@ -365,8 +365,8 @@ public:
void removeSet(const String& code);
protected:
virtual void doRead(wxInputStream& in);
virtual void doWrite(wxOutputStream& out);
void doRead(wxInputStream& in) override;
void doWrite(wxOutputStream& out) override;
public:
vector<ApprCardRecordP> cards;
@@ -582,7 +582,7 @@ class ApprenticeExportWindow : public wxDialog, public WithProgress {
public:
ApprenticeExportWindow(Window* parent, const SetP& set);
virtual void onProgress(float p, const String& message);
void onProgress(float p, const String& message) override;
void doStep(const String& s, float size);
private:
+1 -1
View File
@@ -29,7 +29,7 @@ public:
UnzoomedDataViewer(bool use_zoom_settings)
: use_zoom_settings(use_zoom_settings)
{}
virtual Rotation getRotation() const;
Rotation getRotation() const override;
private:
bool use_zoom_settings;
};
+5 -5
View File
@@ -22,11 +22,11 @@
/// The file format of MSE1 files
class MSE1FileFormat : public FileFormat {
public:
virtual String extension() { return _("mse"); }
virtual String name() { return _("Magic Set Editor version 1 files (*.mse)"); }
virtual bool canImport() { return true; }
virtual bool canExport(const Game&) { return false; }
virtual SetP importSet(const String& filename);
String extension() override { return _("mse"); }
String name() override { return _("Magic Set Editor version 1 files (*.mse)"); }
bool canImport() override { return true; }
bool canExport(const Game&) override { return false; }
SetP importSet(const String& filename) override;
};
FileFormatP mse1_file_format() {
+7 -7
View File
@@ -16,12 +16,12 @@
/// The file format of MSE2 files
class MSE2FileFormat : public FileFormat {
public:
virtual String extension() { return _("mse-set"); }
virtual String matches() { return _("*.mse-set;set"); }
virtual String name() { return _("Magic Set Editor sets (*.mse-set)"); }
virtual bool canImport() { return true; }
virtual bool canExport(const Game&) { return true; }
virtual SetP importSet(const String& filename) {
String extension() override { return _("mse-set"); }
String matches() override { return _("*.mse-set;set"); }
String name() override { return _("Magic Set Editor sets (*.mse-set)"); }
bool canImport() override { return true; }
bool canExport(const Game&) override { return true; }
SetP importSet(const String& filename) override {
wxString set_name = filename;
// Strip "/set" or "/set.mset-set" from the end, this allows opening directories as set files
if (filename.EndsWith(_(".mse-set/set")) || filename.EndsWith(_(".mse-set\\set"))) {
@@ -34,7 +34,7 @@ public:
settings.addRecentFile(set_name);
return set;
}
virtual void exportSet(Set& set, const String& filename, bool is_copy) {
void exportSet(Set& set, const String& filename, bool is_copy) override {
if (is_copy) {
set.saveCopy(filename);
} else {
+11 -11
View File
@@ -23,11 +23,11 @@
/// The file format of Mtg Editor files
class MtgEditorFileFormat : public FileFormat {
public:
virtual String extension() { return _("set"); }
virtual String name() { return _("Mtg Editor files (*.set)"); }
virtual bool canImport() { return true; }
virtual bool canExport(const Game&) { return false; }
virtual SetP importSet(const String& filename);
String extension() override { return _("set"); }
String name() override { return _("Mtg Editor files (*.set)"); }
bool canImport() override { return true; }
bool canExport(const Game&) override { return false; }
SetP importSet(const String& filename) override;
private:
// Filter: se filename -> image directory
// based on MtgEditor's: CardSet.getImageFolder
@@ -115,17 +115,17 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
} else if (line == _("#COST##########")) { // casting cost
target = &current_card->value<TextValue>(_("casting cost")).value;
} else if (line == _("#RARITY########") || line == _("#FREQUENCY#####")) { // rarity
target = 0;
target = nullptr;
line = file.ReadLine();
if (line == _("0")) current_card->value<ChoiceValue>(_("rarity")).value.assign(_("common"));
else if (line == _("1")) current_card->value<ChoiceValue>(_("rarity")).value.assign(_("uncommon"));
else current_card->value<ChoiceValue>(_("rarity")).value.assign(_("rare"));
} else if (line == _("#COLOR#########")) { // card color
target = 0;
target = nullptr;
line = file.ReadLine();
current_card->value<ChoiceValue>(_("card color")).value.assign(line);
} else if (line == _("#AUTOBG########")) { // card color.isDefault
target = 0;
target = nullptr;
line = file.ReadLine();
if (line == _("TRUE")) {
current_card->value<ChoiceValue>(_("card color")).value.makeDefault();
@@ -143,7 +143,7 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
} else if (line == _("#TOUGHNESS#####")) { // toughness
target = &current_card->value<TextValue>(_("toughness")).value;
} else if (line == _("#ILLUSTRATION##") || line == _("#ILLUSTRATION8#")) { // image
target = 0;
target = nullptr;
line = file.ReadLine();
if (!wxFileExists(line)) {
// based on card name and date
@@ -158,14 +158,14 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
}
}
} else if (line == _("#TOMBSTONE#####")) { // tombstone
target = 0;
target = nullptr;
line = file.ReadLine();
current_card->value<ChoiceValue>(_("card symbol")).value.assign(
line==_("TRUE") ? _("tombstone") : _("none")
);
} else {
// normal text
if (target != 0) { // value of a text field
if (target != nullptr) { // value of a text field
if (!target->isDefault()) target->mutate() += _("\n");
target->mutate() += line;
} else {