1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 13:57:36 +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

@ -17,7 +17,7 @@ RefPtr<Gfx::Bitmap> ConnectionToClipboardServer::get_bitmap()
if (clipping.mime_type() != "image/x-serenityos")
return nullptr;
HashMap<String, String> const& metadata = clipping.metadata().entries();
HashMap<DeprecatedString, DeprecatedString> const& metadata = clipping.metadata().entries();
auto width = metadata.get("width").value_or("0").to_uint();
if (!width.has_value() || width.value() == 0)
return nullptr;
@ -60,12 +60,12 @@ RefPtr<Gfx::Bitmap> ConnectionToClipboardServer::get_bitmap()
// Copied from LibGUI/Clipboard.cpp
void ConnectionToClipboardServer::set_bitmap(Gfx::Bitmap const& bitmap)
{
HashMap<String, String> metadata;
metadata.set("width", String::number(bitmap.width()));
metadata.set("height", String::number(bitmap.height()));
metadata.set("scale", String::number(bitmap.scale()));
metadata.set("format", String::number((int)bitmap.format()));
metadata.set("pitch", String::number(bitmap.pitch()));
HashMap<DeprecatedString, DeprecatedString> metadata;
metadata.set("width", DeprecatedString::number(bitmap.width()));
metadata.set("height", DeprecatedString::number(bitmap.height()));
metadata.set("scale", DeprecatedString::number(bitmap.scale()));
metadata.set("format", DeprecatedString::number((int)bitmap.format()));
metadata.set("pitch", DeprecatedString::number(bitmap.pitch()));
ReadonlyBytes data { bitmap.scanline(0), bitmap.size_in_bytes() };
auto buffer_or_error = Core::AnonymousBuffer::create_with_size(bitmap.size_in_bytes());
VERIFY(!buffer_or_error.is_error());

View file

@ -27,7 +27,7 @@ private:
: IPC::ConnectionToServer<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, move(socket))
{
}
virtual void clipboard_data_changed(String const&) override
virtual void clipboard_data_changed(DeprecatedString const&) override
{
on_data_changed();
}

View file

@ -6,7 +6,7 @@
#include "SpiceAgent.h"
#include "ConnectionToClipboardServer.h"
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibC/memory.h>
#include <LibC/unistd.h>
#include <LibGfx/BMPLoader.h>
@ -41,7 +41,7 @@ SpiceAgent::SpiceAgent(int fd, ConnectionToClipboardServer& connection)
send_message(buffer);
}
Optional<SpiceAgent::ClipboardType> SpiceAgent::mime_type_to_clipboard_type(String const& mime)
Optional<SpiceAgent::ClipboardType> SpiceAgent::mime_type_to_clipboard_type(DeprecatedString const& mime)
{
if (mime == "text/plain")
return ClipboardType::Text;

View file

@ -124,5 +124,5 @@ private:
bool m_just_set_clip { false };
void read_n(void* dest, size_t n);
static Message* initialize_headers(u8* data, size_t additional_data_size, MessageType type);
static Optional<ClipboardType> mime_type_to_clipboard_type(String const& mime);
static Optional<ClipboardType> mime_type_to_clipboard_type(DeprecatedString const& mime);
};