summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-25 18:35:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-25 18:35:21 +0300
commit71f88c02f79a1164430eec1de3e15edec011a15e (patch)
tree6a0772ee943a41314b5abd92fed0ce269faced27
parent6c05739c62484dae8d5ed9fb0dfdb6590aacfe88 (diff)
downloadmanaplus-71f88c02f79a1164430eec1de3e15edec011a15e.tar.gz
manaplus-71f88c02f79a1164430eec1de3e15edec011a15e.tar.bz2
manaplus-71f88c02f79a1164430eec1de3e15edec011a15e.tar.xz
manaplus-71f88c02f79a1164430eec1de3e15edec011a15e.zip
improve construcors in abstract classes.
Also add some missing final to classes.
-rw-r--r--src/being/actor.h4
-rw-r--r--src/being/playerrelations.h18
-rw-r--r--src/configuration.h4
-rw-r--r--src/dragdrop.h2
-rw-r--r--src/equipment.h2
-rw-r--r--src/gui/debugwindow.h9
-rw-r--r--src/gui/widgets/characterviewbase.h18
-rw-r--r--src/gui/widgets/layout.h32
-rw-r--r--src/gui/widgets/setupitem.h52
-rw-r--r--src/gui/widgets/setuptab.h4
-rw-r--r--src/gui/widgets/shortcutcontainer.h10
-rw-r--r--src/gui/widgets/tablemodel.h9
-rw-r--r--src/gui/widgets/widget2.h26
-rw-r--r--src/gui/widgets/widgetgroup.h8
-rw-r--r--src/net/ea/beinghandler.h5
-rw-r--r--src/net/ea/charserverhandler.h4
-rw-r--r--src/net/ea/inventoryhandler.h4
-rw-r--r--src/net/ea/loginhandler.h4
-rw-r--r--src/net/ea/npchandler.h4
-rw-r--r--src/net/loginhandler.h8
-rw-r--r--src/net/messagehandler.h10
-rw-r--r--src/render/graphics.h9
-rw-r--r--src/resources/imagehelper.h6
-rw-r--r--src/sprite.h10
24 files changed, 133 insertions, 129 deletions
diff --git a/src/being/actor.h b/src/being/actor.h
index 9467c87eb..03f301a78 100644
--- a/src/being/actor.h
+++ b/src/being/actor.h
@@ -38,8 +38,6 @@ typedef Actors::const_iterator ActorsCIter;
class Actor
{
public:
- Actor();
-
A_DELETE_COPY(Actor)
virtual ~Actor();
@@ -130,6 +128,8 @@ public:
{ return mMap; }
protected:
+ Actor();
+
Map *mMap;
Vector mPos; /**< Position in pixels relative to map. */
int mYDiff;
diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h
index 5d11b5b25..c24363fcf 100644
--- a/src/being/playerrelations.h
+++ b/src/being/playerrelations.h
@@ -79,12 +79,6 @@ class PlayerIgnoreStrategy
std::string mDescription;
std::string mShortName;
- PlayerIgnoreStrategy() :
- mDescription(),
- mShortName()
- {
- }
-
A_DELETE_COPY(PlayerIgnoreStrategy)
virtual ~PlayerIgnoreStrategy()
@@ -95,13 +89,17 @@ class PlayerIgnoreStrategy
*/
virtual void ignore(Being *const being,
const unsigned int flags) const = 0;
+ protected:
+ PlayerIgnoreStrategy() :
+ mDescription(),
+ mShortName()
+ {
+ }
};
class PlayerRelationsListener
{
public:
- PlayerRelationsListener()
- { }
virtual ~PlayerRelationsListener()
{ }
@@ -109,6 +107,10 @@ class PlayerRelationsListener
virtual void updatedPlayer(const std::string &name) = 0;
virtual void updateAll() = 0;
+
+ protected:
+ PlayerRelationsListener()
+ { }
};
/**
diff --git a/src/configuration.h b/src/configuration.h
index 5c36ca4e6..85e55d14a 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -83,8 +83,6 @@ class ConfigurationObject
friend class Configuration;
public:
- ConfigurationObject();
-
virtual ~ConfigurationObject();
/**
@@ -208,6 +206,8 @@ class ConfigurationObject
#endif
protected:
+ ConfigurationObject();
+
virtual void initFromXML(const XmlNodePtr parent_node);
virtual void writeToXML(const XmlTextWriterPtr writer);
diff --git a/src/dragdrop.h b/src/dragdrop.h
index 3d3a4eba3..d282d82e3 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -49,7 +49,7 @@ enum DragDropSource
DRAGDROP_SOURCE_EQUIPMENT
};
-class DragDrop
+class DragDrop final
{
public:
DragDrop(Item *const item, const DragDropSource source) :
diff --git a/src/equipment.h b/src/equipment.h
index 10103f205..93c488bdf 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -29,7 +29,7 @@ static const int EQUIPMENT_SIZE = 13;
class Item;
-class Equipment
+class Equipment final
{
public:
/**
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 3a6fa7229..ef67df432 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -34,10 +34,6 @@ class DebugTab : public Container
friend class DebugWindow;
public:
- explicit DebugTab(const Widget2 *const widget) :
- Container(widget)
- { }
-
A_DELETE_COPY(DebugTab)
void logic() override = 0;
@@ -45,7 +41,10 @@ class DebugTab : public Container
void resize(const int x, const int y)
{ setDimension(gcn::Rectangle(0, 0, x, y)); }
- private:
+ protected:
+ explicit DebugTab(const Widget2 *const widget) :
+ Container(widget)
+ { }
};
class MapDebugTab final : public DebugTab
diff --git a/src/gui/widgets/characterviewbase.h b/src/gui/widgets/characterviewbase.h
index 2c90bb1e6..8ef949b7c 100644
--- a/src/gui/widgets/characterviewbase.h
+++ b/src/gui/widgets/characterviewbase.h
@@ -33,15 +33,6 @@ class CharacterViewBase : public Container,
public gcn::ActionListener
{
public:
- CharacterViewBase(CharSelectDialog *const widget, const int padding) :
- Container(widget),
- gcn::ActionListener(),
- mParent(widget),
- mPadding(padding),
- mSelected(0)
- {
- }
-
A_DELETE_COPY(CharacterViewBase)
virtual ~CharacterViewBase()
@@ -57,6 +48,15 @@ class CharacterViewBase : public Container,
}
protected:
+ CharacterViewBase(CharSelectDialog *const widget, const int padding) :
+ Container(widget),
+ gcn::ActionListener(),
+ mParent(widget),
+ mPadding(padding),
+ mSelected(0)
+ {
+ }
+
CharSelectDialog *mParent;
int mPadding;
int mSelected;
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 33930c69e..8a33f03f6 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -173,22 +173,6 @@ class LayoutCell
FILL
};
- LayoutCell():
- mWidget(nullptr),
- mHPadding(0),
- mVPadding(0),
- mType(NONE)
- {
- mExtent[0] = 0;
- mExtent[1] = 0;
- mAlign[0] = 0;
- mAlign[1] = 0;
- mNbFill[0] = 0;
- mNbFill[1] = 0;
- mSize[0] = 0;
- mSize[1] = 0;
- }
-
virtual ~LayoutCell();
/**
@@ -286,6 +270,22 @@ class LayoutCell
};
private:
+ LayoutCell():
+ mWidget(nullptr),
+ mHPadding(0),
+ mVPadding(0),
+ mType(NONE)
+ {
+ mExtent[0] = 0;
+ mExtent[1] = 0;
+ mAlign[0] = 0;
+ mAlign[1] = 0;
+ mNbFill[0] = 0;
+ mNbFill[1] = 0;
+ mSize[0] = 0;
+ mSize[1] = 0;
+ }
+
// Copy not allowed, as the cell may own an array.
explicit LayoutCell(LayoutCell const &);
LayoutCell &operator=(LayoutCell const &);
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 476a31ae4..9c5cc11e3 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -57,15 +57,6 @@ class SetupItem : public gcn::ActionListener,
VNONE
};
- SetupItem(const std::string &text, const std::string &description,
- const std::string &keyName, SetupTabScroll *const parent,
- const std::string &eventName, const bool mainConfig);
-
- SetupItem(const std::string &text, const std::string &description,
- const std::string &keyName, SetupTabScroll *const parent,
- const std::string &eventName, const std::string &def,
- const bool mainConfig);
-
A_DELETE_COPY(SetupItem)
~SetupItem();
@@ -106,6 +97,15 @@ class SetupItem : public gcn::ActionListener,
void rereadValue();
protected:
+ SetupItem(const std::string &text, const std::string &description,
+ const std::string &keyName, SetupTabScroll *const parent,
+ const std::string &eventName, const bool mainConfig);
+
+ SetupItem(const std::string &text, const std::string &description,
+ const std::string &keyName, SetupTabScroll *const parent,
+ const std::string &eventName, const std::string &def,
+ const bool mainConfig);
+
std::string mText;
std::string mDescription;
@@ -427,6 +427,23 @@ class SetupItemSlider2 final : public SetupItem
class SetupItemSliderList : public SetupItem
{
public:
+ A_DELETE_COPY(SetupItemSliderList)
+
+ ~SetupItemSliderList();
+
+ void createControls();
+
+ void fromWidget() override;
+
+ void toWidget() override;
+
+ virtual void action(const gcn::ActionEvent &event) override;
+
+ void apply(const std::string &eventName) override;
+
+ virtual void addMoreControls() = 0;
+
+ protected:
SetupItemSliderList(const std::string &text,
const std::string &description,
const std::string &keyName,
@@ -446,23 +463,6 @@ class SetupItemSliderList : public SetupItem
const bool onTheFly = false,
const bool mainConfig = true);
- A_DELETE_COPY(SetupItemSliderList)
-
- ~SetupItemSliderList();
-
- void createControls();
-
- void fromWidget() override;
-
- void toWidget() override;
-
- virtual void action(const gcn::ActionEvent &event) override;
-
- void apply(const std::string &eventName) override;
-
- virtual void addMoreControls() = 0;
-
- protected:
HorizontContainer *mHorizont;
Label *mLabel;
SliderList *mSlider;
diff --git a/src/gui/widgets/setuptab.h b/src/gui/widgets/setuptab.h
index 8e656234f..ab866ba28 100644
--- a/src/gui/widgets/setuptab.h
+++ b/src/gui/widgets/setuptab.h
@@ -40,8 +40,6 @@ class SetupTab : public Container,
public gcn::WidgetListener
{
public:
- explicit SetupTab(const Widget2 *const widget);
-
A_DELETE_COPY(SetupTab)
const std::string &getName() const A_WARN_UNUSED
@@ -60,6 +58,8 @@ class SetupTab : public Container,
virtual void externalUpdated();
protected:
+ explicit SetupTab(const Widget2 *const widget);
+
/**
* Sets the name displayed on the tab. Should be set in the
* constructor of a subclass.
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index 2f6a48bc4..60c1bb539 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -43,11 +43,6 @@ class ShortcutContainer : public gcn::Widget,
public gcn::MouseListener
{
public:
- /**
- * Constructor. Initializes the shortcut container.
- */
- ShortcutContainer();
-
A_DELETE_COPY(ShortcutContainer)
/**
@@ -99,6 +94,11 @@ class ShortcutContainer : public gcn::Widget,
protected:
/**
+ * Constructor. Initializes the shortcut container.
+ */
+ ShortcutContainer();
+
+ /**
* Gets the index from the grid provided the point is in an item box.
*
* @param pointX X coordinate of the point.
diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h
index 427b8bf3a..7d7daacb9 100644
--- a/src/gui/widgets/tablemodel.h
+++ b/src/gui/widgets/tablemodel.h
@@ -57,10 +57,6 @@ public:
class TableModel
{
public:
- TableModel() :
- listeners()
- {
- }
virtual ~TableModel()
{ }
@@ -95,6 +91,11 @@ public:
virtual void removeListener(TableModelListener *const listener);
protected:
+ TableModel() :
+ listeners()
+ {
+ }
+
/**
* Tells all listeners that the table is about to see an update
*/
diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h
index 9e164046b..0ab171b3e 100644
--- a/src/gui/widgets/widget2.h
+++ b/src/gui/widgets/widget2.h
@@ -29,19 +29,6 @@
class Widget2
{
public:
- Widget2() :
- mPaletteOffset(0),
- mForegroundColor2()
- {
- }
-
- explicit Widget2(const Widget2 *const widget) :
- mPaletteOffset(widget ? widget->mPaletteOffset : 0),
- mForegroundColor2()
- {
- checkPalette();
- }
-
virtual ~Widget2()
{
}
@@ -91,6 +78,19 @@ class Widget2
}
protected:
+ Widget2() :
+ mPaletteOffset(0),
+ mForegroundColor2()
+ {
+ }
+
+ explicit Widget2(const Widget2 *const widget) :
+ mPaletteOffset(widget ? widget->mPaletteOffset : 0),
+ mForegroundColor2()
+ {
+ checkPalette();
+ }
+
int mPaletteOffset;
gcn::Color mForegroundColor2;
};
diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h
index 55507f316..308c8fb8a 100644
--- a/src/gui/widgets/widgetgroup.h
+++ b/src/gui/widgets/widgetgroup.h
@@ -33,10 +33,6 @@ class WidgetGroup : public Container,
public gcn::ActionListener
{
public:
- WidgetGroup(const Widget2 *const widget,
- const std::string &group, const int height,
- const int spacing);
-
A_DELETE_COPY(WidgetGroup)
virtual void addButton(const std::string &tag);
@@ -57,6 +53,10 @@ class WidgetGroup : public Container,
const A_WARN_UNUSED = 0;
protected:
+ WidgetGroup(const Widget2 *const widget,
+ const std::string &group, const int height,
+ const int spacing);
+
int mSpacing;
int mCount;
std::string mGroup;
diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h
index ad57e128e..c27d7c2da 100644
--- a/src/net/ea/beinghandler.h
+++ b/src/net/ea/beinghandler.h
@@ -31,11 +31,11 @@ namespace Ea
class BeingHandler : public Net::BeingHandler
{
public:
- explicit BeingHandler(const bool enableSync);
-
A_DELETE_COPY(BeingHandler)
protected:
+ explicit BeingHandler(const bool enableSync);
+
virtual Being *createBeing(int id, int16_t job) const A_WARN_UNUSED;
virtual void setSprite(Being *const being, const unsigned int slot,
@@ -94,7 +94,6 @@ class BeingHandler : public Net::BeingHandler
virtual void processPvpSet(Net::MessageIn &msg) const;
- protected:
// Should we honor server "Stop Walking" packets
bool mSync;
int mSpawnId;
diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h
index 83da865a1..01012353f 100644
--- a/src/net/ea/charserverhandler.h
+++ b/src/net/ea/charserverhandler.h
@@ -38,8 +38,6 @@ class Network;
class CharServerHandler : public Net::CharServerHandler
{
public:
- CharServerHandler();
-
A_DELETE_COPY(CharServerHandler)
virtual void setCharSelectDialog(CharSelectDialog *const window)
@@ -85,6 +83,8 @@ class CharServerHandler : public Net::CharServerHandler
virtual void clear() override;
protected:
+ CharServerHandler();
+
virtual void readPlayerData(Net::MessageIn &msg,
Net::Character *const character,
const bool withColors) const = 0;
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index eade97b6e..fa255e213 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -146,8 +146,6 @@ class InventoryHandler : public Net::InventoryHandler
CART
};
- InventoryHandler();
-
A_DELETE_COPY(InventoryHandler)
~InventoryHandler();
@@ -208,6 +206,8 @@ class InventoryHandler : public Net::InventoryHandler
{ return mStorage; }
protected:
+ InventoryHandler();
+
EquipBackend mEquips;
InventoryItems mInventoryItems;
Inventory *mStorage;
diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h
index e6dadac2e..05d819ffe 100644
--- a/src/net/ea/loginhandler.h
+++ b/src/net/ea/loginhandler.h
@@ -38,8 +38,6 @@ namespace Ea
class LoginHandler : public Net::LoginHandler
{
public:
- LoginHandler();
-
A_DELETE_COPY(LoginHandler)
~LoginHandler();
@@ -92,6 +90,8 @@ class LoginHandler : public Net::LoginHandler
virtual void processServerVersion(Net::MessageIn &msg) = 0;
protected:
+ LoginHandler();
+
virtual void sendLoginRegister(const std::string &username,
const std::string &password,
const std::string &email) const = 0;
diff --git a/src/net/ea/npchandler.h b/src/net/ea/npchandler.h
index 714bc594c..21fd35629 100644
--- a/src/net/ea/npchandler.h
+++ b/src/net/ea/npchandler.h
@@ -34,8 +34,6 @@ namespace Ea
class NpcHandler : public Net::NpcHandler
{
public:
- NpcHandler();
-
A_DELETE_COPY(NpcHandler)
void sendLetter(int npcId, const std::string &recipient,
@@ -61,6 +59,8 @@ class NpcHandler : public Net::NpcHandler
void processNpcStrInput(Net::MessageIn &msg);
protected:
+ NpcHandler();
+
NpcDialog *mDialog;
};
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index d3bbdddb7..019e9b846 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -103,15 +103,15 @@ class LoginHandler
virtual void clearWorlds() = 0;
+ virtual ~LoginHandler()
+ { }
+
+ protected:
LoginHandler() :
mServer()
{
}
- virtual ~LoginHandler()
- { }
-
- protected:
ServerInfo mServer;
};
diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h
index c438ed679..497934bd8 100644
--- a/src/net/messagehandler.h
+++ b/src/net/messagehandler.h
@@ -42,15 +42,17 @@ class MessageHandler
virtual void handleMessage(MessageIn &msg) = 0;
- MessageHandler() :
- handledMessages(nullptr)
- {
- }
A_DELETE_COPY(MessageHandler)
virtual ~MessageHandler()
{ }
+
+ protected:
+ MessageHandler() :
+ handledMessages(nullptr)
+ {
+ }
};
} // namespace Net
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 12df83aef..fa2416750 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -97,10 +97,6 @@ class ImageRect final
class Graphics : public gcn::Graphics
{
public:
- /**
- * Constructor.
- */
- Graphics();
A_DELETE_COPY(Graphics)
@@ -380,6 +376,11 @@ class Graphics : public gcn::Graphics
protected:
/**
+ * Constructor.
+ */
+ Graphics();
+
+ /**
* Blits an image onto the screen.
*
* @return <code>true</code> if the image was blitted properly
diff --git a/src/resources/imagehelper.h b/src/resources/imagehelper.h
index b09d21d4a..b22a609a6 100644
--- a/src/resources/imagehelper.h
+++ b/src/resources/imagehelper.h
@@ -43,9 +43,6 @@ class ImageHelper
friend class Image;
public:
- ImageHelper()
- { }
-
A_DELETE_COPY(ImageHelper)
virtual ~ImageHelper()
@@ -102,6 +99,9 @@ class ImageHelper
{ return mUseOpenGL; }
protected:
+ ImageHelper()
+ { }
+
static bool mEnableAlpha;
static RenderType mUseOpenGL;
};
diff --git a/src/sprite.h b/src/sprite.h
index 8fb78b248..3ec3fe00d 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -32,11 +32,6 @@ class Image;
class Sprite
{
public:
- Sprite() :
- mAlpha()
- {
- }
-
virtual ~Sprite()
{ }
@@ -122,6 +117,11 @@ class Sprite
virtual bool updateNumber(const unsigned num) = 0;
protected:
+ Sprite() :
+ mAlpha()
+ {
+ }
+
float mAlpha; /**< The alpha opacity used to draw */
};