mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
AK+LibTextCodec: Stop using Utf16View endianness override
This is preparation for removing the endianness override, since it was only used by a single client: LibTextCodec. While here, add helpers and make use of simdutf for fast conversion.
This commit is contained in:
parent
96f1f15ad6
commit
0e9480b944
Notes:
github-actions[bot]
2025-04-16 08:06:08 +00:00
Author: https://github.com/awesomekling
Commit: 0e9480b944
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4370
7 changed files with 56 additions and 53 deletions
|
@ -17,12 +17,12 @@ namespace TextCodec {
|
|||
|
||||
class Decoder {
|
||||
public:
|
||||
virtual ErrorOr<void> process(StringView, Function<ErrorOr<void>(u32)> on_code_point) = 0;
|
||||
virtual bool validate(StringView);
|
||||
virtual ErrorOr<String> to_utf8(StringView);
|
||||
|
||||
protected:
|
||||
virtual ~Decoder() = default;
|
||||
virtual ErrorOr<void> process(StringView, Function<ErrorOr<void>(u32)> on_code_point) = 0;
|
||||
};
|
||||
|
||||
class UTF8Decoder final : public Decoder {
|
||||
|
@ -34,16 +34,20 @@ public:
|
|||
|
||||
class UTF16BEDecoder final : public Decoder {
|
||||
public:
|
||||
virtual ErrorOr<void> process(StringView, Function<ErrorOr<void>(u32)> on_code_point) override;
|
||||
virtual bool validate(StringView) override;
|
||||
virtual ErrorOr<String> to_utf8(StringView) override;
|
||||
|
||||
private:
|
||||
virtual ErrorOr<void> process(StringView, Function<ErrorOr<void>(u32)>) override { VERIFY_NOT_REACHED(); }
|
||||
};
|
||||
|
||||
class UTF16LEDecoder final : public Decoder {
|
||||
public:
|
||||
virtual ErrorOr<void> process(StringView, Function<ErrorOr<void>(u32)> on_code_point) override;
|
||||
virtual bool validate(StringView) override;
|
||||
virtual ErrorOr<String> to_utf8(StringView) override;
|
||||
|
||||
private:
|
||||
virtual ErrorOr<void> process(StringView, Function<ErrorOr<void>(u32)>) override { VERIFY_NOT_REACHED(); }
|
||||
};
|
||||
|
||||
template<Integral ArrayType = u32>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue