mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
refactor(src/common): remove unused imports (#19506)
* refactor(src/common): remove unused imports * fix: build * chore: fix build * chore: size_t -> std::size_t * chore: fix fuckup from previous commit * chore: fix build * chore: fix build * chore: fix build * chore: fix build with std::size_t * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build
This commit is contained in:
@@ -706,7 +706,7 @@ void Channel::List(Player const* player)
|
||||
data << GetName(); // channel name
|
||||
data << uint8(GetFlags()); // channel flags?
|
||||
|
||||
size_t pos = data.wpos();
|
||||
std::size_t pos = data.wpos();
|
||||
data << uint32(0); // size of list, placeholder
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
@@ -72,10 +72,10 @@ AC_API_EXPORT EnumText EnumUtils<ChatNotify>::ToString(ChatNotify value)
|
||||
}
|
||||
|
||||
template <>
|
||||
AC_API_EXPORT size_t EnumUtils<ChatNotify>::Count() { return 36; }
|
||||
AC_API_EXPORT std::size_t EnumUtils<ChatNotify>::Count() { return 36; }
|
||||
|
||||
template <>
|
||||
AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(size_t index)
|
||||
AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(std::size_t index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(size_t index)
|
||||
}
|
||||
|
||||
template <>
|
||||
AC_API_EXPORT size_t EnumUtils<ChatNotify>::ToIndex(ChatNotify value)
|
||||
AC_API_EXPORT std::size_t EnumUtils<ChatNotify>::ToIndex(ChatNotify value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
|
||||
@@ -145,7 +145,7 @@ void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters)
|
||||
std::vector<std::string_view> tokens = Acore::Tokenize(msg, '|', true);
|
||||
std::ostringstream stream;
|
||||
|
||||
for (size_t i = 0; i < tokens.size() - 1; ++i)
|
||||
for (std::size_t i = 0; i < tokens.size() - 1; ++i)
|
||||
stream << tokens[i] << "||";
|
||||
|
||||
stream << tokens[tokens.size() - 1];
|
||||
@@ -240,11 +240,11 @@ bool ChatHandler::ParseCommands(std::string_view text)
|
||||
return _ParseCommands(text.substr(1));
|
||||
}
|
||||
|
||||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
|
||||
std::size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
|
||||
std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/,
|
||||
uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/)
|
||||
{
|
||||
size_t receiverGUIDPos = 0;
|
||||
std::size_t receiverGUIDPos = 0;
|
||||
data.Initialize(!gmMessage ? SMSG_MESSAGECHAT : SMSG_GM_MESSAGECHAT);
|
||||
data << uint8(chatType);
|
||||
data << int32(language);
|
||||
@@ -320,7 +320,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
|
||||
return receiverGUIDPos;
|
||||
}
|
||||
|
||||
size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message,
|
||||
std::size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message,
|
||||
uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/)
|
||||
{
|
||||
ObjectGuid senderGUID;
|
||||
@@ -1022,7 +1022,7 @@ void AddonChannelCommandHandler::SendSysMessage(std::string_view str, bool escap
|
||||
std::string body(str);
|
||||
if (escapeCharacters)
|
||||
boost::replace_all(body, "|", "||");
|
||||
size_t pos, lastpos;
|
||||
std::size_t pos, lastpos;
|
||||
for (lastpos = 0, pos = body.find('\n', lastpos); pos != std::string::npos; lastpos = pos + 1, pos = body.find('\n', lastpos))
|
||||
{
|
||||
std::string line(msg);
|
||||
|
||||
@@ -42,12 +42,12 @@ public:
|
||||
virtual ~ChatHandler() { }
|
||||
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
|
||||
static std::size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag,
|
||||
std::string const& senderName = "", std::string const& receiverName = "",
|
||||
uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = "");
|
||||
|
||||
// Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders
|
||||
static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE);
|
||||
static std::size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE);
|
||||
|
||||
static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuil
|
||||
std::vector<std::string_view> const tokens = Acore::Tokenize(builder._name, COMMAND_DELIMITER, false);
|
||||
ASSERT(!tokens.empty(), "Invalid command name '{}'.", builder._name);
|
||||
ChatSubCommandMap* subMap = ↦
|
||||
for (size_t i = 0, n = (tokens.size() - 1); i < n; ++i)
|
||||
for (std::size_t i = 0, n = (tokens.size() - 1); i < n; ++i)
|
||||
subMap = &((*subMap)[tokens[i]]._subCommands);
|
||||
((*subMap)[tokens.back()]).LoadFromBuilder(builder);
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace Acore::Impl::ChatCommands
|
||||
// ConsumeFromOffset contains the bounds check for offset, then hands off to MultiConsumer
|
||||
// the call stack is MultiConsumer -> ConsumeFromOffset -> MultiConsumer -> ConsumeFromOffset etc
|
||||
// MultiConsumer goes into ArgInfo for parsing on each iteration
|
||||
template <typename Tuple, size_t offset>
|
||||
template <typename Tuple, std::size_t offset>
|
||||
ChatCommandResult ConsumeFromOffset(Tuple&, ChatHandler const* handler, std::string_view args);
|
||||
|
||||
template <typename Tuple, typename NextType, size_t offset>
|
||||
template <typename Tuple, typename NextType, std::size_t offset>
|
||||
struct MultiConsumer
|
||||
{
|
||||
static ChatCommandResult TryConsumeTo(Tuple& tuple, ChatHandler const* handler, std::string_view args)
|
||||
@@ -71,7 +71,7 @@ namespace Acore::Impl::ChatCommands
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tuple, typename NestedNextType, size_t offset>
|
||||
template <typename Tuple, typename NestedNextType, std::size_t offset>
|
||||
struct MultiConsumer<Tuple, Optional<NestedNextType>, offset>
|
||||
{
|
||||
static ChatCommandResult TryConsumeTo(Tuple& tuple, ChatHandler const* handler, std::string_view args)
|
||||
@@ -102,7 +102,7 @@ namespace Acore::Impl::ChatCommands
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tuple, size_t offset>
|
||||
template <typename Tuple, std::size_t offset>
|
||||
ChatCommandResult ConsumeFromOffset([[maybe_unused]] Tuple& tuple, [[maybe_unused]] ChatHandler const* handler, std::string_view args)
|
||||
{
|
||||
if constexpr (offset < std::tuple_size_v<Tuple>)
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Acore::Impl::ChatCommands
|
||||
};
|
||||
|
||||
// fixed-size array
|
||||
template <typename T, size_t N>
|
||||
template <typename T, std::size_t N>
|
||||
struct ArgInfo<std::array<T, N>, void>
|
||||
{
|
||||
static ChatCommandResult TryConsume(std::array<T, N>& val, ChatHandler const* handler, std::string_view args)
|
||||
@@ -255,9 +255,9 @@ namespace Acore::Impl::ChatCommands
|
||||
struct ArgInfo<Acore::ChatCommands::Variant<Ts...>>
|
||||
{
|
||||
using V = std::variant<Ts...>;
|
||||
static constexpr size_t N = std::variant_size_v<V>;
|
||||
static constexpr std::size_t N = std::variant_size_v<V>;
|
||||
|
||||
template <size_t I>
|
||||
template <std::size_t I>
|
||||
static ChatCommandResult TryAtIndex([[maybe_unused]] Acore::ChatCommands::Variant<Ts...>& val, [[maybe_unused]] ChatHandler const* handler, [[maybe_unused]] std::string_view args)
|
||||
{
|
||||
if constexpr (I < N)
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace Acore::Impl::ChatCommands
|
||||
inline TokenizeResult tokenize(std::string_view args)
|
||||
{
|
||||
TokenizeResult result;
|
||||
if (size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos)
|
||||
if (std::size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos)
|
||||
{
|
||||
result.token = args.substr(0, delimPos);
|
||||
if (size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos)
|
||||
if (std::size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos)
|
||||
result.tail = args.substr(tailPos);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@ ChatCommandResult Acore::ChatCommands::QuotedString::TryConsume(ChatHandler cons
|
||||
return ArgInfo<std::string>::TryConsume(*this, handler, args);
|
||||
|
||||
char const QUOTE = args[0];
|
||||
for (size_t i = 1; i < args.length(); ++i)
|
||||
for (std::size_t i = 1; i < args.length(); ++i)
|
||||
{
|
||||
if (args[i] == QUOTE)
|
||||
{
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace Acore::Impl::ChatCommands
|
||||
using type = typename T::value_type;
|
||||
};
|
||||
|
||||
template <size_t N>
|
||||
inline constexpr char GetChar(char const (&s)[N], size_t i)
|
||||
template <std::size_t N>
|
||||
inline constexpr char GetChar(char const (&s)[N], std::size_t i)
|
||||
{
|
||||
static_assert(N <= 25, "The EXACT_SEQUENCE macro can only be used with up to 25 character long literals. Specify them char-by-char (null terminated) as parameters to ExactSequence<> instead.");
|
||||
return i >= N ? '\0' : s[i];
|
||||
@@ -273,7 +273,7 @@ namespace Acore::ChatCommands
|
||||
}
|
||||
|
||||
template<bool C = have_operators>
|
||||
operator std::enable_if_t<C && !std::is_same_v<first_type, size_t> && std::is_convertible_v<first_type, size_t>, size_t>() const
|
||||
operator std::enable_if_t<C && !std::is_same_v<first_type, std::size_t> && std::is_convertible_v<first_type, std::size_t>, std::size_t>() const
|
||||
{
|
||||
return operator*();
|
||||
}
|
||||
@@ -284,9 +284,9 @@ namespace Acore::ChatCommands
|
||||
template <typename T>
|
||||
Variant& operator=(T&& arg) { base::operator=(std::forward<T>(arg)); return *this; }
|
||||
|
||||
template <size_t index>
|
||||
template <std::size_t index>
|
||||
constexpr decltype(auto) get() { return std::get<index>(static_cast<base&>(*this)); }
|
||||
template <size_t index>
|
||||
template <std::size_t index>
|
||||
constexpr decltype(auto) get() const { return std::get<index>(static_cast<base const&>(*this)); }
|
||||
template <typename type>
|
||||
constexpr decltype(auto) get() { return std::get<type>(static_cast<base&>(*this)); }
|
||||
|
||||
@@ -35,7 +35,7 @@ class HyperlinkDataTokenizer
|
||||
if (IsEmpty())
|
||||
return false;
|
||||
|
||||
if (size_t off = _str.find(HYPERLINK_DATA_DELIMITER); off != std::string_view::npos)
|
||||
if (std::size_t off = _str.find(HYPERLINK_DATA_DELIMITER); off != std::string_view::npos)
|
||||
{
|
||||
if (!Acore::Hyperlinks::LinkTags::base_tag::StoreTo(val, _str.substr(0, off)))
|
||||
return false;
|
||||
|
||||
@@ -61,7 +61,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str)
|
||||
str.remove_prefix(2);
|
||||
|
||||
// tag+data part follows
|
||||
if (size_t delimPos = str.find('|'); delimPos != std::string_view::npos)
|
||||
if (std::size_t delimPos = str.find('|'); delimPos != std::string_view::npos)
|
||||
{
|
||||
tag = str.substr(0, delimPos);
|
||||
str.remove_prefix(delimPos+1);
|
||||
@@ -70,7 +70,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str)
|
||||
return {};
|
||||
|
||||
// split tag if : is present (data separator)
|
||||
if (size_t dataStart = tag.find(':'); dataStart != std::string_view::npos)
|
||||
if (std::size_t dataStart = tag.find(':'); dataStart != std::string_view::npos)
|
||||
{
|
||||
data = tag.substr(dataStart+1);
|
||||
tag = tag.substr(0, dataStart);
|
||||
@@ -81,7 +81,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str)
|
||||
return {};
|
||||
str.remove_prefix(1);
|
||||
// skip to final |
|
||||
if (size_t end = str.find('|'); end != std::string_view::npos)
|
||||
if (std::size_t end = str.find('|'); end != std::string_view::npos)
|
||||
{
|
||||
// check end tag
|
||||
if (str.substr(end, 4) != "|h|r")
|
||||
|
||||
Reference in New Issue
Block a user