refactor(Core): apply clang-tidy modernize-pass-by-value (#3823)

This commit is contained in:
Francesco Borzì
2020-12-13 01:11:15 +01:00
committed by GitHub
parent 282966c117
commit adf436c937
10 changed files with 36 additions and 24 deletions

View File

@@ -7,6 +7,8 @@
#ifndef _TRANSACTION_H
#define _TRANSACTION_H
#include <utility>
#include "SQLOperation.h"
//- Forward declare (don't include header to prevent circular includes)
@@ -48,7 +50,7 @@ class TransactionTask : public SQLOperation
friend class DatabaseWorker;
public:
TransactionTask(SQLTransaction trans) : m_trans(trans) { } ;
TransactionTask(SQLTransaction trans) : m_trans(std::move(trans)) { } ;
~TransactionTask() override = default;
protected:

View File

@@ -8,13 +8,14 @@
#define _ADDONMGR_H
#include "Define.h"
#include <string>
#include <list>
#include <string>
#include <utility>
struct AddonInfo
{
AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
: Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {}
AddonInfo(std::string name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
: Name(std::move(name)), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {}
std::string Name;
uint8 Enabled;
@@ -25,7 +26,7 @@ struct AddonInfo
struct SavedAddon
{
SavedAddon(const std::string& name, uint32 crc) : Name(name)
SavedAddon(std::string name, uint32 crc) : Name(std::move(name))
{
CRC = crc;
}

View File

@@ -9,6 +9,7 @@
#include "Common.h"
#include <map>
#include <utility>
struct AuctionEntry;
struct CalendarEvent;
@@ -110,8 +111,8 @@ public: // Constructors
explicit MailDraft(uint16 mailTemplateId, bool need_items = true)
: m_mailTemplateId(mailTemplateId), m_mailTemplateItemsNeed(need_items), m_money(0), m_COD(0)
{}
MailDraft(std::string const& subject, std::string const& body)
: m_mailTemplateId(0), m_mailTemplateItemsNeed(false), m_subject(subject), m_body(body), m_money(0), m_COD(0) {}
MailDraft(std::string subject, std::string body)
: m_mailTemplateId(0), m_mailTemplateItemsNeed(false), m_subject(std::move(subject)), m_body(std::move(body)), m_money(0), m_COD(0) {}
public: // Accessors
[[nodiscard]] uint16 GetMailTemplateId() const { return m_mailTemplateId; }
[[nodiscard]] std::string const& GetSubject() const { return m_subject; }

View File

@@ -11,6 +11,8 @@
#ifndef __WORLDSESSION_H
#define __WORLDSESSION_H
#include <utility>
#include "Common.h"
#include "SharedDefines.h"
#include "AddonMgr.h"
@@ -159,8 +161,8 @@ class CharacterCreateInfo
friend class Player;
protected:
CharacterCreateInfo(std::string const& name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId,
WorldPacket& data) : Name(name), Race(race), Class(cclass), Gender(gender), Skin(skin), Face(face), HairStyle(hairStyle), HairColor(hairColor), FacialHair(facialHair),
CharacterCreateInfo(std::string name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId,
WorldPacket& data) : Name(std::move(name)), Race(race), Class(cclass), Gender(gender), Skin(skin), Face(face), HairStyle(hairStyle), HairColor(hairColor), FacialHair(facialHair),
OutfitId(outfitId), Data(data), CharCount(0)
{}

View File

@@ -7,10 +7,12 @@
#define _CRT_SECURE_NO_DEPRECATE
#include "dbcfile.h"
#include "mpq_libmpq04.h"
DBCFile::DBCFile(const std::string& filename):
filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(nullptr), stringTable(nullptr)
#include "mpq_libmpq04.h"
#include <utility>
DBCFile::DBCFile(std::string filename):
filename(std::move(filename)), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(nullptr), stringTable(nullptr)
{
}

View File

@@ -8,11 +8,12 @@
#define DBCFILE_H
#include <cassert>
#include <string>
#include <utility>
class DBCFile
{
public:
DBCFile(const std::string& filename);
DBCFile(std::string filename);
~DBCFile();
// Open database. It must be openened before it can be used.
@@ -22,7 +23,7 @@ public:
class Exception
{
public:
Exception(const std::string& message): message(message)
Exception(std::string message): message(std::move(message))
{ }
virtual ~Exception() = default;
const std::string& getMessage() {return message;}

View File

@@ -10,9 +10,10 @@
#undef max
#include <cstdio>
#include <utility>
DBCFile::DBCFile(const std::string& filename):
filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(nullptr), stringTable(nullptr)
DBCFile::DBCFile(std::string filename):
filename(std::move(filename)), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(nullptr), stringTable(nullptr)
{
}

View File

@@ -9,11 +9,12 @@
#include <cassert>
#include <string>
#include <utility>
class DBCFile
{
public:
DBCFile(const std::string& filename);
DBCFile(std::string filename);
~DBCFile();
// Open database. It must be openened before it can be used.
@@ -25,7 +26,7 @@ public:
class Exception
{
public:
Exception(const std::string& message): message(message)
Exception(std::string message): message(std::move(message))
{ }
virtual ~Exception() = default;
const std::string& getMessage() {return message;}

View File

@@ -4,14 +4,15 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "vmapexport.h"
#include "wmo.h"
#include "vec3d.h"
#include "vmapexport.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <map>
#include <fstream>
#include <map>
#include <utility>
#undef min
#undef max
#include "mpq_libmpq04.h"
@@ -124,8 +125,8 @@ bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile)
return true;
}
WMOGroup::WMOGroup(const std::string& filename) :
filename(filename), MOPY(nullptr), MOVI(nullptr), MoviEx(nullptr), MOVT(nullptr), MOBA(nullptr), MobaEx(nullptr),
WMOGroup::WMOGroup(std::string filename) :
filename(std::move(filename)), MOPY(nullptr), MOVI(nullptr), MoviEx(nullptr), MOVT(nullptr), MOBA(nullptr), MobaEx(nullptr),
hlq(nullptr), LiquEx(nullptr), LiquBytes(nullptr), groupName(0), descGroupName(0), mogpFlags(0),
moprIdx(0), moprNItems(0), nBatchA(0), nBatchB(0), nBatchC(0), fogIdx(0),
liquidType(0), groupWMOID(0), mopy_size(0), moba_size(0), LiquEx_size(0),

View File

@@ -98,7 +98,7 @@ public:
int nTriangles; // number when loaded
uint32 liquflags;
WMOGroup(std::string const& filename);
WMOGroup(std::string filename);
~WMOGroup();
bool open();