mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:07:35 +00:00
Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes
This is basically just for consistency, it's quite strange to see multiple AK container types next to each other, some with and some without the namespace prefix - we're 'using AK::Foo;' a lot and should leverage that. :^)
This commit is contained in:
parent
be9df404fd
commit
e265054c12
73 changed files with 111 additions and 110 deletions
|
@ -311,9 +311,9 @@ struct Formatter<DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith>> :
|
|||
// TODO: Further type aliases?
|
||||
|
||||
template<typename T, typename X, auto... Args>
|
||||
struct AK::Traits<AK::DistinctNumeric<T, X, Args...>> : public AK::GenericTraits<AK::DistinctNumeric<T, X, Args...>> {
|
||||
struct Traits<AK::DistinctNumeric<T, X, Args...>> : public GenericTraits<AK::DistinctNumeric<T, X, Args...>> {
|
||||
static constexpr bool is_trivial() { return true; }
|
||||
static constexpr auto hash(const AK::DistinctNumeric<T, X, Args...>& d) { return AK::Traits<T>::hash(d.value()); }
|
||||
static constexpr auto hash(const DistinctNumeric<T, X, Args...>& d) { return Traits<T>::hash(d.value()); }
|
||||
};
|
||||
|
||||
using AK::DistinctNumeric;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
struct FlyStringImplTraits : public AK::Traits<StringImpl*> {
|
||||
struct FlyStringImplTraits : public Traits<StringImpl*> {
|
||||
static unsigned hash(const StringImpl* s) { return s ? s->hash() : 0; }
|
||||
static bool equals(const StringImpl* a, const StringImpl* b)
|
||||
{
|
||||
|
|
|
@ -231,7 +231,7 @@ Optional<JsonValue> JsonParser::parse_number()
|
|||
auto number = number_string.to_int<i64>();
|
||||
if (!number.has_value())
|
||||
return {};
|
||||
if (number.value() <= AK::NumericLimits<i32>::max()) {
|
||||
if (number.value() <= NumericLimits<i32>::max()) {
|
||||
value = JsonValue((i32)number.value());
|
||||
} else {
|
||||
value = JsonValue(number.value());
|
||||
|
|
|
@ -79,11 +79,11 @@ public:
|
|||
|
||||
constexpr bool is_zero() const
|
||||
{
|
||||
return AK::all_of(m_data.begin(), m_data.end(), [](const auto octet) { return octet == 0; });
|
||||
return all_of(m_data.begin(), m_data.end(), [](const auto octet) { return octet == 0; });
|
||||
}
|
||||
|
||||
private:
|
||||
AK::Array<u8, s_mac_address_length> m_data {};
|
||||
Array<u8, s_mac_address_length> m_data {};
|
||||
};
|
||||
|
||||
static_assert(sizeof(MACAddress) == 6u);
|
||||
|
|
|
@ -305,7 +305,7 @@ struct Traits<String> : public GenericTraits<String> {
|
|||
static unsigned hash(const String& s) { return s.impl() ? s.impl()->hash() : 0; }
|
||||
};
|
||||
|
||||
struct CaseInsensitiveStringTraits : public AK::Traits<String> {
|
||||
struct CaseInsensitiveStringTraits : public Traits<String> {
|
||||
static unsigned hash(const String& s) { return s.impl() ? s.to_lowercase().impl()->hash() : 0; }
|
||||
static bool equals(const String& a, const String& b) { return a.to_lowercase() == b.to_lowercase(); }
|
||||
};
|
||||
|
|
|
@ -184,7 +184,7 @@ Optional<T> convert_to_uint_from_hex(const StringView& str)
|
|||
|
||||
T value = 0;
|
||||
const auto count = str_trimmed.length();
|
||||
const T upper_bound = AK::NumericLimits<T>::max();
|
||||
const T upper_bound = NumericLimits<T>::max();
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
char digit = str_trimmed[i];
|
||||
|
|
|
@ -282,7 +282,7 @@ Optional<size_t> StringView::find_first_of(const StringView& view) const
|
|||
{
|
||||
if (const auto location = AK::find_if(begin(), end(),
|
||||
[&](const auto c) {
|
||||
return AK::any_of(view.begin(), view.end(),
|
||||
return any_of(view.begin(), view.end(),
|
||||
[&](const auto view_char) {
|
||||
return c == view_char;
|
||||
});
|
||||
|
|
|
@ -90,7 +90,7 @@ private:
|
|||
struct timeval m_started;
|
||||
};
|
||||
|
||||
using TestFunction = AK::Function<void()>;
|
||||
using TestFunction = Function<void()>;
|
||||
|
||||
class TestCase : public RefCounted<TestCase> {
|
||||
public:
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
|
||||
TEST_CASE(should_determine_if_predicate_applies_to_all_elements_in_container)
|
||||
{
|
||||
constexpr AK::Array<int, 10> a {};
|
||||
constexpr Array<int, 10> a {};
|
||||
|
||||
static_assert(AK::all_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
static_assert(!AK::all_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
static_assert(all_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
static_assert(!all_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
|
||||
EXPECT(AK::all_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
EXPECT(!AK::all_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
EXPECT(all_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
EXPECT(!all_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
}
|
||||
|
||||
TEST_MAIN(AllOf)
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
|
||||
TEST_CASE(should_determine_if_predicate_applies_to_any_element_in_container)
|
||||
{
|
||||
constexpr AK::Array<int, 10> a { 1 };
|
||||
constexpr Array<int, 10> a { 1 };
|
||||
|
||||
static_assert(AK::any_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
static_assert(AK::any_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
static_assert(!AK::any_of(a.begin(), a.end(), [](auto elem) { return elem == 2; }));
|
||||
static_assert(any_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
static_assert(any_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
static_assert(!any_of(a.begin(), a.end(), [](auto elem) { return elem == 2; }));
|
||||
|
||||
EXPECT(AK::any_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
EXPECT(AK::any_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
EXPECT(!AK::any_of(a.begin(), a.end(), [](auto elem) { return elem == 2; }));
|
||||
EXPECT(any_of(a.begin(), a.end(), [](auto elem) { return elem == 0; }));
|
||||
EXPECT(any_of(a.begin(), a.end(), [](auto elem) { return elem == 1; }));
|
||||
EXPECT(!any_of(a.begin(), a.end(), [](auto elem) { return elem == 2; }));
|
||||
}
|
||||
|
||||
TEST_MAIN(AllOf)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
TEST_CASE(should_provide_underlying_type)
|
||||
{
|
||||
static_assert(AK::IsSame<int, Badge<int>::Type>::value);
|
||||
static_assert(IsSame<int, Badge<int>::Type>::value);
|
||||
}
|
||||
|
||||
TEST_MAIN(Badge)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
TEST_CASE(should_return_end_if_not_in_container)
|
||||
{
|
||||
constexpr AK::Array<int, 10> a {};
|
||||
constexpr Array<int, 10> a {};
|
||||
|
||||
static_assert(a.end() == AK::find(a.begin(), a.end(), 1));
|
||||
|
||||
|
@ -41,7 +41,7 @@ TEST_CASE(should_return_end_if_not_in_container)
|
|||
|
||||
TEST_CASE(should_return_iterator_to_first_matching_value_in_container)
|
||||
{
|
||||
static constexpr AK::Array<int, 10> a { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
static constexpr Array<int, 10> a { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
|
||||
constexpr auto expected = a.begin() + 4;
|
||||
|
||||
|
@ -52,7 +52,7 @@ TEST_CASE(should_return_iterator_to_first_matching_value_in_container)
|
|||
|
||||
TEST_CASE(should_return_iterator_to_first_predicate_matching_value_in_container)
|
||||
{
|
||||
static constexpr AK::Array<int, 10> a { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
static constexpr Array<int, 10> a { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
|
||||
constexpr auto expected = a.begin() + 4;
|
||||
|
||||
|
@ -66,7 +66,7 @@ TEST_CASE(should_return_iterator_to_first_predicate_matching_value_in_container)
|
|||
|
||||
TEST_CASE(should_return_index_to_first_predicate_matching_value_in_container)
|
||||
{
|
||||
static constexpr AK::Array<int, 10> a { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
static constexpr Array<int, 10> a { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
|
||||
static_assert(4 == AK::find_index(a.begin(), a.end(), 0));
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ TEST_CASE(span_works_with_constant_types)
|
|||
static constexpr u8 buffer[4] { 1, 2, 3, 4 };
|
||||
constexpr ReadonlyBytes bytes { buffer, 4 };
|
||||
|
||||
static_assert(AK::IsConst<AK::RemoveReference<decltype(bytes[1])>::Type>::value);
|
||||
static_assert(IsConst<AK::RemoveReference<decltype(bytes[1])>::Type>::value);
|
||||
static_assert(bytes[2] == 3);
|
||||
}
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ TEST_CASE(should_compare_vectors_of_different_sizes)
|
|||
|
||||
TEST_CASE(should_find_value)
|
||||
{
|
||||
AK::Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
|
||||
const auto expected = v.begin() + 4;
|
||||
|
||||
|
@ -405,7 +405,7 @@ TEST_CASE(should_find_value)
|
|||
|
||||
TEST_CASE(should_find_predicate)
|
||||
{
|
||||
AK::Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
|
||||
const auto expected = v.begin() + 4;
|
||||
|
||||
|
@ -414,7 +414,7 @@ TEST_CASE(should_find_predicate)
|
|||
|
||||
TEST_CASE(should_find_index)
|
||||
{
|
||||
AK::Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
|
||||
|
||||
EXPECT_EQ(4u, v.find_first_index(0).value());
|
||||
EXPECT(!v.find_first_index(42).has_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue