refactor(Core): apply clang-tidy modernize-use-equals-default (#3834)

This commit is contained in:
Francesco Borzì
2020-12-07 19:21:55 +01:00
committed by GitHub
parent 0b8ec1f6ee
commit 1cf39b3d22
35 changed files with 48 additions and 56 deletions

View File

@@ -39,7 +39,7 @@ namespace VMAP
public: public:
IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) { } IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) { }
virtual ~IVMapManager() { } virtual ~IVMapManager() = default;
virtual int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0; virtual int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0;

View File

@@ -38,7 +38,7 @@ public:
/* Activity state */ /* Activity state */
DatabaseWorkerPool(); DatabaseWorkerPool();
~DatabaseWorkerPool() { } ~DatabaseWorkerPool() = default;
bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads); bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads);

View File

@@ -27,7 +27,7 @@ enum ConnectionFlags
struct MySQLConnectionInfo struct MySQLConnectionInfo
{ {
MySQLConnectionInfo() { } MySQLConnectionInfo() = default;
MySQLConnectionInfo(const std::string& infoString) MySQLConnectionInfo(const std::string& infoString)
{ {
Tokenizer tokens(infoString, ';'); Tokenizer tokens(infoString, ';');

View File

@@ -16,7 +16,7 @@ private:
typedef std::pair<SQLElementData, SQLResultSetUnion> SQLResultPair; typedef std::pair<SQLElementData, SQLResultSetUnion> SQLResultPair;
std::vector<SQLResultPair> m_queries; std::vector<SQLResultPair> m_queries;
public: public:
SQLQueryHolder() { } SQLQueryHolder() = default;
~SQLQueryHolder(); ~SQLQueryHolder();
bool SetQuery(size_t index, const char* sql); bool SetQuery(size_t index, const char* sql);
bool SetPQuery(size_t index, const char* format, ...) ATTR_PRINTF(3, 4); bool SetPQuery(size_t index, const char* format, ...) ATTR_PRINTF(3, 4);

View File

@@ -49,7 +49,7 @@ class TransactionTask : public SQLOperation
public: public:
TransactionTask(SQLTransaction trans) : m_trans(trans) { } ; TransactionTask(SQLTransaction trans) : m_trans(trans) { } ;
~TransactionTask() override { }; ~TransactionTask() override = default;
protected: protected:
bool Execute() override; bool Execute() override;

View File

@@ -15,7 +15,7 @@ template <class TO, class FROM> class RefManager : public LinkedListHead
{ {
public: public:
typedef LinkedListHead::Iterator< Reference<TO, FROM>> iterator; typedef LinkedListHead::Iterator< Reference<TO, FROM>> iterator;
RefManager() { } RefManager() = default;
virtual ~RefManager() { clearReferences(); } virtual ~RefManager() { clearReferences(); }
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM>*) LinkedListHead::getFirst()); } Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM>*) LinkedListHead::getFirst()); }

View File

@@ -28,7 +28,7 @@ protected:
virtual void sourceObjectDestroyLink() = 0; virtual void sourceObjectDestroyLink() = 0;
public: public:
Reference() { iRefTo = nullptr; iRefFrom = nullptr; } Reference() { iRefTo = nullptr; iRefFrom = nullptr; }
virtual ~Reference() { } virtual ~Reference() = default;
// Create new link // Create new link
void link(TO* toObj, FROM* fromObj) void link(TO* toObj, FROM* fromObj)

View File

@@ -22,7 +22,7 @@
class ByteBufferException : public std::exception class ByteBufferException : public std::exception
{ {
public: public:
~ByteBufferException() noexcept override { } ~ByteBufferException() noexcept override = default;
[[nodiscard]] char const* what() const noexcept override { return msg_.c_str(); } [[nodiscard]] char const* what() const noexcept override { return msg_.c_str(); }
@@ -37,15 +37,14 @@ class ByteBufferPositionException : public ByteBufferException
{ {
public: public:
ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize); ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize);
~ByteBufferPositionException() noexcept override { } ~ByteBufferPositionException() noexcept override = default;
}; };
class ByteBufferSourceException : public ByteBufferException class ByteBufferSourceException : public ByteBufferException
{ {
public: public:
ByteBufferSourceException(size_t pos, size_t size, size_t valueSize); ByteBufferSourceException(size_t pos, size_t size, size_t valueSize);
~ByteBufferSourceException() noexcept override = default;
~ByteBufferSourceException() noexcept override { }
}; };
class ByteBuffer class ByteBuffer

View File

