Ben Wiederhake
e147d0b572
AK: Fix all quadratic-time append-loops over ByteBuffer
2023-01-31 16:58:25 +01:00
Iman Seyed
0ebcc99e12
AK: Remove unused network ordered 'address' variable
2023-01-31 12:42:49 +01:00
Tim Schumacher
093cf428a3
AK: Move memory streams from LibCore
2023-01-29 19:16:44 -07:00
Tim Schumacher
22f0d04f43
AK: Provide a fallback definition for std::nothrow
2023-01-29 19:16:44 -07:00
Tim Schumacher
2470dd3bb5
AK: Move bit streams from LibCore
2023-01-29 19:16:44 -07:00
Tim Schumacher
94f139c111
AK: Move buffered streams from LibCore
2023-01-29 19:16:44 -07:00
Tim Schumacher
8464da1439
AK: Move Stream
and SeekableStream
from LibCore
...
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Tim Schumacher
5f2ea31816
AK: Move Handle
from LibCore
and name it MaybeOwned
...
The new name should make it abundantly clear what it does.
2023-01-29 19:16:44 -07:00
Tim Schumacher
5fa590de71
AK: Remove Buffered
2023-01-29 19:16:44 -07:00
Tim Schumacher
ae64b68717
AK: Deprecate the old AK::Stream
...
This also removes a few cases where the respective header wasn't
actually required to be included.
2023-01-29 19:16:44 -07:00
Andreas Kling
230cb3b0cb
AK: Add DeprecatedString::from_utf8()
...
This will be used in Jakt to help transition off of DeprecatedString.
2023-01-29 23:41:42 +01:00
Andreas Kling
6b497b8710
AK: Add two helpers to DeprecatedStringCodePointIterator
2023-01-29 23:41:42 +01:00
Linus Groh
9c08bb9555
AK: Remove try_
prefix from FixedArray creation functions
2023-01-28 22:41:36 +01:00
Timothy Flynn
e96c64cdb4
AK: Add support for the new FlyString to StringView
2023-01-28 15:24:55 +00:00
Timothy Flynn
b61f8cd130
AK: Delete the StringView move-assignment operator for various types
2023-01-28 15:24:55 +00:00
Andreas Kling
2dc657c77e
AK: Add DeprecatedStringCodePointIterator
...
This is a safe iterator over the underlying code points. It will be used
in Jakt to assist in the migration away from DeprecatedString.
2023-01-28 09:50:52 +01:00
Timothy Flynn
c59268d15b
AK: Add String::trim
2023-01-28 00:13:46 +00:00
Timothy Flynn
cccaa94767
AK: Add String::join
2023-01-28 00:13:46 +00:00
Timothy Flynn
79aaa2fe0f
AK: Allow the kernel to have access to StringBuilder::to_string
...
This is mostly to prevent String.h from acquiring ifdef-soup. In any
case, it's fine for the kernel to see this symbol as it is fallible.
2023-01-28 00:13:46 +00:00
Linus Groh
6e7459322d
AK: Remove StringBuilder::build() in favor of to_deprecated_string()
...
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Sam Atkins
09a22ddb2a
AK: Remove unimplemented methods
2023-01-27 20:33:18 +00:00
Sam Atkins
df07c5be3a
AK: Remove unused DateTimeLexer class
2023-01-27 20:33:18 +00:00
Timothy Flynn
c35b1371a3
AK: Add an overload of String::find_byte_offset for StringView
2023-01-27 18:00:17 +00:00
Timothy Flynn
76fd5f2756
AK: Add convenience substring wrappers to String to exclude a length
...
These overloads exist on other string classes and are used throughout
the code base.
2023-01-24 16:23:50 -05:00
Timothy Flynn
427b82065c
AK: Add a method to create a String with a repeated code point
2023-01-24 16:23:50 -05:00
Timothy Flynn
d50724956e
AK: Add a method to find the byte offset of a code point
2023-01-24 16:23:50 -05:00
Timothy Flynn
5e44b93af2
AK: Remove [[nodiscard]] attribute from String methods returning ErrorOr
2023-01-24 16:23:50 -05:00
Nico Weber
44de4d163b
AK: Make HashMap::try_ensure work with a fallible construction callback
...
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2023-01-24 14:45:27 +00:00
Nico Weber
8b5b767465
AK: Print leading zeroes after the dot for FixedPoint numbers
...
As a nearby comment says, "This is a terrible approximation".
This doesn't make things less terrible, but it does make things
more correct in the given framework of terribleness.
Fixes #17156 .
2023-01-24 13:24:21 +01:00
Nico Weber
9c5820326d
AK: Make FixedPoint::create_raw public and constexpr
2023-01-23 18:09:23 +00:00
Sam Atkins
c7a66882f4
AK: Make NonnullPtrVectors shuffleable
...
AK::shuffle() doesn't work on these, because their operator[] returns a
reference to the pointed-at value, instead of to the NonnullPtr itself.
2023-01-22 21:31:36 +00:00
Nico Weber
aa9037eed4
AK: Add spec comments to Utf16CodePointIterator::operator*()
2023-01-22 21:30:44 +00:00
Timothy Flynn
ef275e25b8
AK: Reduce String's allocated data by one byte
...
This was copied from allocation_size_for_stringimpl, which had to ensure
the string is null-terminated. String makes no such guarantee.
2023-01-22 20:27:52 +00:00
Karol Kosek
2d976ab2a6
AK: Define is_trivially_serializable trait for Little and BigEndian<>
...
This will allow us get LittleEndian<> and BigEndian<> wrapped types
directly from Stream::read_value<>().
2023-01-22 20:58:42 +01:00
Timothy Flynn
12c8bc3e85
AK: Add a String factory to create a string from a single code point
2023-01-22 01:03:13 +00:00
Timothy Flynn
8aca8e82cb
AK: Change String's default constructor to be constant
...
This allows creating expressions such as:
constexpr Array<String, 10> {};
2023-01-22 01:03:13 +00:00
Andrew Kaster
7ab37ee22c
Everywhere: Remove string.h include from AK/Traits.h and resolve fallout
...
A lot of places were relying on AK/Traits.h to give it strnlen, memcmp,
memcpy and other related declarations.
In the quest to remove inclusion of LibC headers from Kernel files, deal
with all the fallout of this included-everywhere header including less
things.
2023-01-21 10:43:59 -07:00
Tim Schumacher
63cf9b973d
AK: Remove FileStream
2023-01-21 14:43:56 +01:00
martinfalisse
aec2dadfdd
AK: Add split()
for String
2023-01-21 14:35:00 +01:00
Timothy Flynn
4f5353cbb8
AK: Rename double_hash to rehash_for_collision
...
The name is currently quite confusing as it indicates it hashes doubles.
2023-01-21 10:36:14 +01:00
Timothy Flynn
60b56892ca
AK: Add a type alias for DistinctNumeric's underlying type
2023-01-21 10:36:14 +01:00
Tim Schumacher
49b30d3013
AK: Remove InputBitStream
and OutputBitStream
2023-01-21 00:45:33 +00:00
Tim Schumacher
d7eead4f4c
AK: Remove DuplexMemoryStream
2023-01-20 20:48:40 +00:00
Timothy Flynn
c8e25a71e0
AK: Disable use of consteval in String::from_utf8_short_string for Apple
...
This causes an ICE on older versions of clang, and Apple's clang is
currently based on such a version.
2023-01-20 20:33:04 +00:00
Timothy Flynn
d48266a420
AK: Support creating known short string literals at compile time
...
In cases where we know a string literal will fit in the short string
storage, we can do so at compile time without needing to handle error
propagation. If the provided string literal is too long, a compilation
error will be emitted due to the failed VERIFY statement being a non-
constant expression.
2023-01-20 14:24:12 -05:00
Timothy Flynn
5063e218af
AK: Move the AK::FixedPoint formatter to FixedPoint.h
...
This does not need to be defined in Format.h. This causes FixedPoint.h
to be included everywhere. This is particularly going to be an issue
when trying to include <CoreServices/CoreServices.h> on macOS. The macOS
SDK defines its own FixedPoint structure which will conflict with ours.
2023-01-19 11:29:48 +00:00
Peter Elliott
b217045f8f
AK: Don't write trailing zeros with %g
2023-01-19 12:22:24 +01:00
konrad
9b12571a86
AK: Unify kernel debug messages, avoid printing time if unavailable
2023-01-18 22:58:42 +01:00
konrad
9f736d782c
AK: Patch ArbitrarySizedEnum
operators for missing constructor
...
Patch kindly provided by Ali on #aarch64 on Discord.
Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2023-01-18 22:58:42 +01:00
Timothy Flynn
537fcaf59e
AK+LibUnicode: Provide Unicode-aware caseless String matching
...
The Unicode spec defines much more complicated caseless matching
algorithms in its Collation spec. This implements the "basic" case
folding comparison.
2023-01-18 14:43:40 +00:00