summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2022-12-22AK: Rearrange Error's members to reduce its size by 8 bytesTimothy Flynn
This shrinks sizeof(Error) from 32 bytes to 24 bytes, which in turn will shrink sizeof(ErrorOr<T>) by the same amount (in cases where sizeof(T) is less than sizeof(Error)).
2022-12-22AK+Everywhere: Replace all Bitmap::must_create() uses with ::create()Sam Atkins
Well, *someone* has to add some more FIXMEs to keep FIXME Roulette going. :^)
2022-12-22AK: Rename Bitmap::try_create() to ::create()Sam Atkins
This is step 1 to removing `must_create()`.
2022-12-21AK: Calculate elapsed days in `human_readable_time()`Karol Kosek
2022-12-20AK: Add DeprecatedString::find_last(StringView)Agustin Gianni
This adds the the method DeprecatedString::find_last() as wrapper for StringUtils::find_last for the StringView type.
2022-12-20AK: Stop using `DeprecatedString` in Base64 encodingJelle Raaijmakers
2022-12-20AK: Stop using `DeprecatedString` in `UUID`Jelle Raaijmakers
2022-12-19AK: Use __has_builtin() in Checked.hAndreas Kling
Instead of avoiding overflow-checking builtins with AK_COMPILER_CLANG, we can use the preprocessor's __has_builtin() mechanism to check if they are available.
2022-12-17AK+Everywhere: Move custom deleter capability to OwnPtrLenny Maiorani
`OwnPtrWithCustomDeleter` was a decorator which provided the ability to add a custom deleter to `OwnPtr` by wrapping and taking the deleter as a run-time argument to the constructor. This solution means that no additional space is needed for the `OwnPtr` because it doesn't need to store a pointer to the deleter, but comes at the cost of having an extra type that stores a pointer for every instance. This logic is moved directly into `OwnPtr` by adding a template argument that is defaulted to the default deleter for the type. This means that the type itself stores the pointer to the deleter instead of every instance and adds some type safety by encoding the deleter in the type itself instead of taking a run-time argument.
2022-12-16AK: Add a try_ensure() method to HashMapEli Youngs
2022-12-16AK: Support popping an arbitrary element from a HashTableEli Youngs
2022-12-16AK: Synchronize explicit instantiations of to_int and to_uintTimothy Flynn
1. Ensure long and long long are instantiated for to_int. 2. Ensure long and long long are not instantiated for to_uint.
2022-12-15AK: Add `OwnPtrWithCustomDeleter`Lucas CHOLLET
This class is a smart pointer that let you provide a custom deleter to free the pointer. It is quite primitive compared to other smart pointers but can still be useful when interacting with C types that provides a custom `free()` function.
2022-12-15AK: Add Span to Array conversion functionkleines Filmröllchen
2022-12-14AK: Create relative path even if prefix is not an ancestor of the pathPoseydon42
2022-12-14AK: Bring back the AK_DONT_REPLACE_STD #defineAli Mohammad Pur
This was removed in a910961f37d1da9dafb6385e348266746354cf98 in favour of the more general USING_AK_GLOBALLY #define, but Ladybird (and probably other projects) depend on the smaller hammer to include STL headers and keep the USING_AK_GLOBALLY behaviour, so put it back and preserve its behaviour.
2022-12-14Everywhere: Stop shoving things into ::std and mentioning them as suchAli Mohammad Pur
Note that this still keeps the old behaviour of putting things in std by default on serenity so the tools can be happy, but if USING_AK_GLOBALLY is unset, AK behaves like a good citizen and doesn't try to put things in the ::std namespace. std::nothrow_t and its friends get to stay because I'm being told that compilers assume things about them and I can't yeet them into a different namespace...for now.
2022-12-14AK: Make Types.h not export its functions if !USING_AK_GLOBALLYAli Mohammad Pur
2022-12-13AK: Make Variant's index type publickleines Filmröllchen
This will allow the IPC system to use the exact required index type, saving transmission space, once it can send variants.
2022-12-13AK: Fix build with !USING_AK_GLOBALLYAli Mohammad Pur
A couple headers expected names to be in the global namespace, qualify those names to make sure they're resolved even when the names are not exported. One header placed its functions in the global namespace, move those to the AK namespace to make the concepts resolve.
2022-12-12AK: Actually don't include <unistd.h> for windows in Platform.hAli Mohammad Pur
I got the conditions wrong last time, oops :^)
2022-12-12AK: Add a shuffle utility functionArda Cinar
This implements a shuffle function in AK/Random.h which works on any container with size() and curly brace operators. It uses fisher-yates shuffle.
2022-12-12AK: Introduce the `DerivedFrom` conceptLucas CHOLLET
2022-12-12AK: Don't use <random> on windows for ::rand()Ali Mohammad Pur
This is the same as the libc function, just use the libc function.
2022-12-12AK: Don't try to include <unistd.h> on windows for PAGE_SIZEAli Mohammad Pur
2022-12-12AK: Change quicksort comments to standard // stylekleines Filmröllchen
2022-12-12AK: Introduce cutoff to insertion sort for QuicksortMarc Luqué
Implement insertion sort in AK. The cutoff value 7 is a magic number here, values [5, 15] should work well. Main idea of the cutoff is to reduce recursion performed by quicksort to speed up sorting of small partitions.
2022-12-12AK: Introduce Indexable conceptkleines Filmröllchen
This was dearly missing and can be used in many existing templates.
2022-12-11AK: Specialise AK::is() for NNRP<T>Ali Mohammad Pur
This is used by the Jakt runtime.
2022-12-11AK: Add an identity implementation of StringView::from_string_literal()Ali Mohammad Pur
This is required for the Jakt runtime.
2022-12-11AK: Add Optional-like value()/has_value() getters to WeakPtrAli Mohammad Pur
2022-12-11AK: Allow constructing WeakPtr<T> using OptionalNoneAli Mohammad Pur
The Jakt runtime requires this.
2022-12-11AK: Add Optional::lazy_emplace(Callable)Ali Mohammad Pur
This makes it possible to emplace using a given function instead of passing constructor arguments.
2022-12-11AK: Allow non-ascii characters to be printedAli Mohammad Pur
This keeps the FIXME, as well as the assertion.
2022-12-11AK: Format the contents of NNRP<T> if T is formattableAli Mohammad Pur
2022-12-11AK: Ignore "alternative" formatting of StringView instead of crashingAli Mohammad Pur
Jakt implements this in a different way, but it's a noop for StringViews anyway.
2022-12-11AK: Add a Error::__jakt_from_string_literal(StringView) factory functionAli Mohammad Pur
Note that Jakt only allows StringView creation from string literals, so none of the invariants in the class are broken by this (if used only from within Jakt).
2022-12-11AK: Let ErrorOr<T, E> expose its result/error typesAli Mohammad Pur
`ErrorOr<T, E>::ResultType` can now refer to `T`.
2022-12-11AK: Add support for modulo to Checked<T>Ali Mohammad Pur
This is used by the Jakt runtime.
2022-12-11AK: Allow Optional<T> to be constructed by OptionalNone()Ali Mohammad Pur
This is needed by the Jakt runtime too.
2022-12-11AK: Allow the user to access the variant indexAli Mohammad Pur
The average user has no need for this, but the Jakt compiler uses this to avoid going through the expensive ::visit() and ::get<>() APIs.
2022-12-11AK: Add a fallible StringBuilder::create() factory functionAli Mohammad Pur
This is nice, and is also used by the Jakt runtime.
2022-12-11AK: Add a Optional::value_or_lazy_evaluated(constructor_function) APIAli Mohammad Pur
This allows the user to avoid constructing the default value if the optional already contains a value. This is used by the Jakt runtime.
2022-12-11AK: Add a functional-style Optional::map(mapper_function) APIAli Mohammad Pur
This allows the user to transform the contents of the optional (if any exists), without manually unwrapping and then rewrapping it. This is needed by the Jakt runtime.
2022-12-11AK: Let HashMap also take a ValueTraitsAli Mohammad Pur
We were previously using Traits<V>, take that frrom the template parameters instead. This is needed by the Jakt runtime.
2022-12-11AK: Elaborate the Error constructors a bitAli Mohammad Pur
The old constraints were making clang mad, so express them in a less complex way.
2022-12-11AK: Give DeprecatedString::replace() a default modeAli Mohammad Pur
This is used in Jakt, and providing that value from Jakt's side is more trouble than doing this. Considering this class is bound to go away, a little backwards-compatible API change is just fine.
2022-12-11AK: Add a DeprecatedString::byte_at() getterAli Mohammad Pur
`operator[]` returns a char, this is used in Jakt.
2022-12-11AK: Add a Checked::unchecked_value() functionAli Mohammad Pur
This is used in Jakt.
2022-12-11AK: Add LexicalPath::is_child_ofkleines Filmröllchen
This API checks whether this path is a child of (or the same as) another path.