@@ -36,9 +36,7 @@ namespace ACE_Based
} }
//! Destroy a LockedQueue. //! Destroy a LockedQueue.
virtual ~LockedQueue() virtual ~LockedQueue() = default;
{
}
//! Adds an item to the queue. //! Adds an item to the queue.
void add(const T& item) void add(const T& item)

View File

@@ -18,7 +18,7 @@ namespace acore
class Runnable class Runnable
{ {
public: public:
virtual ~Runnable() {} virtual ~Runnable() = default;
virtual void run() = 0; virtual void run() = 0;
void incReference() { ++m_refs; } void incReference() { ++m_refs; }

View File

@@ -22,7 +22,7 @@ public:
m_addTime = 0; m_addTime = 0;
m_execTime = 0; m_execTime = 0;
} }
virtual ~BasicEvent() { } // override destructor to perform some actions on event removal virtual ~BasicEvent() = default; // override destructor to perform some actions on event removal
// this method executes when the event is triggered // this method executes when the event is triggered
// return false if event does not want to be deleted // return false if event does not want to be deleted

View File

@@ -188,7 +188,7 @@ AuthSocket::AuthSocket(RealmSocket& socket) :
} }
// Close patch file descriptor before leaving // Close patch file descriptor before leaving
AuthSocket::~AuthSocket() { } AuthSocket::~AuthSocket() = default;
// Accept the connection // Accept the connection
void AuthSocket::OnAccept() void AuthSocket::OnAccept()

View File

