ladybird/Userland/Libraries/LibWeb/Encoding/TextEncoder.h
Andrew Kaster 4bb6345b2f LibWeb: Remove unecessary dependence on Window from assorted classes
These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
2022-10-01 21:05:32 +01:00

36 lines
831 B
C++

/*
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <LibJS/Forward.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
namespace Web::Encoding {
// https://encoding.spec.whatwg.org/#textencoder
class TextEncoder final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(TextEncoder, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<TextEncoder> construct_impl(JS::Realm&);
virtual ~TextEncoder() override;
JS::Uint8Array* encode(String const& input) const;
static FlyString const& encoding();
protected:
// https://encoding.spec.whatwg.org/#dom-textencoder
explicit TextEncoder(JS::Realm&);
};
}