1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:47:35 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/Concepts.h>
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/Forward.h>
#include <AK/HashMap.h>
@ -35,11 +35,11 @@ public:
return try_make_ref_counted<NodeT>(token.m_view);
}
DeprecatedString to_deprecated_string() const
ByteString to_byte_string() const
{
StringBuilder builder;
format(builder, 0, false);
return builder.to_deprecated_string();
return builder.to_byte_string();
}
// Format this AST node with the builder at the given indentation level.
@ -64,7 +64,7 @@ public:
// Single line comments with //.
class Comment : public Node {
public:
Comment(DeprecatedString text)
Comment(ByteString text)
: m_text(move(text))
{
}
@ -82,13 +82,13 @@ public:
virtual ~Comment() override = default;
private:
DeprecatedString m_text {};
ByteString m_text {};
};
// Any JSON-like key: value pair.
class KeyValuePair : public Node {
public:
KeyValuePair(DeprecatedString key, NonnullRefPtr<ValueNode> value)
KeyValuePair(ByteString key, NonnullRefPtr<ValueNode> value)
: m_key(move(key))
, m_value(move(value))
{
@ -104,11 +104,11 @@ public:
builder.append('\n');
}
DeprecatedString key() const { return m_key; }
ByteString key() const { return m_key; }
NonnullRefPtr<ValueNode> value() const { return m_value; }
private:
DeprecatedString m_key;
ByteString m_key;
NonnullRefPtr<ValueNode> m_value;
};
@ -151,7 +151,7 @@ public:
class Object : public ValueNode {
public:
Object() = default;
Object(DeprecatedString name, Vector<NonnullRefPtr<Node const>> properties, Vector<NonnullRefPtr<Node const>> sub_objects)
Object(ByteString name, Vector<NonnullRefPtr<Node const>> properties, Vector<NonnullRefPtr<Node const>> sub_objects)
: m_properties(move(properties))
, m_sub_objects(move(sub_objects))
, m_name(move(name))
@ -161,7 +161,7 @@ public:
virtual ~Object() override = default;
StringView name() const { return m_name; }
void set_name(DeprecatedString name) { m_name = move(name); }
void set_name(ByteString name) { m_name = move(name); }
ErrorOr<void> add_sub_object_child(NonnullRefPtr<Node const> child)
{
@ -289,7 +289,7 @@ private:
Vector<NonnullRefPtr<Node const>> m_properties;
// Sub objects and comments
Vector<NonnullRefPtr<Node const>> m_sub_objects;
DeprecatedString m_name {};
ByteString 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 };
DeprecatedString identifier_string;
Vector<DeprecatedString> class_names;
ByteString identifier_string;
Vector<ByteString> class_names;
Vector<State> previous_states;
bool should_push_state { true };
Token* last_seen_token { nullptr };
@ -118,26 +118,26 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
fuzzy_str_builder.append(character);
fuzzy_str_builder.append('*');
}
return fuzzy_str_builder.to_deprecated_string();
return fuzzy_str_builder.to_byte_string();
};
Vector<CodeComprehension::AutocompleteResultEntry> class_entries, identifier_entries;
auto register_layouts_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_layouts_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
GUI::ObjectClassRegistration::for_each([&](const GUI::ObjectClassRegistration& registration) {
if (registration.is_derived_from(layout_class) && &registration != &layout_class && registration.class_name().matches(pattern))
class_entries.empend(DeprecatedString::formatted("@{}", registration.class_name()), partial_input_length);
class_entries.empend(ByteString::formatted("@{}", registration.class_name()), partial_input_length);
});
};
auto register_widgets_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_widgets_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
GUI::ObjectClassRegistration::for_each([&](const GUI::ObjectClassRegistration& registration) {
if (registration.is_derived_from(widget_class) && registration.class_name().matches(pattern))
class_entries.empend(DeprecatedString::formatted("@{}", registration.class_name()), partial_input_length);
class_entries.empend(ByteString::formatted("@{}", registration.class_name()), partial_input_length);
});
};
auto register_class_properties_matching_pattern = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_class_properties_matching_pattern = [&](ByteString 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(); !instance.is_error()) {
for (auto& it : instance.value()->properties()) {
if (!it.value->is_readonly() && it.key.matches(pattern))
identifier_entries.empend(DeprecatedString::formatted("{}: ", it.key), partial_input_length, CodeComprehension::Language::Unspecified, it.key);
identifier_entries.empend(ByteString::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 = [&](DeprecatedString pattern, size_t partial_input_length) {
auto register_properties_and_widgets_matching_pattern = [&](ByteString pattern, size_t partial_input_length) {
if (!class_names.is_empty()) {
register_class_properties_matching_pattern(pattern, partial_input_length);

View file

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