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:
Francesco Borzì
2024-07-31 01:06:46 +02:00
committed by GitHub
parent 06a608d244
commit 02a05fbd4c
200 changed files with 522 additions and 581 deletions

View File

@@ -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 = &map;
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);
}

View File

@@ -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>)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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)); }