1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +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

@ -8,9 +8,9 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/String.h>
#include <LibGUI/Forward.h>
#include <LibGfx/Forward.h>
@ -25,13 +25,13 @@ public:
ClipboardClient();
virtual ~ClipboardClient();
virtual void clipboard_content_did_change(String const& mime_type) = 0;
virtual void clipboard_content_did_change(DeprecatedString const& mime_type) = 0;
};
struct DataAndType {
ByteBuffer data;
String mime_type;
HashMap<String, String> metadata;
DeprecatedString mime_type;
HashMap<DeprecatedString, DeprecatedString> metadata;
RefPtr<Gfx::Bitmap> as_bitmap() const;
};
@ -40,19 +40,19 @@ public:
static Clipboard& the();
DataAndType fetch_data_and_type() const;
String fetch_mime_type() const { return fetch_data_and_type().mime_type; }
DeprecatedString fetch_mime_type() const { return fetch_data_and_type().mime_type; }
void set_data(ReadonlyBytes data, String const& mime_type = "text/plain", HashMap<String, String> const& metadata = {});
void set_plain_text(String const& text) { set_data(text.bytes()); }
void set_data(ReadonlyBytes data, DeprecatedString const& mime_type = "text/plain", HashMap<DeprecatedString, DeprecatedString> const& metadata = {});
void set_plain_text(DeprecatedString const& text) { set_data(text.bytes()); }
void set_bitmap(Gfx::Bitmap const&);
void clear();
void clipboard_data_changed(Badge<ConnectionToClipboardServer>, String const& mime_type);
void clipboard_data_changed(Badge<ConnectionToClipboardServer>, DeprecatedString const& mime_type);
void register_client(Badge<ClipboardClient>, ClipboardClient& client) { m_clients.set(&client); }
void unregister_client(Badge<ClipboardClient>, ClipboardClient& client) { m_clients.remove(&client); }
Function<void(String const& mime_type)> on_change;
Function<void(DeprecatedString const& mime_type)> on_change;
private:
Clipboard() = default;