mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 16:05:06 +00:00

We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
36 lines
841 B
C++
36 lines
841 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(DeprecatedString const& input) const;
|
|
|
|
static FlyString const& encoding();
|
|
|
|
protected:
|
|
// https://encoding.spec.whatwg.org/#dom-textencoder
|
|
explicit TextEncoder(JS::Realm&);
|
|
};
|
|
|
|
}
|