Core/Misc: Make string and string_view literal suffixes globally available
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
using namespace std::string_literals;
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
#define STRINGIZE(a) #a
|
||||
|
||||
enum TimeConstants
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "Config.h"
|
||||
#include "Common.h"
|
||||
#include "Log.h"
|
||||
#include "StringConvert.h"
|
||||
#include <boost/filesystem/directory.hpp>
|
||||
@@ -68,8 +69,6 @@ namespace
|
||||
// LogDB.Opt.ClearTime => LOG_DB_OPT_CLEAR_TIME
|
||||
std::string IniKeyToEnvVarKey(std::string_view const& key)
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
std::string result;
|
||||
|
||||
size_t n = key.length();
|
||||
@@ -317,8 +316,6 @@ std::string ConfigMgr::GetStringDefault(std::string_view name, std::string_view
|
||||
|
||||
bool ConfigMgr::GetBoolDefault(std::string_view name, bool def, bool quiet) const
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
std::string val = GetValueDefault<std::string_view, std::string>(name, def ? "1"sv : "0"sv, quiet);
|
||||
std::erase(val, '"');
|
||||
if (Optional<bool> boolVal = Trinity::StringTo<bool>(val))
|
||||
|
||||
@@ -16,14 +16,13 @@
|
||||
*/
|
||||
|
||||
#include "SRP6.h"
|
||||
#include "Common.h"
|
||||
#include "CryptoRandom.h"
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
namespace Trinity::Crypto::SRP
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
BigNumber const GruntSRP6::N = "894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"s;
|
||||
BigNumber const GruntSRP6::g = 7;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace
|
||||
{
|
||||
std::shared_ptr<Trinity::Net::Http::SessionState> ObtainSessionState(Trinity::Net::Http::RequestContext& context, boost::asio::ip::address const& remoteAddress)
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
std::shared_ptr<Trinity::Net::Http::SessionState> state;
|
||||
auto cookieItr = context.request.find(boost::beast::http::field::cookie);
|
||||
if (cookieItr != context.request.end())
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "LoginRESTService.h"
|
||||
#include "Base64.h"
|
||||
#include "Common.h"
|
||||
#include "Configuration/Config.h"
|
||||
#include "CryptoHash.h"
|
||||
#include "CryptoRandom.h"
|
||||
@@ -42,7 +43,6 @@ bool LoginRESTService::StartNetwork(Trinity::Asio::IoContext& ioContext, std::st
|
||||
if (!HttpService::StartNetwork(ioContext, bindIp, port, threadCount))
|
||||
return false;
|
||||
|
||||
using namespace std::string_view_literals;
|
||||
using Trinity::Net::Http::RequestHandlerFlag;
|
||||
|
||||
RegisterHandler(boost::beast::http::verb::get, "/bnetserver/login/"sv, [this](std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context)
|
||||
@@ -149,8 +149,6 @@ std::string const& LoginRESTService::GetHostnameForClient(boost::asio::ip::addre
|
||||
|
||||
std::string LoginRESTService::ExtractAuthorization(HttpRequest const& request)
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
std::string ticket;
|
||||
auto itr = request.find(boost::beast::http::field::authorization);
|
||||
if (itr == request.end())
|
||||
|
||||
@@ -38,8 +38,6 @@ bool HyperlinkColor::operator==(ItemQualities q) const
|
||||
// Validates a single hyperlink
|
||||
HyperlinkInfo Trinity::Hyperlinks::ParseSingleHyperlink(std::string_view str)
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
std::string_view color;
|
||||
std::string_view tag;
|
||||
std::string_view data;
|
||||
|
||||
@@ -708,8 +708,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans)
|
||||
|
||||
if (m_itemData->Gems.size())
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_GEMS);
|
||||
stmt->setUInt64(0, GetGUID().GetCounter());
|
||||
uint32 i = 0;
|
||||
|
||||
@@ -669,8 +669,6 @@ namespace
|
||||
ClientFormatFunction[AsUnderlyingType(HighGuid::type)] = &ObjectGuidInfo::format;\
|
||||
ClientParseFunction[AsUnderlyingType(HighGuid::type)] = &ObjectGuidInfo::parse
|
||||
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
SET_GUID_INFO(Null, FormatNull, ParseNull);
|
||||
SET_GUID_INFO(Uniq, FormatUniq, ParseUniq);
|
||||
SET_GUID_INFO(Player, FormatPlayer, ParsePlayer);
|
||||
|
||||
@@ -976,8 +976,6 @@ void Player::Update(uint32 p_time)
|
||||
// If mute expired, remove it from the DB
|
||||
if (GetSession()->m_muteTime && GetSession()->m_muteTime < now)
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
GetSession()->m_muteTime = 0;
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
stmt->setInt64(0, 0); // Set the mute time to 0
|
||||
|
||||
@@ -7187,8 +7187,6 @@ bool ObjectMgr::AddGraveyardLink(uint32 id, uint32 zoneId, uint32 team, bool per
|
||||
// Store graveyard condition if team is set
|
||||
if (team != 0)
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
WorldDatabasePreparedStatement* conditionStmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CONDITION);
|
||||
conditionStmt->setUInt32(0, CONDITION_SOURCE_TYPE_GRAVEYARD); // SourceTypeOrReferenceId
|
||||
conditionStmt->setUInt32(1, zoneId); // SourceGroup
|
||||
|
||||
@@ -564,8 +564,6 @@ static void StoreConfigValue(T& oldValue, std::type_identity_t<T> value, ConfigO
|
||||
/// Initialize config values
|
||||
void World::LoadConfigSettings(bool reload)
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
if (reload)
|
||||
{
|
||||
std::vector<std::string> configErrors;
|
||||
|
||||
@@ -448,8 +448,6 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY);
|
||||
stmt->setString(0, "00"sv);
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
|
||||
@@ -135,8 +135,6 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_ACCOUNT_LOCK_CONTRY);
|
||||
stmt->setString(0, "00"sv);
|
||||
stmt->setUInt32(1, handler->GetSession()->GetBattlenetAccountId());
|
||||
|
||||
@@ -1973,8 +1973,6 @@ public:
|
||||
target->GetSession()->m_muteTime = 0;
|
||||
}
|
||||
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
stmt->setInt64(0, 0);
|
||||
stmt->setString(1, ""sv);
|
||||
|
||||
@@ -1327,8 +1327,6 @@ public:
|
||||
_ShowLootContents(handler, all.has_value(), loot);
|
||||
else
|
||||
{
|
||||
using namespace std::string_view_literals;
|
||||
|
||||
for (auto const& [lootOwner, personalLoot] : creatureTarget->m_personalLoot)
|
||||
{
|
||||
CharacterCacheEntry const* character = sCharacterCache->GetCharacterCacheByGuid(lootOwner);
|
||||
|
||||
@@ -234,7 +234,7 @@ class TC_SHARED_API ByteBuffer
|
||||
uint32 value = 0;
|
||||
if (bits > 8 - int32(_bitpos))
|
||||
{
|
||||
// first retriever whatever is left in the bit buffer
|
||||
// first retrieve whatever is left in the bit buffer
|
||||
int32 bitsInBuffer = 8 - _bitpos;
|
||||
value = (_curbitval & ((UI64LIT(1) << bitsInBuffer) - 1)) << (bits - bitsInBuffer);
|
||||
bits -= bitsInBuffer;
|
||||
|
||||
Reference in New Issue
Block a user