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

@ -89,7 +89,7 @@ ErrorOr<void> Decoder::decode(double& value)
return m_stream.try_handle_any_error();
}
ErrorOr<void> Decoder::decode(String& value)
ErrorOr<void> Decoder::decode(DeprecatedString& value)
{
i32 length;
TRY(decode(length));
@ -99,7 +99,7 @@ ErrorOr<void> Decoder::decode(String& value)
return {};
}
if (length == 0) {
value = String::empty();
value = DeprecatedString::empty();
return {};
}
char* text_buffer = nullptr;
@ -131,7 +131,7 @@ ErrorOr<void> Decoder::decode(ByteBuffer& value)
ErrorOr<void> Decoder::decode(JsonValue& value)
{
String string;
DeprecatedString string;
TRY(decode(string));
value = TRY(JsonValue::from_string(string));
return {};
@ -139,7 +139,7 @@ ErrorOr<void> Decoder::decode(JsonValue& value)
ErrorOr<void> Decoder::decode(URL& value)
{
String string;
DeprecatedString string;
TRY(decode(string));
value = URL(string);
return {};
@ -153,9 +153,9 @@ ErrorOr<void> Decoder::decode(Dictionary& dictionary)
VERIFY_NOT_REACHED();
for (size_t i = 0; i < size; ++i) {
String key;
DeprecatedString key;
TRY(decode(key));
String value;
DeprecatedString value;
TRY(decode(value));
dictionary.add(move(key), move(value));
}

View file

@ -7,10 +7,10 @@
#pragma once
#include <AK/Concepts.h>
#include <AK/DeprecatedString.h>
#include <AK/Forward.h>
#include <AK/NumericLimits.h>
#include <AK/StdLibExtras.h>
#include <AK/String.h>
#include <AK/Try.h>
#include <LibCore/SharedCircularQueue.h>
#include <LibCore/Stream.h>
@ -47,7 +47,7 @@ public:
ErrorOr<void> decode(i64&);
ErrorOr<void> decode(float&);
ErrorOr<void> decode(double&);
ErrorOr<void> decode(String&);
ErrorOr<void> decode(DeprecatedString&);
ErrorOr<void> decode(ByteBuffer&);
ErrorOr<void> decode(JsonValue&);
ErrorOr<void> decode(URL&);

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/HashMap.h>
#include <AK/String.h>
namespace IPC {
@ -16,7 +16,7 @@ class Dictionary {
public:
Dictionary() = default;
Dictionary(HashMap<String, String> const& initial_entries)
Dictionary(HashMap<DeprecatedString, DeprecatedString> const& initial_entries)
: m_entries(initial_entries)
{
}
@ -24,7 +24,7 @@ public:
bool is_empty() const { return m_entries.is_empty(); }
size_t size() const { return m_entries.size(); }
void add(String key, String value)
void add(DeprecatedString key, DeprecatedString value)
{
m_entries.set(move(key), move(value));
}
@ -37,10 +37,10 @@ public:
}
}
HashMap<String, String> const& entries() const { return m_entries; }
HashMap<DeprecatedString, DeprecatedString> const& entries() const { return m_entries; }
private:
HashMap<String, String> m_entries;
HashMap<DeprecatedString, DeprecatedString> m_entries;
};
}

View file

@ -7,9 +7,9 @@
#include <AK/BitCast.h>
#include <AK/ByteBuffer.h>
#include <AK/DeprecatedString.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
#include <AK/String.h>
#include <AK/URL.h>
#include <LibCore/AnonymousBuffer.h>
#include <LibCore/DateTime.h>
@ -146,7 +146,7 @@ Encoder& Encoder::operator<<(StringView value)
return *this;
}
Encoder& Encoder::operator<<(String const& value)
Encoder& Encoder::operator<<(DeprecatedString const& value)
{
if (value.is_null())
return *this << (i32)-1;

View file

@ -43,7 +43,7 @@ public:
Encoder& operator<<(double);
Encoder& operator<<(char const*);
Encoder& operator<<(StringView);
Encoder& operator<<(String const&);
Encoder& operator<<(DeprecatedString const&);
Encoder& operator<<(ByteBuffer const&);
Encoder& operator<<(JsonValue const&);
Encoder& operator<<(URL const&);

View file

@ -15,7 +15,7 @@ namespace IPC {
template<typename ConnectionFromClientType>
class MultiServer {
public:
static ErrorOr<NonnullOwnPtr<MultiServer>> try_create(Optional<String> socket_path = {})
static ErrorOr<NonnullOwnPtr<MultiServer>> try_create(Optional<DeprecatedString> socket_path = {})
{
auto server = TRY(Core::LocalServer::try_create());
TRY(server->take_over_from_system_server(socket_path.value_or({})));

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
namespace AK {
class BufferStream;
@ -24,14 +24,14 @@ public:
virtual ~Stub() = default;
virtual u32 magic() const = 0;
virtual String name() const = 0;
virtual DeprecatedString name() const = 0;
virtual OwnPtr<MessageBuffer> handle(Message const&) = 0;
protected:
Stub() = default;
private:
String m_name;
DeprecatedString m_name;
};
}