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
+6 -6
View File
@@ -40,8 +40,8 @@ public:
AddKeywordAction(Set& set);
AddKeywordAction(AddingOrRemoving, Set& set, const KeywordP& keyword);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
const GenericAddAction<KeywordP> action;
};
@@ -75,9 +75,9 @@ public:
Keyword& keyword; ///< The keyword we are the reminder text of
/// Try to compile the script
virtual void store();
void store() override;
/// Add some tags, so the script looks nice
virtual void retrieve();
void retrieve() override;
/// Syntax highlight, and store in value
void highlight(const String& code, const vector<ScriptParseError>& errors);
@@ -91,8 +91,8 @@ class ChangeKeywordModeAction : public Action {
public:
ChangeKeywordModeAction(Keyword& keyword, const String& new_mode);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
//private:
Keyword& keyword;
+16 -16
View File
@@ -44,8 +44,8 @@ public:
AddCardAction(AddingOrRemoving, Set& set, const CardP& card);
AddCardAction(AddingOrRemoving, Set& set, const vector<CardP>& cards);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
const GenericAddAction<CardP> action;
};
@@ -57,8 +57,8 @@ class ReorderCardsAction : public CardListAction {
public:
ReorderCardsAction(Set& set, size_t card_id1, size_t card_id2);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
//private:
const size_t card_id1, card_id2; ///< Positions of the two cards to swap
@@ -69,8 +69,8 @@ public:
/// An action that affects the rendering/display/look of a set or cards in the set
class DisplayChangeAction : public Action {
public:
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
};
/// Changing the style of a a card
@@ -78,8 +78,8 @@ class ChangeCardStyleAction : public DisplayChangeAction {
public:
ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
//private:
CardP card; ///< The affected card
@@ -93,8 +93,8 @@ class ChangeSetStyleAction : public DisplayChangeAction {
public:
ChangeSetStyleAction(Set& set, const CardP& card);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
Set& set; ///< The affected set
@@ -109,8 +109,8 @@ class ChangeCardHasStylingAction : public DisplayChangeAction {
public:
ChangeCardHasStylingAction(Set& set, const CardP& card);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
//private:
Set& set; ///< The set to copy styling from
@@ -136,8 +136,8 @@ public:
/// Add a newly allocated card
AddPackAction(AddingOrRemoving, Set& set, const PackTypeP& pack);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
const GenericAddAction<PackTypeP> action;
};
@@ -148,8 +148,8 @@ public:
/// Add a newly allocated card
ChangePackAction(Set& set, size_t pos, const PackTypeP& new_pack);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
PackTypeP pack;
+28 -28
View File
@@ -40,8 +40,8 @@ class SymbolPartMoveAction : public SymbolPartsAction {
public:
SymbolPartMoveAction(const set<SymbolPartP>& parts, const Vector2D& delta = Vector2D());
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Update this action to move some more
void move(const Vector2D& delta);
@@ -80,8 +80,8 @@ class SymbolPartRotateAction : public SymbolPartMatrixAction {
public:
SymbolPartRotateAction(const set<SymbolPartP>& parts, const Vector2D& center);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Update this action to rotate to a different angle
void rotateTo(Radians newAngle);
@@ -103,8 +103,8 @@ class SymbolPartShearAction : public SymbolPartMatrixAction {
public:
SymbolPartShearAction(const set<SymbolPartP>& parts, const Vector2D& center);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Change shear by a given amount
void move(const Vector2D& deltaShear);
@@ -126,8 +126,8 @@ class SymbolPartScaleAction : public SymbolPartsAction {
public:
SymbolPartScaleAction(const set<SymbolPartP>& parts, int scaleX, int scaleY);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Change min and max coordinates
void move(const Vector2D& delta_min, const Vector2D& delta_max);
@@ -157,8 +157,8 @@ public:
// All parts must be SymbolParts
CombiningModeAction(const set<SymbolPartP>& parts, SymbolShapeCombine mode);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
void add(const SymbolPartP&, SymbolShapeCombine mode);
@@ -172,9 +172,9 @@ class SymbolPartNameAction : public SymbolPartAction {
public:
SymbolPartNameAction(const SymbolPartP& part, const String& name, size_t old_cursor, size_t new_cursor);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
virtual bool merge(const Action& action);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
bool merge(const Action& action) override;
public:
SymbolPartP part; ///< Affected part
@@ -190,8 +190,8 @@ class AddSymbolPartAction : public SymbolPartListAction {
public:
AddSymbolPartAction(Symbol& symbol, const SymbolPartP& part);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
Symbol& symbol; ///< Symbol to add the part to
@@ -205,8 +205,8 @@ class RemoveSymbolPartsAction : public SymbolPartListAction {
public:
RemoveSymbolPartsAction(Symbol& symbol, const set<SymbolPartP>& parts);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
Symbol& symbol;
@@ -234,8 +234,8 @@ class DuplicateSymbolPartsAction : public SymbolPartListAction {
public:
DuplicateSymbolPartsAction(Symbol& symbol, const set<SymbolPartP>& parts);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Fill a set with all the new parts
void getParts(set<SymbolPartP>& parts);
@@ -254,8 +254,8 @@ class ReorderSymbolPartsAction : public SymbolPartListAction {
public:
ReorderSymbolPartsAction(SymbolGroup& old_parent, size_t old_position, SymbolGroup& new_parent, size_t new_position);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
SymbolGroup* old_parent, *new_parent;///< Parents to move from and to
@@ -269,8 +269,8 @@ public:
/// Remove all the given groups
UngroupReorderSymbolPartsAction(SymbolGroup& group_parent, size_t group_pos, SymbolGroup& target_parent, size_t target_pos);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
SymbolGroup& group_parent;
@@ -287,11 +287,11 @@ class GroupSymbolPartsActionBase : public SymbolPartListAction {
public:
GroupSymbolPartsActionBase(SymbolGroup& root);
virtual void perform(bool to_undo);
void perform(bool to_undo) override;
protected:
SymbolGroup& root; ///< Symbol or group to group stuff in
vector<SymbolPartP> old_part_list; ///< Old part list of the symbol
SymbolGroup& root; ///< Symbol or group to group stuff in
vector<SymbolPartP> old_part_list; ///< Old part list of the symbol
};
/// Group multiple symbol parts together
@@ -299,7 +299,7 @@ class GroupSymbolPartsAction : public GroupSymbolPartsActionBase {
public:
GroupSymbolPartsAction(SymbolGroup& root, const set<SymbolPartP>& parts, const SymbolGroupP& group);
virtual String getName(bool to_undo) const;
String getName(bool to_undo) const override;
private:
SymbolGroupP group;
};
@@ -310,6 +310,6 @@ public:
/// Remove all the given groups
UngroupSymbolPartsAction(SymbolGroup& root, const set<SymbolPartP>& groups);
virtual String getName(bool to_undo) const;
String getName(bool to_undo) const override;
};
+4 -4
View File
@@ -304,8 +304,8 @@ class SinglePointRemoveAction : public Action, public IntrusivePtrBase<SinglePoi
public:
SinglePointRemoveAction(const SymbolShapeP& shape, UInt position);
virtual String getName(bool to_undo) const { return _("Delete point"); }
virtual void perform(bool to_undo);
String getName(bool to_undo) const override { return _("Delete point"); }
void perform(bool to_undo) override;
private:
SymbolShapeP shape;
@@ -390,8 +390,8 @@ class ControlPointRemoveAction : public Action {
public:
ControlPointRemoveAction(const SymbolShapeP& shape, const set<ControlPointP>& to_delete);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
vector<SinglePointRemoveActionP> removals;
+19 -19
View File
@@ -54,8 +54,8 @@ class ControlPointMoveAction : public ExtendableAction {
public:
ControlPointMoveAction(const set<ControlPointP>& points);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Update this action to move some more
void move(const Vector2D& delta);
@@ -76,8 +76,8 @@ class HandleMoveAction : public ExtendableAction {
public:
HandleMoveAction(const SelectedHandle& handle);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Update this action to move some more
void move(const Vector2D& delta);
@@ -115,8 +115,8 @@ class SegmentModeAction : public Action {
public:
SegmentModeAction(const ControlPointP& p1, const ControlPointP& p2, SegmentMode mode);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
protected:
ControlPointUpdate point1, point2;
@@ -129,8 +129,8 @@ class LockModeAction : public Action {
public:
LockModeAction(const ControlPointP& p, LockMode mode);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
ControlPointUpdate point; ///< The affected point
@@ -145,9 +145,9 @@ class CurveDragAction : public SegmentModeAction {
public:
CurveDragAction(const ControlPointP& point1, const ControlPointP& point2);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
// Move the curve by this much, it is grabbed at time t
void move(const Vector2D& delta, double t);
};
@@ -160,8 +160,8 @@ public:
/// Insert a new point in shape, after position insertAfter_, at the time t on the segment
ControlPointAddAction(const SymbolShapeP& shape, UInt insert_after, double t);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
inline ControlPointP getNewPoint() const { return new_point; }
@@ -188,8 +188,8 @@ class SymmetryMoveAction : public Action {
public:
SymmetryMoveAction(SymbolSymmetry& symmetry, bool is_handle);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// Update this action to move some more
void move(const Vector2D& delta);
@@ -211,8 +211,8 @@ class SymmetryTypeAction : public Action {
public:
SymmetryTypeAction(SymbolSymmetry& symmetry, SymbolSymmetryType type);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
SymbolSymmetry& symmetry;
SymbolSymmetryType type;
@@ -227,8 +227,8 @@ class SymmetryCopiesAction : public Action {
public:
SymmetryCopiesAction(SymbolSymmetry& symmetry, int copies);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
SymbolSymmetry& symmetry;
int copies;
+2 -2
View File
@@ -59,13 +59,13 @@ public:
: ValueAction(value), new_value(new_value)
{}
virtual void perform(bool to_undo) {
void perform(bool to_undo) override {
ValueAction::perform(to_undo);
swap_value(static_cast<T&>(*valueP), new_value);
valueP->onAction(*this, to_undo); // notify value
}
virtual bool merge(const Action& action) {
bool merge(const Action& action) override {
if (!ALLOW_MERGE) return false;
TYPE_CASE(action, SimpleValueAction) {
if (action.valueP == valueP) {
+16 -16
View File
@@ -40,8 +40,8 @@ public:
: valueP(value), card(nullptr), old_time_modified(wxDateTime::Now())
{}
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
/// We know that the value is on the given card, add that information
void isOnCard(Card* card);
@@ -69,9 +69,9 @@ class TextValueAction : public ValueAction {
public:
TextValueAction(const TextValueP& value, size_t start, size_t end, size_t new_end, const Defaultable<String>& new_value, const String& name);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
virtual bool merge(const Action& action);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
bool merge(const Action& action) override;
inline const String& newValue() const { return new_value(); }
@@ -99,10 +99,10 @@ class TextToggleReminderAction : public ValueAction {
public:
TextToggleReminderAction(const TextValueP& value, size_t pos);
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
private:
private:
size_t pos; ///< Position of "<kw-"
bool enable; ///< Should the reminder text be turned on or off?
wxUniChar old; ///< Old value of the <kw- tag
@@ -114,7 +114,7 @@ public:
class SimpleTextValueAction : public ValueAction {
public:
SimpleTextValueAction(const Card* card, const TextValueP& value, const Defaultable<String>& new_value);
virtual void perform(bool to_undo);
void perform(bool to_undo) override;
bool merge(const SimpleTextValueAction& action);
private:
Defaultable<String> new_value;
@@ -125,8 +125,8 @@ class ReplaceAllAction : public Action {
public:
~ReplaceAllAction();
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
vector<SimpleTextValueAction> actions;
};
@@ -137,9 +137,9 @@ public:
class ScriptValueEvent : public Action {
public:
inline ScriptValueEvent(const Card* card, const Value* value) : card(card), value(value) {}
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
const Card* card; ///< Card the value is on
const Value* value; ///< The modified value
@@ -152,8 +152,8 @@ public:
: stylesheet(stylesheet), style(style)
{}
virtual String getName(bool to_undo) const;
virtual void perform(bool to_undo);
String getName(bool to_undo) const override;
void perform(bool to_undo) override;
const StyleSheet* stylesheet; ///< StyleSheet the style is for
const Style* style; ///< The modified style
+3 -3
View File
@@ -34,9 +34,9 @@ public:
OptionalScript script; ///< Export script, for multi file templates and initialization
static String typeNameStatic();
virtual String typeName() const;
Version fileVersion() const;
virtual void validate(Version = app_version);
String typeName() const override;
Version fileVersion() const override;
void validate(Version = app_version) override;
/// Loads the export template with a particular name
static ExportTemplateP byName(const String & name);
private:
+2 -2
View File
@@ -33,7 +33,7 @@ class BooleanStyle : public ChoiceStyle {
public:
BooleanStyle(const ChoiceFieldP& field);
DECLARE_HAS_FIELD(Boolean); // not DECLARE_STYLE_TYPE, because we use a normal ChoiceValueViewer/Editor
virtual StyleP clone() const;
StyleP clone() const override;
// no extra data
@@ -48,7 +48,7 @@ class BooleanValue : public ChoiceValue {
public:
inline BooleanValue(const ChoiceFieldP& field) : ChoiceValue(field) {}
DECLARE_HAS_FIELD(Boolean);
virtual ValueP clone() const;
ValueP clone() const override;
// no extra data
+7 -7
View File
@@ -41,8 +41,8 @@ public:
map<String,Color> choice_colors; ///< Colors for the various choices (when color_cardlist)
map<String,Color> choice_colors_cardlist; ///< Colors for the various choices, for in the card list
virtual void initDependencies(Context&, const Dependency&) const;
virtual void after_reading(Version ver);
void initDependencies(Context&, const Dependency&) const override;
void after_reading(Version ver) override;
};
@@ -174,10 +174,10 @@ public:
/// Initialize image from choice_images
void initImage();
virtual int update(Context&);
virtual void initDependencies(Context&, const Dependency&) const;
virtual void checkContentDependencies(Context&, const Dependency&) const;
virtual void invalidate();
int update(Context&) override;
void initDependencies(Context&, const Dependency&) const override;
void checkContentDependencies(Context&, const Dependency&) const override;
void invalidate() override;
};
// ----------------------------------------------------------------------------- : ChoiceValue
@@ -194,6 +194,6 @@ public:
ValueType value; /// The name of the selected choice
virtual bool update(Context&);
bool update(Context&) override;
};
+3 -3
View File
@@ -36,7 +36,7 @@ public:
Defaultable<Color> initial; ///< Initial choice of a new value, if not set the first choice is used
String default_name; ///< Name of "default" value
virtual void initDependencies(Context&, const Dependency&) const;
void initDependencies(Context&, const Dependency&) const override;
};
/// A color that can be chosen for this field
@@ -63,7 +63,7 @@ public:
double bottom_width; ///< Width of the colored region on the bottom side
ImageCombine combine; ///< How to combine image with the background
virtual int update(Context&);
int update(Context&) override;
};
// ----------------------------------------------------------------------------- : ColorValue
@@ -76,7 +76,7 @@ public:
ValueType value; ///< The value
virtual bool update(Context&);
bool update(Context&) override;
};
+1 -1
View File
@@ -37,7 +37,7 @@ public:
ScriptableImage default_image; ///< Placeholder
virtual int update(Context&);
int update(Context&) override;
};
// ----------------------------------------------------------------------------- : ImageValue
+8 -8
View File
@@ -28,9 +28,9 @@ public:
InfoField() { editable = false; }
DECLARE_FIELD_TYPE(Text);
OptionalScript script; ///< Script to apply to all values
OptionalScript script; ///< Script to apply to all values
virtual void initDependencies(Context&, const Dependency&) const;
void initDependencies(Context&, const Dependency&) const override;
};
// ----------------------------------------------------------------------------- : InfoStyle
@@ -41,14 +41,14 @@ public:
InfoStyle(const InfoFieldP&);
DECLARE_STYLE_TYPE(Info);
Font font; ///< Font to use for the text
Alignment alignment; ///< Alignment inside the box
double padding_left, padding_right; ///< Padding
Font font; ///< Font to use for the text
Alignment alignment; ///< Alignment inside the box
double padding_left, padding_right; ///< Padding
double padding_top, padding_bottom;
Color background_color;
virtual int update(Context&);
virtual void initDependencies(Context&, const Dependency&) const;
int update(Context&) override;
void initDependencies(Context&, const Dependency&) const override;
};
// ----------------------------------------------------------------------------- : InfoValue
@@ -61,6 +61,6 @@ public:
ValueType value;
virtual bool update(Context&);
bool update(Context&) override;
};
+3 -3
View File
@@ -38,7 +38,7 @@ public:
Scriptable<Direction> direction; ///< In what direction are choices layed out?
Scriptable<double> spacing; ///< Spacing between choices (images) in pixels
virtual int update(Context&);
int update(Context&) override;
};
// ----------------------------------------------------------------------------- : MultipleChoiceValue
@@ -51,7 +51,7 @@ class MultipleChoiceValue : public ChoiceValue {
public:
inline MultipleChoiceValue(const MultipleChoiceFieldP& field) : ChoiceValue(field, false) {}
DECLARE_HAS_FIELD(MultipleChoice);
virtual ValueP clone() const;
ValueP clone() const override;
String last_change; ///< Which of the choices was selected/deselected last?
@@ -64,7 +64,7 @@ public:
/// Splits the value, stores the selected choices in the out parameter
void get(vector<String>& out) const;
virtual bool update(Context&);
bool update(Context&) override;
private:
DECLARE_REFLECTION();
+7 -7
View File
@@ -28,12 +28,12 @@ public:
DECLARE_FIELD_TYPE(PackageChoice);
OptionalScript script; ///< Script to apply to all values
String match; ///< Package filenames to match
String initial; ///< Initial value
String match; ///< Package filenames to match
String initial; ///< Initial value
bool required; ///< Is selecting a package required?
String empty_name; ///< Displayed name for the empty value (if !required)
String empty_name; ///< Displayed name for the empty value (if !required)
virtual void initDependencies(Context&, const Dependency&) const;
void initDependencies(Context&, const Dependency&) const override;
};
// ----------------------------------------------------------------------------- : PackageChoiceStyle
@@ -46,7 +46,7 @@ public:
Font font; ///< Font to use for the text
virtual int update(Context&);
int update(Context&) override;
};
// ----------------------------------------------------------------------------- : PackageChoiceValue
@@ -59,9 +59,9 @@ public:
ValueType package_name; ///< The selected package
/// Get the package (if it is set)
/// Get the package (if it is set), otherwise return nullptr
PackagedP getPackage() const;
virtual bool update(Context&);
bool update(Context&) override;
};
+10 -10
View File
@@ -34,14 +34,14 @@ public:
TextField();
DECLARE_FIELD_TYPE(Text);
OptionalScript script; ///< Script to apply to all values
OptionalScript script; ///< Script to apply to all values
OptionalScript default_script; ///< Script that generates the default value
//%OptionalScript view_script; ///< Script to apply before viewing
//%OptionalScript unview_script; ///< Script to apply after changes to the view
bool multi_line; ///< Are newlines allowed in the text?
String default_name; ///< Name of "default" value
bool multi_line; ///< Are newlines allowed in the text?
String default_name; ///< Name of "default" value
virtual void initDependencies(Context&, const Dependency&) const;
void initDependencies(Context&, const Dependency&) const override;
};
// ----------------------------------------------------------------------------- : TextStyle
@@ -95,9 +95,9 @@ public:
double content_width, content_height; ///< Size of the rendered text
int content_lines; ///< Number of rendered lines
virtual int update(Context&);
virtual void initDependencies(Context&, const Dependency&) const;
virtual void checkContentDependencies(Context&, const Dependency&) const;
int update(Context&) override;
void initDependencies(Context&, const Dependency&) const override;
void checkContentDependencies(Context&, const Dependency&) const override;
/// Stretch factor to use
double getStretch() const;
@@ -114,7 +114,7 @@ public:
ValueType value; ///< The text of this value
Age last_update; ///< When was the text last changed?
virtual bool update(Context&);
bool update(Context&) override;
};
// ----------------------------------------------------------------------------- : TextValue
@@ -139,8 +139,8 @@ public:
virtual void retrieve();
/// Update underlying data
virtual void onAction(Action& a, bool undone);
void onAction(Action& a, bool undone) override;
/// Editing the same underlying value?
virtual bool equals(const Value* that);
bool equals(const Value* that) override;
};
+1 -1
View File
@@ -64,7 +64,7 @@ template <typename T>
class QuickFilter : public Filter<T> {
public:
QuickFilter(String const& query) : query(parse_quicksearch_query(query)) {}
virtual bool keep(T const& x) const {
bool keep(T const& x) const override {
return match_quicksearch_query(query, x);
}
private:
+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 {
+3 -3
View File
@@ -70,11 +70,11 @@ public:
void initCardListColorScript();
static String typeNameStatic();
virtual String typeName() const;
Version fileVersion() const;
String typeName() const override;
Version fileVersion() const override;
protected:
virtual void validate(Version);
void validate(Version) override;
DECLARE_REFLECTION_OVERRIDE();
};
+3 -3
View File
@@ -43,9 +43,9 @@ public:
void addPackage(Packaged& package);
protected:
virtual String typeName() const;
virtual Version fileVersion() const;
virtual void validate(Version file_app_version);
String typeName() const override;
Version fileVersion() const override;
void validate(Version file_app_version) override;
DECLARE_REFLECTION();
};
+2 -2
View File
@@ -43,8 +43,8 @@ public:
static LocaleP byName(const String& name);
protected:
String typeName() const;
Version fileVersion() const;
String typeName() const override;
Version fileVersion() const override;
DECLARE_REFLECTION();
};
+2 -2
View File
@@ -256,7 +256,7 @@ void PackInstance::generate(vector<CardP>* out) {
// 1. the weights of each item, and of the cards
vector<WeightedItem> weighted_items;
FOR_EACH_CONST(item, pack_type.items) {
WeightedItem wi = {0,0,parent.gen()};
WeightedItem wi = {0,0,(int)parent.gen()};
if (pack_type.select == SELECT_EQUAL_PROPORTIONAL) {
wi.weight = item->weight * parent.get(item->name).total_weight;
} else if (pack_type.select == SELECT_EQUAL_NONEMPTY) {
@@ -266,7 +266,7 @@ void PackInstance::generate(vector<CardP>* out) {
}
weighted_items.push_back(wi);
}
WeightedItem wi = {cards.size(),0,parent.gen()};
WeightedItem wi = {(double)cards.size(),0,(int)parent.gen()};
weighted_items.push_back(wi);
// 2. divide the requested_copies among the cards and the items, taking the weights into account
weighted_equal_divide(weighted_items, (int)requested_copies);
+5 -5
View File
@@ -114,18 +114,18 @@ public:
/// Clear the order_cache used by positionOfCard
void clearOrderCache();
virtual String typeName() const;
Version fileVersion() const;
String typeName() const override;
Version fileVersion() const override;
/// Validate that the set is correctly loaded
virtual void validate(Version = app_version);
void validate(Version = app_version) override;
protected:
virtual VCSP getVCS() {
VCSP getVCS() override {
return vcs;
}
private:
DECLARE_REFLECTION();
DECLARE_REFLECTION_OVERRIDE();
template <typename Handler>
void reflect_cards(Handler& handler);
+3 -3
View File
@@ -62,10 +62,10 @@ public:
String stylesheetName() const;
static String typeNameStatic();
virtual String typeName() const;
Version fileVersion() const;
String typeName() const override;
Version fileVersion() const override;
/// Validate the stylesheet
virtual void validate(Version = app_version);
void validate(Version = app_version) override;
protected:
+19 -19
View File
@@ -206,11 +206,11 @@ public:
SymbolShape();
virtual String typeName() const;
virtual SymbolPartP clone() const;
virtual int icon() const { return combine; }
virtual SymbolShape* isSymbolShape() { return this; }
virtual const SymbolShape* isSymbolShape() const { return this; }
String typeName() const override;
SymbolPartP clone() const override;
int icon() const override { return combine; }
SymbolShape* isSymbolShape() override { return this; }
const SymbolShape* isSymbolShape() const override { return this; }
/// Get a control point, wraps around
inline ControlPointP getPoint(int id) const {
@@ -221,7 +221,7 @@ public:
void enforceConstraints();
/// Calculate the position and size of the part using the given rotation matrix
virtual Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity);
Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity) override;
DECLARE_REFLECTION_OVERRIDE();
void after_reading(Version) override;
@@ -236,15 +236,15 @@ public:
SymbolGroup();
virtual String typeName() const;
virtual SymbolPartP clone() const;
virtual int icon() const { return SYMBOL_COMBINE_BORDER + 3; }
virtual SymbolGroup* isSymbolGroup() { return this; }
virtual const SymbolGroup* isSymbolGroup() const { return this; }
String typeName() const override;
SymbolPartP clone() const override;
int icon() const override { return SYMBOL_COMBINE_BORDER + 3; }
SymbolGroup* isSymbolGroup() override { return this; }
const SymbolGroup* isSymbolGroup() const override { return this; }
virtual bool isAncestor(const SymbolPart& that) const;
bool isAncestor(const SymbolPart& that) const override;
virtual Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity);
Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity) override;
DECLARE_REFLECTION_OVERRIDE();
};
@@ -268,14 +268,14 @@ public:
SymbolSymmetry();
virtual String typeName() const;
virtual SymbolPartP clone() const;
virtual int icon() const { return kind + SYMBOL_COMBINE_BORDER + 1; }
virtual SymbolSymmetry* isSymbolSymmetry() { return this; }
virtual const SymbolSymmetry* isSymbolSymmetry() const { return this; }
String typeName() const override;
SymbolPartP clone() const override;
int icon() const override { return kind + SYMBOL_COMBINE_BORDER + 1; }
SymbolSymmetry* isSymbolSymmetry() override { return this; }
const SymbolSymmetry* isSymbolSymmetry() const override { return this; }
String expectedName() const;
virtual Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity);
Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity) override;
DECLARE_REFLECTION_OVERRIDE();
};
+10 -10
View File
@@ -68,8 +68,8 @@ public:
Image getImage(double font_size, const DrawableSymbol& symbol);
static String typeNameStatic();
virtual String typeName() const;
Version fileVersion() const;
String typeName() const override;
Version fileVersion() const override;
/// Generate a 'insert symbol' menu.
/** This class owns the menu!
@@ -112,9 +112,9 @@ public:
// ----------------------------------------------------------------------------- : InsertSymbolMenu
enum MenuItemType
{ ITEM_CODE ///< Name gives the code to insert
, ITEM_CUSTOM ///< Use a dialog box
, ITEM_LINE ///< A menu separator
{ ITEM_CODE ///< Name gives the code to insert
, ITEM_CUSTOM ///< Use a dialog box
, ITEM_LINE ///< A menu separator
, ITEM_SUBMENU ///< A submenu
};
@@ -153,11 +153,11 @@ public:
/// Is a font loaded?
bool valid() const;
Scriptable<String> name; ///< Font package name, can be changed with script
Scriptable<double> size; ///< Size of the font
double scale_down_to; ///< Mimumum size of the font
Scriptable<Alignment> alignment; ///< Alignment of symbols in a line of text
SymbolFontP font; ///< The font, if it is loaded
Scriptable<String> name; ///< Font package name, can be changed with script
Scriptable<double> size; ///< Size of the font
double scale_down_to; ///< Mimumum size of the font
Scriptable<Alignment> alignment; ///< Alignment of symbols in a line of text
SymbolFontP font; ///< The font, if it is loaded
private:
DECLARE_REFLECTION();