@@ -16,7 +16,7 @@
class RealmAcceptor : public ACE_Acceptor<RealmSocket, ACE_SOCK_Acceptor> class RealmAcceptor : public ACE_Acceptor<RealmSocket, ACE_SOCK_Acceptor>
{ {
public: public:
RealmAcceptor() { } RealmAcceptor() = default;
virtual ~RealmAcceptor() virtual ~RealmAcceptor()
{ {
if (reactor()) if (reactor())

View File

@@ -295,8 +295,8 @@ private:
class AchievementGlobalMgr class AchievementGlobalMgr
{ {
AchievementGlobalMgr() {} AchievementGlobalMgr() = default;
~AchievementGlobalMgr() {} ~AchievementGlobalMgr() = default;
public: public:
static AchievementGlobalMgr* instance(); static AchievementGlobalMgr* instance();

View File

@@ -246,7 +246,7 @@ struct BattlegroundScore
DamageDone(0), HealingDone(0), player(player) DamageDone(0), HealingDone(0), player(player)
{ } { }
virtual ~BattlegroundScore() { } //virtual destructor is used when deleting score from scores map virtual ~BattlegroundScore() = default; //virtual destructor is used when deleting score from scores map
uint32 KillingBlows; uint32 KillingBlows;
uint32 Deaths; uint32 Deaths;

View File

@@ -29,7 +29,7 @@ class TempSummon : public Creature
{ {
public: public:
explicit TempSummon(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject); explicit TempSummon(SummonPropertiesEntry const* properties, uint64 owner, bool isWorldObject);
~TempSummon() override {} ~TempSummon() override = default;
void Update(uint32 time) override; void Update(uint32 time) override;
virtual void InitStats(uint32 lifetime); virtual void InitStats(uint32 lifetime);
virtual void InitSummon(); virtual void InitSummon();

View File

@@ -958,7 +958,7 @@ class PlayerTaxi
{ {
public: public:
PlayerTaxi(); PlayerTaxi();
~PlayerTaxi() {} ~PlayerTaxi() = default;
// Nodes // Nodes
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level); void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level);
void LoadTaxiMask(std::string const& data); void LoadTaxiMask(std::string const& data);

View File

@@ -1077,7 +1077,7 @@ typedef std::unordered_map<uint32 /*category*/, GlobalCooldown> GlobalCooldownLi
class GlobalCooldownMgr // Shared by Player and CharmInfo class GlobalCooldownMgr // Shared by Player and CharmInfo
{ {
public: public:
GlobalCooldownMgr() {} GlobalCooldownMgr() = default;
public: public:
bool HasGlobalCooldown(SpellInfo const* spellInfo) const; bool HasGlobalCooldown(SpellInfo const* spellInfo) const;
@@ -1303,7 +1303,7 @@ struct SpellProcEventEntry; // used only private
class MMapTargetData class MMapTargetData
{ {
public: public:
MMapTargetData() {} MMapTargetData() = default;
MMapTargetData(uint32 endTime, const Position* o, const Position* t) MMapTargetData(uint32 endTime, const Position* o, const Position* t)
{ {
_endTime = endTime; _endTime = endTime;

View File

@@ -95,8 +95,8 @@ typedef std::map<int8, VehicleSeat> SeatMap;
class TransportBase class TransportBase
{ {
protected: protected:
TransportBase() { } TransportBase() = default;
virtual ~TransportBase() { } virtual ~TransportBase() = default;
public: public:
/// This method transforms supplied transport offsets into global coordinates /// This method transforms supplied transport offsets into global coordinates

View File

@@ -83,7 +83,7 @@ class GameEventMgr
{ {
private: private:
GameEventMgr(); GameEventMgr();
~GameEventMgr() {}; ~GameEventMgr() = default;;
public: public:
static GameEventMgr* instance(); static GameEventMgr* instance();

View File

@@ -62,7 +62,7 @@ public:
private: private:
//Non instanceable only static //Non instanceable only static
HashMapHolder() {} HashMapHolder() = default;
static LockType i_lock; static LockType i_lock;
static MapType m_objectMap; static MapType m_objectMap;

View File

@@ -17,7 +17,7 @@ class WorldObject;
struct CellArea struct CellArea
{ {
CellArea() {} CellArea() = default;
CellArea(CellCoord low, CellCoord high) : low_bound(low), high_bound(high) {} CellArea(CellCoord low, CellCoord high) : low_bound(low), high_bound(high) {}
bool operator!() const { return low_bound == high_bound; } bool operator!() const { return low_bound == high_bound; }

View File

@@ -40,7 +40,7 @@ public:
/** destructor to clean up its resources. This includes unloading the /** destructor to clean up its resources. This includes unloading the
grid if it has not been unload. grid if it has not been unload.
*/ */
~Grid() {} ~Grid() = default;
/** an object of interested enters the grid /** an object of interested enters the grid
*/ */

View File

@@ -159,7 +159,7 @@ struct LootItem
// Should be called for non-reference LootStoreItem entries only (reference = 0) // Should be called for non-reference LootStoreItem entries only (reference = 0)
explicit LootItem(LootStoreItem const& li); explicit LootItem(LootStoreItem const& li);
LootItem() {} LootItem() = default;
// Basic checks for player/item compatibility - if false no chance to see the item in the loot // Basic checks for player/item compatibility - if false no chance to see the item in the loot
bool AllowedForPlayer(Player const* player) const; bool AllowedForPlayer(Player const* player) const;
@@ -233,7 +233,7 @@ class LootTemplate
typedef std::vector<LootGroup*> LootGroups; typedef std::vector<LootGroup*> LootGroups;
public: public:
LootTemplate() { } LootTemplate() = default;
~LootTemplate(); ~LootTemplate();
// Adds an entry to the group (at loading stage) // Adds an entry to the group (at loading stage)
@@ -268,7 +268,7 @@ private:
class LootValidatorRef : public Reference<Loot, LootValidatorRef> class LootValidatorRef : public Reference<Loot, LootValidatorRef>
{ {
public: public:
LootValidatorRef() {} LootValidatorRef() = default;
void targetObjectDestroyLink() override {} void targetObjectDestroyLink() override {}
void sourceObjectDestroyLink() override {} void sourceObjectDestroyLink() override {}
}; };

View File

@@ -27,7 +27,7 @@ namespace Movement
FacingInfo(float o) : angle(o) {} FacingInfo(float o) : angle(o) {}
FacingInfo(uint64 t) : target(t) {} FacingInfo(uint64 t) : target(t) {}
FacingInfo() {} FacingInfo() = default;
}; };
struct MoveSplineInitArgs struct MoveSplineInitArgs

View File

@@ -139,7 +139,7 @@ namespace Movement
[[nodiscard]] index_type computeIndexInBounds(length_type length) const; [[nodiscard]] index_type computeIndexInBounds(length_type length) const;
public: public:
explicit Spline() {} explicit Spline() = default;
/** Calculates the position for given t /** Calculates the position for given t
@param t - percent of spline's length, assumes that t in range [0, 1]. */ @param t - percent of spline's length, assumes that t in range [0, 1]. */

View File

@@ -164,9 +164,7 @@ protected:
{ {
} }
virtual ~ScriptObject() virtual ~ScriptObject() = default;
{
}
private: private:
@@ -177,9 +175,7 @@ template<class TObject> class UpdatableScript
{ {
protected: protected:
UpdatableScript() UpdatableScript() = default;
{
}
public: public:

View File

@@ -120,7 +120,7 @@ class PacketFilter
{ {
public: public:
explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) {} explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) {}
virtual ~PacketFilter() {} virtual ~PacketFilter() = default;
virtual bool Process(WorldPacket* /*packet*/) { return true; } virtual bool Process(WorldPacket* /*packet*/) { return true; }
[[nodiscard]] virtual bool ProcessLogout() const { return true; } [[nodiscard]] virtual bool ProcessLogout() const { return true; }
@@ -133,7 +133,7 @@ class MapSessionFilter : public PacketFilter
{ {
public: public:
explicit MapSessionFilter(WorldSession* pSession) : PacketFilter(pSession) {} explicit MapSessionFilter(WorldSession* pSession) : PacketFilter(pSession) {}
~MapSessionFilter() override {} ~MapSessionFilter() override = default;
bool Process(WorldPacket* packet) override; bool Process(WorldPacket* packet) override;
//in Map::Update() we do not process player logout! //in Map::Update() we do not process player logout!
@@ -146,7 +146,7 @@ class WorldSessionFilter : public PacketFilter
{ {
public: public:
explicit WorldSessionFilter(WorldSession* pSession) : PacketFilter(pSession) {} explicit WorldSessionFilter(WorldSession* pSession) : PacketFilter(pSession) {}
~WorldSessionFilter() override {} ~WorldSessionFilter() override = default;
bool Process(WorldPacket* packet) override; bool Process(WorldPacket* packet) override;
}; };
@@ -181,7 +181,7 @@ protected:
uint8 CharCount; uint8 CharCount;
private: private:
virtual ~CharacterCreateInfo() {}; virtual ~CharacterCreateInfo() = default;;
}; };
struct PacketCounter struct PacketCounter

View File

@@ -55,7 +55,7 @@ class Weather
public: public:
Weather(uint32 zone, WeatherData const* weatherChances); Weather(uint32 zone, WeatherData const* weatherChances);
~Weather() { }; ~Weather() = default;;
bool Update(uint32 diff); bool Update(uint32 diff);
bool ReGenerate(); bool ReGenerate();

View File

@@ -11,9 +11,10 @@
#include "RealmSocket.h" #include "RealmSocket.h"
#include "Log.h" #include "Log.h"
RealmSocket::Session::Session() { }
RealmSocket::Session::~Session() { } RealmSocket::Session::Session() = default;
RealmSocket::Session::~Session() = default;
RealmSocket::RealmSocket() : RealmSocket::RealmSocket() :
input_buffer_(4096), session_(nullptr), input_buffer_(4096), session_(nullptr),

View File

@@ -46,7 +46,7 @@ public:
typedef std::map<std::string, Realm> RealmMap; typedef std::map<std::string, Realm> RealmMap;
RealmList(); RealmList();
~RealmList() { } ~RealmList() = default;
static RealmList* instance(); static RealmList* instance();

View File

@@ -24,8 +24,7 @@ public:
public: public:
Exception(const std::string& message): message(message) Exception(const std::string& message): message(message)
{ } { }
virtual ~Exception() virtual ~Exception() = default;
{ }
const std::string& getMessage() {return message;} const std::string& getMessage() {return message;}
private: private:
std::string message; std::string message;

View File

@@ -30,7 +30,7 @@ namespace MMAP
MapTiles() : m_mapId(uint32(-1)), m_tiles(nullptr) {} MapTiles() : m_mapId(uint32(-1)), m_tiles(nullptr) {}
MapTiles(uint32 id, std::set<uint32>* tiles) : m_mapId(id), m_tiles(tiles) {} MapTiles(uint32 id, std::set<uint32>* tiles) : m_mapId(id), m_tiles(tiles) {}
~MapTiles() {} ~MapTiles() = default;
uint32 m_mapId; uint32 m_mapId;
std::set<uint32>* m_tiles; std::set<uint32>* m_tiles;

View File

@@ -73,7 +73,7 @@ namespace MMAP
char const* MAP_VERSION_MAGIC = "v1.8"; char const* MAP_VERSION_MAGIC = "v1.8";
TerrainBuilder::TerrainBuilder(bool skipLiquid) : m_skipLiquid (skipLiquid) { } TerrainBuilder::TerrainBuilder(bool skipLiquid) : m_skipLiquid (skipLiquid) { }
TerrainBuilder::~TerrainBuilder() { } TerrainBuilder::~TerrainBuilder() = default;
/**************************************************************************/ /**************************************************************************/
void TerrainBuilder::getLoopVars(Spot portion, int& loopStart, int& loopEnd, int& loopInc) void TerrainBuilder::getLoopVars(Spot portion, int& loopStart, int& loopEnd, int& loopInc)

View File

@@ -27,8 +27,7 @@ public:
public: public:
Exception(const std::string& message): message(message) Exception(const std::string& message): message(message)
{ } { }
virtual ~Exception() virtual ~Exception() = default;
{ }
const std::string& getMessage() {return message;} const std::string& getMessage() {return message;}
private: private:
std::string message; std::string message;