1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:27:35 +00:00

AK+Everywhere: Rename String to DeprecatedString

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 :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/NonnullRefPtr.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibWeb/Bindings/BlobPrototype.h>
#include <LibWeb/Bindings/PlatformObject.h>
@ -16,14 +16,14 @@
namespace Web::FileAPI {
using BlobPart = Variant<JS::Handle<JS::Object>, JS::Handle<Blob>, String>;
using BlobPart = Variant<JS::Handle<JS::Object>, JS::Handle<Blob>, DeprecatedString>;
struct BlobPropertyBag {
String type = String::empty();
DeprecatedString type = DeprecatedString::empty();
Bindings::EndingType endings;
};
[[nodiscard]] ErrorOr<String> convert_line_endings_to_native(String const& string);
[[nodiscard]] ErrorOr<DeprecatedString> convert_line_endings_to_native(DeprecatedString const& string);
[[nodiscard]] ErrorOr<ByteBuffer> process_blob_parts(Vector<BlobPart> const& blob_parts, Optional<BlobPropertyBag> const& options = {});
[[nodiscard]] bool is_basic_latin(StringView view);
@ -33,16 +33,16 @@ class Blob : public Bindings::PlatformObject {
public:
virtual ~Blob() override;
static JS::NonnullGCPtr<Blob> create(JS::Realm&, ByteBuffer, String type);
static JS::NonnullGCPtr<Blob> create(JS::Realm&, ByteBuffer, DeprecatedString type);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> create(JS::Realm&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> construct_impl(JS::Realm&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
// https://w3c.github.io/FileAPI/#dfn-size
u64 size() const { return m_byte_buffer.size(); }
// https://w3c.github.io/FileAPI/#dfn-type
String const& type() const { return m_type; }
DeprecatedString const& type() const { return m_type; }
WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> slice(Optional<i64> start = {}, Optional<i64> end = {}, Optional<String> const& content_type = {});
WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> slice(Optional<i64> start = {}, Optional<i64> end = {}, Optional<DeprecatedString> const& content_type = {});
JS::Promise* text();
JS::Promise* array_buffer();
@ -50,14 +50,14 @@ public:
ReadonlyBytes bytes() const { return m_byte_buffer.bytes(); }
protected:
Blob(JS::Realm&, ByteBuffer, String type);
Blob(JS::Realm&, ByteBuffer, DeprecatedString type);
Blob(JS::Realm&, ByteBuffer);
private:
explicit Blob(JS::Realm&);
ByteBuffer m_byte_buffer {};
String m_type {};
DeprecatedString m_type {};
};
}