diff options
Diffstat (limited to 'Userland/Libraries/LibTextCodec/Decoder.h')
-rw-r--r-- | Userland/Libraries/LibTextCodec/Decoder.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Userland/Libraries/LibTextCodec/Decoder.h b/Userland/Libraries/LibTextCodec/Decoder.h index 73ad85d4ea..6bbd515cb3 100644 --- a/Userland/Libraries/LibTextCodec/Decoder.h +++ b/Userland/Libraries/LibTextCodec/Decoder.h @@ -7,12 +7,14 @@ #pragma once #include <AK/Forward.h> +#include <AK/Function.h> namespace TextCodec { class Decoder { public: - virtual String to_utf8(const StringView&) = 0; + virtual void process(StringView const&, Function<void(u32)> on_code_point) = 0; + virtual String to_utf8(StringView const&); protected: virtual ~Decoder() = default; @@ -20,45 +22,47 @@ protected: class UTF8Decoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual String to_utf8(StringView const&) override; }; class UTF16BEDecoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual String to_utf8(StringView const&) override; }; class Latin1Decoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; }; class Latin2Decoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; }; class HebrewDecoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; }; class CyrillicDecoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; }; class Latin9Decoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; }; class TurkishDecoder final : public Decoder { public: - virtual String to_utf8(const StringView&) override; + virtual void process(StringView const&, Function<void(u32)> on_code_point) override; }; -Decoder* decoder_for(const String& encoding); +Decoder* decoder_for(String const& encoding); Optional<String> get_standardized_encoding(const String& encoding); } |