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

@ -8,18 +8,18 @@
#pragma once
#include <AK/Concepts.h>
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/HashMap.h>
#include <AK/JsonArray.h>
#include <AK/JsonObjectSerializer.h>
#include <AK/JsonValue.h>
#include <AK/String.h>
namespace AK {
class JsonObject {
template<typename Callback>
using CallbackErrorType = decltype(declval<Callback>()(declval<String const&>(), declval<JsonValue const&>()).release_error());
using CallbackErrorType = decltype(declval<Callback>()(declval<DeprecatedString const&>(), declval<JsonValue const&>()).release_error());
public:
JsonObject() = default;
@ -135,7 +135,7 @@ public:
}
#endif
void set(String const& key, JsonValue value)
void set(DeprecatedString const& key, JsonValue value)
{
m_members.set(key, move(value));
}
@ -147,7 +147,7 @@ public:
callback(member.key, member.value);
}
template<FallibleFunction<String const&, JsonValue const&> Callback>
template<FallibleFunction<DeprecatedString const&, JsonValue const&> Callback>
ErrorOr<void, CallbackErrorType<Callback>> try_for_each_member(Callback&& callback) const
{
for (auto const& member : m_members)
@ -166,10 +166,10 @@ public:
template<typename Builder>
void serialize(Builder&) const;
[[nodiscard]] String to_string() const { return serialized<StringBuilder>(); }
[[nodiscard]] DeprecatedString to_string() const { return serialized<StringBuilder>(); }
private:
OrderedHashMap<String, JsonValue> m_members;
OrderedHashMap<DeprecatedString, JsonValue> m_members;
};
template<typename Builder>