/* * Copyright (c) 2022, Ali Mohammad Pur * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include namespace Web::Encoding { // https://encoding.spec.whatwg.org/#textdecoder class TextDecoder : public Bindings::PlatformObject , public TextDecoderCommonMixin { WEB_PLATFORM_OBJECT(TextDecoder, Bindings::PlatformObject); GC_DECLARE_ALLOCATOR(TextDecoder); public: static WebIDL::ExceptionOr> construct_impl(JS::Realm&, FlyString encoding, Optional const& options = {}); virtual ~TextDecoder() override; WebIDL::ExceptionOr decode(Optional> const&, Optional const& options = {}) const; private: TextDecoder(JS::Realm&, TextCodec::Decoder&, FlyString encoding, ErrorMode error_mode, bool ignore_bom); virtual void initialize(JS::Realm&) override; }; }