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

@ -7,6 +7,7 @@
#pragma once
#include <AK/Concepts.h>
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/Forward.h>
#include <AK/HashMap.h>
@ -17,7 +18,6 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/TypeCasts.h>
#include <LibGUI/GML/Lexer.h>
@ -37,7 +37,7 @@ public:
return try_make_ref_counted<NodeT>(token.m_view);
}
String to_string() const
DeprecatedString to_string() const
{
StringBuilder builder;
format(builder, 0, false);
@ -66,7 +66,7 @@ public:
// Single line comments with //.
class Comment : public Node {
public:
Comment(String text)
Comment(DeprecatedString text)
: m_text(move(text))
{
}
@ -84,13 +84,13 @@ public:
virtual ~Comment() override = default;
private:
String m_text {};
DeprecatedString m_text {};
};
// Any JSON-like key: value pair.
class KeyValuePair : public Node {
public:
KeyValuePair(String key, NonnullRefPtr<ValueNode> value)
KeyValuePair(DeprecatedString key, NonnullRefPtr<ValueNode> value)
: m_key(move(key))
, m_value(move(value))
{
@ -106,11 +106,11 @@ public:
builder.append('\n');
}
String key() const { return m_key; }
DeprecatedString key() const { return m_key; }
NonnullRefPtr<ValueNode> value() const { return m_value; }
private:
String m_key;
DeprecatedString m_key;
NonnullRefPtr<ValueNode> m_value;
};
@ -153,7 +153,7 @@ public:
class Object : public ValueNode {
public:
Object() = default;
Object(String name, NonnullRefPtrVector<Node> properties, NonnullRefPtrVector<Node> sub_objects)
Object(DeprecatedString name, NonnullRefPtrVector<Node> properties, NonnullRefPtrVector<Node> sub_objects)
: m_properties(move(properties))
, m_sub_objects(move(sub_objects))
, m_name(move(name))
@ -163,7 +163,7 @@ public:
virtual ~Object() override = default;
StringView name() const { return m_name; }
void set_name(String name) { m_name = move(name); }
void set_name(DeprecatedString name) { m_name = move(name); }
ErrorOr<void> add_sub_object_child(NonnullRefPtr<Node> child)
{
@ -279,7 +279,7 @@ private:
NonnullRefPtrVector<Node> m_properties;
// Sub objects and comments
NonnullRefPtrVector<Node> m_sub_objects;
String m_name {};
DeprecatedString m_name {};
};
class GMLFile : public Node {

View file

@ -25,8 +25,8 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
InIdentifier,
AfterIdentifier, // Can we introspect this?
} state { Free };
String identifier_string;
Vector<String> class_names;
DeprecatedString identifier_string;
Vector<DeprecatedString> class_names;
Vector<State> previous_states;
bool should_push_state { true };
Token* last_seen_token { nullptr };
@ -123,21 +123,21 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
Vector<CodeComprehension::AutocompleteResultEntry> class_entries, identifier_entries;
auto register_layouts_matching_pattern = [&](String pattern, size_t partial_input_length) {
auto register_layouts_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
Core::ObjectClassRegistration::for_each([&](const Core::ObjectClassRegistration& registration) {
if (registration.is_derived_from(layout_class) && &registration != &layout_class && registration.class_name().matches(pattern))
class_entries.empend(String::formatted("@{}", registration.class_name()), partial_input_length);
class_entries.empend(DeprecatedString::formatted("@{}", registration.class_name()), partial_input_length);
});
};
auto register_widgets_matching_pattern = [&](String pattern, size_t partial_input_length) {
auto register_widgets_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
Core::ObjectClassRegistration::for_each([&](const Core::ObjectClassRegistration& registration) {
if (registration.is_derived_from(widget_class) && registration.class_name().matches(pattern))
class_entries.empend(String::formatted("@{}", registration.class_name()), partial_input_length);
class_entries.empend(DeprecatedString::formatted("@{}", registration.class_name()), partial_input_length);
});
};
auto register_class_properties_matching_pattern = [&](String pattern, size_t partial_input_length) {
auto register_class_properties_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto class_name = class_names.last();
// FIXME: Don't show properties that are already specified in the scope.
@ -146,7 +146,7 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
if (auto instance = registration->construct()) {
for (auto& it : instance->properties()) {
if (!it.value->is_readonly() && it.key.matches(pattern))
identifier_entries.empend(String::formatted("{}: ", it.key), partial_input_length, CodeComprehension::Language::Unspecified, it.key);
identifier_entries.empend(DeprecatedString::formatted("{}: ", it.key), partial_input_length, CodeComprehension::Language::Unspecified, it.key);
}
}
}
@ -157,7 +157,7 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
identifier_entries.empend("content_widget: ", partial_input_length, CodeComprehension::Language::Unspecified, "content_widget", CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No);
};
auto register_properties_and_widgets_matching_pattern = [&](String pattern, size_t partial_input_length) {
auto register_properties_and_widgets_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
if (!class_names.is_empty()) {
register_class_properties_matching_pattern(pattern, partial_input_length);

View file

@ -6,14 +6,14 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Forward.h>
#include <AK/String.h>
#include <LibGUI/GML/AST.h>
#include <LibGUI/GML/Parser.h>
namespace GUI::GML {
inline ErrorOr<String> format_gml(StringView string)
inline ErrorOr<DeprecatedString> format_gml(StringView string)
{
return TRY(parse_gml(string))->to_string();
}