mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:27:34 +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:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -9,11 +9,11 @@
|
|||
#include "Forward.h"
|
||||
#include "Job.h"
|
||||
#include "NodeVisitor.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibLine/Editor.h>
|
||||
|
@ -50,7 +50,7 @@ struct Position {
|
|||
};
|
||||
|
||||
struct NameWithPosition {
|
||||
String name;
|
||||
DeprecatedString name;
|
||||
Position position;
|
||||
};
|
||||
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
};
|
||||
|
||||
struct PathRedirection : public Redirection {
|
||||
String path;
|
||||
DeprecatedString path;
|
||||
int fd { -1 };
|
||||
enum {
|
||||
Read,
|
||||
|
@ -116,7 +116,7 @@ struct PathRedirection : public Redirection {
|
|||
ReadWrite,
|
||||
} direction { Read };
|
||||
|
||||
static NonnullRefPtr<PathRedirection> create(String path, int fd, decltype(direction) direction)
|
||||
static NonnullRefPtr<PathRedirection> create(DeprecatedString path, int fd, decltype(direction) direction)
|
||||
{
|
||||
return adopt_ref(*new PathRedirection(move(path), fd, direction));
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ struct PathRedirection : public Redirection {
|
|||
virtual ~PathRedirection();
|
||||
|
||||
private:
|
||||
PathRedirection(String path, int fd, decltype(direction) direction)
|
||||
PathRedirection(DeprecatedString path, int fd, decltype(direction) direction)
|
||||
: path(move(path))
|
||||
, fd(fd)
|
||||
, direction(direction)
|
||||
|
@ -197,7 +197,7 @@ struct NodeWithAction {
|
|||
};
|
||||
|
||||
struct Command {
|
||||
Vector<String> argv;
|
||||
Vector<DeprecatedString> argv;
|
||||
NonnullRefPtrVector<Redirection> redirections;
|
||||
bool should_wait { true };
|
||||
bool is_pipe_source { false };
|
||||
|
@ -217,8 +217,8 @@ struct HitTestResult {
|
|||
|
||||
class Value : public RefCounted<Value> {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) = 0;
|
||||
virtual String resolve_as_string(RefPtr<Shell> shell);
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) = 0;
|
||||
virtual DeprecatedString resolve_as_string(RefPtr<Shell> shell);
|
||||
virtual Vector<Command> resolve_as_commands(RefPtr<Shell>);
|
||||
virtual NonnullRefPtr<Value> resolve_without_cast(RefPtr<Shell>) { return *this; }
|
||||
virtual NonnullRefPtr<Value> clone() const = 0;
|
||||
|
@ -243,7 +243,7 @@ protected:
|
|||
|
||||
class CommandValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual Vector<Command> resolve_as_commands(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<CommandValue>(m_command)->set_slices(m_slices); }
|
||||
virtual ~CommandValue();
|
||||
|
@ -253,7 +253,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
CommandValue(Vector<String> argv, Position position)
|
||||
CommandValue(Vector<DeprecatedString> argv, Position position)
|
||||
: m_command({ move(argv), {}, true, false, true, false, nullptr, {}, move(position) })
|
||||
{
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ private:
|
|||
|
||||
class CommandSequenceValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual Vector<Command> resolve_as_commands(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<CommandSequenceValue>(m_contained_values)->set_slices(m_slices); }
|
||||
virtual ~CommandSequenceValue();
|
||||
|
@ -280,8 +280,8 @@ private:
|
|||
|
||||
class JobValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override { VERIFY_NOT_REACHED(); }
|
||||
virtual String resolve_as_string(RefPtr<Shell>) override { return String::formatted("%{}", m_job->job_id()); }
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override { VERIFY_NOT_REACHED(); }
|
||||
virtual DeprecatedString resolve_as_string(RefPtr<Shell>) override { return DeprecatedString::formatted("%{}", m_job->job_id()); }
|
||||
virtual Vector<Command> resolve_as_commands(RefPtr<Shell>) override { VERIFY_NOT_REACHED(); }
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<JobValue>(m_job)->set_slices(m_slices); }
|
||||
virtual ~JobValue();
|
||||
|
@ -299,13 +299,13 @@ private:
|
|||
|
||||
class ListValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> resolve_without_cast(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<ListValue>(m_contained_values)->set_slices(m_slices); }
|
||||
virtual ~ListValue();
|
||||
virtual bool is_list() const override { return true; }
|
||||
virtual bool is_list_without_resolution() const override { return true; }
|
||||
ListValue(Vector<String> values);
|
||||
ListValue(Vector<DeprecatedString> values);
|
||||
ListValue(NonnullRefPtrVector<Value> values)
|
||||
: m_contained_values(move(values))
|
||||
{
|
||||
|
@ -320,14 +320,14 @@ private:
|
|||
|
||||
class StringValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual String resolve_as_string(RefPtr<Shell> shell) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual DeprecatedString resolve_as_string(RefPtr<Shell> shell) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<StringValue>(m_string, m_split, m_keep_empty)->set_slices(m_slices); }
|
||||
virtual ~StringValue();
|
||||
virtual bool is_string() const override { return m_split.is_null(); }
|
||||
virtual bool is_list() const override { return !m_split.is_null(); }
|
||||
NonnullRefPtr<Value> resolve_without_cast(RefPtr<Shell>) override;
|
||||
StringValue(String string, String split_by = {}, bool keep_empty = false)
|
||||
StringValue(DeprecatedString string, DeprecatedString split_by = {}, bool keep_empty = false)
|
||||
: m_string(move(string))
|
||||
, m_split(move(split_by))
|
||||
, m_keep_empty(keep_empty)
|
||||
|
@ -335,48 +335,48 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
String m_string;
|
||||
String m_split;
|
||||
DeprecatedString m_string;
|
||||
DeprecatedString m_split;
|
||||
bool m_keep_empty { false };
|
||||
};
|
||||
|
||||
class GlobValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<GlobValue>(m_glob, m_generation_position)->set_slices(m_slices); }
|
||||
virtual ~GlobValue();
|
||||
virtual bool is_glob() const override { return true; }
|
||||
GlobValue(String glob, Position position)
|
||||
GlobValue(DeprecatedString glob, Position position)
|
||||
: m_glob(move(glob))
|
||||
, m_generation_position(move(position))
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
String m_glob;
|
||||
DeprecatedString m_glob;
|
||||
Position m_generation_position;
|
||||
};
|
||||
|
||||
class SimpleVariableValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual String resolve_as_string(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual DeprecatedString resolve_as_string(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> resolve_without_cast(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<SimpleVariableValue>(m_name)->set_slices(m_slices); }
|
||||
virtual ~SimpleVariableValue();
|
||||
SimpleVariableValue(String name)
|
||||
SimpleVariableValue(DeprecatedString name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
DeprecatedString m_name;
|
||||
};
|
||||
|
||||
class SpecialVariableValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual String resolve_as_string(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual DeprecatedString resolve_as_string(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> resolve_without_cast(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<SpecialVariableValue>(m_name)->set_slices(m_slices); }
|
||||
virtual ~SpecialVariableValue();
|
||||
|
@ -391,18 +391,18 @@ private:
|
|||
|
||||
class TildeValue final : public Value {
|
||||
public:
|
||||
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual String resolve_as_string(RefPtr<Shell>) override;
|
||||
virtual Vector<DeprecatedString> resolve_as_list(RefPtr<Shell>) override;
|
||||
virtual DeprecatedString resolve_as_string(RefPtr<Shell>) override;
|
||||
virtual NonnullRefPtr<Value> clone() const override { return make_ref_counted<TildeValue>(m_username)->set_slices(m_slices); }
|
||||
virtual ~TildeValue();
|
||||
virtual bool is_string() const override { return true; }
|
||||
TildeValue(String name)
|
||||
TildeValue(DeprecatedString name)
|
||||
: m_username(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
String m_username;
|
||||
DeprecatedString m_username;
|
||||
};
|
||||
|
||||
class Node : public RefCounted<Node> {
|
||||
|
@ -422,7 +422,7 @@ public:
|
|||
return { this, nullptr, nullptr };
|
||||
return { nullptr, nullptr, nullptr };
|
||||
}
|
||||
virtual String class_name() const { return "Node"; }
|
||||
virtual DeprecatedString class_name() const { return "Node"; }
|
||||
Node(Position);
|
||||
virtual ~Node() = default;
|
||||
|
||||
|
@ -509,14 +509,14 @@ protected:
|
|||
RefPtr<SyntaxError> m_syntax_error_node;
|
||||
};
|
||||
|
||||
#define NODE(name) \
|
||||
virtual String class_name() const override \
|
||||
{ \
|
||||
return #name; \
|
||||
} \
|
||||
virtual Kind kind() const override \
|
||||
{ \
|
||||
return Kind::name; \
|
||||
#define NODE(name) \
|
||||
virtual DeprecatedString class_name() const override \
|
||||
{ \
|
||||
return #name; \
|
||||
} \
|
||||
virtual Kind kind() const override \
|
||||
{ \
|
||||
return Kind::name; \
|
||||
}
|
||||
|
||||
class PathRedirectionNode : public Node {
|
||||
|
@ -600,11 +600,11 @@ private:
|
|||
|
||||
class BarewordLiteral final : public Node {
|
||||
public:
|
||||
BarewordLiteral(Position, String);
|
||||
BarewordLiteral(Position, DeprecatedString);
|
||||
virtual ~BarewordLiteral() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String const& text() const { return m_text; }
|
||||
DeprecatedString const& text() const { return m_text; }
|
||||
|
||||
private:
|
||||
NODE(BarewordLiteral);
|
||||
|
@ -614,7 +614,7 @@ private:
|
|||
virtual bool is_bareword() const override { return true; }
|
||||
virtual RefPtr<Node> leftmost_trivial_literal() const override { return this; }
|
||||
|
||||
String m_text;
|
||||
DeprecatedString m_text;
|
||||
};
|
||||
|
||||
class BraceExpansion final : public Node {
|
||||
|
@ -717,11 +717,11 @@ private:
|
|||
|
||||
class Comment : public Node {
|
||||
public:
|
||||
Comment(Position, String);
|
||||
Comment(Position, DeprecatedString);
|
||||
virtual ~Comment();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String const& text() const { return m_text; }
|
||||
DeprecatedString const& text() const { return m_text; }
|
||||
|
||||
private:
|
||||
NODE(Comment);
|
||||
|
@ -729,7 +729,7 @@ private:
|
|||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
|
||||
String m_text;
|
||||
DeprecatedString m_text;
|
||||
};
|
||||
|
||||
class ContinuationControl final : public Node {
|
||||
|
@ -880,11 +880,11 @@ private:
|
|||
|
||||
class Glob final : public Node {
|
||||
public:
|
||||
Glob(Position, String);
|
||||
Glob(Position, DeprecatedString);
|
||||
virtual ~Glob();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String const& text() const { return m_text; }
|
||||
DeprecatedString const& text() const { return m_text; }
|
||||
|
||||
private:
|
||||
NODE(Glob);
|
||||
|
@ -894,7 +894,7 @@ private:
|
|||
virtual bool is_glob() const override { return true; }
|
||||
virtual bool is_list() const override { return true; }
|
||||
|
||||
String m_text;
|
||||
DeprecatedString m_text;
|
||||
};
|
||||
|
||||
struct HistorySelector {
|
||||
|
@ -913,7 +913,7 @@ struct HistorySelector {
|
|||
EventKind kind { IndexFromStart };
|
||||
size_t index { 0 };
|
||||
Position text_position;
|
||||
String text;
|
||||
DeprecatedString text;
|
||||
} event;
|
||||
|
||||
struct WordSelector {
|
||||
|
@ -1014,7 +1014,7 @@ public:
|
|||
|
||||
NonnullRefPtrVector<Node> const& arguments() const { return m_arguments; }
|
||||
auto const& function() const { return m_function; }
|
||||
String const& function_name() const { return m_function.name; }
|
||||
DeprecatedString const& function_name() const { return m_function.name; }
|
||||
Position const& function_position() const { return m_function.position; }
|
||||
bool has_closing_brace() const { return m_closing_brace_position.has_value(); }
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ private:
|
|||
|
||||
struct MatchEntry {
|
||||
Variant<NonnullRefPtrVector<Node>, Vector<Regex<ECMA262>>> options;
|
||||
Optional<Vector<String>> match_names;
|
||||
Optional<Vector<DeprecatedString>> match_names;
|
||||
Optional<Position> match_as_position;
|
||||
Vector<Position> pipe_positions;
|
||||
RefPtr<Node> body;
|
||||
|
@ -1064,12 +1064,12 @@ struct MatchEntry {
|
|||
|
||||
class MatchExpr final : public Node {
|
||||
public:
|
||||
MatchExpr(Position, NonnullRefPtr<Node> expr, String name, Optional<Position> as_position, Vector<MatchEntry> entries);
|
||||
MatchExpr(Position, NonnullRefPtr<Node> expr, DeprecatedString name, Optional<Position> as_position, Vector<MatchEntry> entries);
|
||||
virtual ~MatchExpr();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
NonnullRefPtr<Node> const& matched_expr() const { return m_matched_expr; }
|
||||
String const& expr_name() const { return m_expr_name; }
|
||||
DeprecatedString const& expr_name() const { return m_expr_name; }
|
||||
Vector<MatchEntry> const& entries() const { return m_entries; }
|
||||
Optional<Position> const& as_position() const { return m_as_position; }
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ private:
|
|||
virtual bool should_override_execution_in_current_process() const override { return true; }
|
||||
|
||||
NonnullRefPtr<Node> m_matched_expr;
|
||||
String m_expr_name;
|
||||
DeprecatedString m_expr_name;
|
||||
Optional<Position> m_as_position;
|
||||
Vector<MatchEntry> m_entries;
|
||||
};
|
||||
|
@ -1262,11 +1262,11 @@ protected:
|
|||
|
||||
class SimpleVariable final : public VariableNode {
|
||||
public:
|
||||
SimpleVariable(Position, String);
|
||||
SimpleVariable(Position, DeprecatedString);
|
||||
virtual ~SimpleVariable();
|
||||
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
String const& name() const { return m_name; }
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
|
||||
private:
|
||||
NODE(SimpleVariable);
|
||||
|
@ -1277,7 +1277,7 @@ private:
|
|||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual bool is_simple_variable() const override { return true; }
|
||||
|
||||
String m_name;
|
||||
DeprecatedString m_name;
|
||||
};
|
||||
|
||||
class SpecialVariable final : public VariableNode {
|
||||
|
@ -1322,11 +1322,11 @@ private:
|
|||
|
||||
class Heredoc final : public Node {
|
||||
public:
|
||||
Heredoc(Position, String end, bool allow_interpolation, bool deindent);
|
||||
Heredoc(Position, DeprecatedString end, bool allow_interpolation, bool deindent);
|
||||
virtual ~Heredoc();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String const& end() const { return m_end; }
|
||||
DeprecatedString const& end() const { return m_end; }
|
||||
bool allow_interpolation() const { return m_allows_interpolation; }
|
||||
bool deindent() const { return m_deindent; }
|
||||
RefPtr<AST::Node> const& contents() const { return m_contents; }
|
||||
|
@ -1347,7 +1347,7 @@ private:
|
|||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual RefPtr<Node> leftmost_trivial_literal() const override { return this; };
|
||||
|
||||
String m_end;
|
||||
DeprecatedString m_end;
|
||||
bool m_allows_interpolation { false };
|
||||
bool m_deindent { false };
|
||||
RefPtr<AST::Node> m_contents;
|
||||
|
@ -1361,11 +1361,11 @@ public:
|
|||
DoubleQuotes,
|
||||
};
|
||||
|
||||
StringLiteral(Position, String, EnclosureType);
|
||||
StringLiteral(Position, DeprecatedString, EnclosureType);
|
||||
virtual ~StringLiteral();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String const& text() const { return m_text; }
|
||||
DeprecatedString const& text() const { return m_text; }
|
||||
EnclosureType enclosure_type() const { return m_enclosure_type; }
|
||||
|
||||
private:
|
||||
|
@ -1375,7 +1375,7 @@ private:
|
|||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual RefPtr<Node> leftmost_trivial_literal() const override { return this; };
|
||||
|
||||
String m_text;
|
||||
DeprecatedString m_text;
|
||||
EnclosureType m_enclosure_type;
|
||||
};
|
||||
|
||||
|
@ -1401,11 +1401,11 @@ private:
|
|||
|
||||
class SyntaxError final : public Node {
|
||||
public:
|
||||
SyntaxError(Position, String, bool is_continuable = false);
|
||||
SyntaxError(Position, DeprecatedString, bool is_continuable = false);
|
||||
virtual ~SyntaxError();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String const& error_text() const { return m_syntax_error_text; }
|
||||
DeprecatedString const& error_text() const { return m_syntax_error_text; }
|
||||
bool is_continuable() const { return m_is_continuable; }
|
||||
|
||||
virtual void clear_syntax_error() override
|
||||
|
@ -1430,7 +1430,7 @@ private:
|
|||
virtual HitTestResult hit_test_position(size_t) const override { return { nullptr, nullptr, nullptr }; }
|
||||
virtual SyntaxError const& syntax_error_node() const override;
|
||||
|
||||
String m_syntax_error_text;
|
||||
DeprecatedString m_syntax_error_text;
|
||||
bool m_is_continuable { false };
|
||||
bool m_is_cleared { false };
|
||||
};
|
||||
|
@ -1454,11 +1454,11 @@ private:
|
|||
|
||||
class Tilde final : public Node {
|
||||
public:
|
||||
Tilde(Position, String);
|
||||
Tilde(Position, DeprecatedString);
|
||||
virtual ~Tilde();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
String text() const;
|
||||
DeprecatedString text() const;
|
||||
|
||||
private:
|
||||
NODE(Tilde);
|
||||
|
@ -1469,7 +1469,7 @@ private:
|
|||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual bool is_tilde() const override { return true; }
|
||||
|
||||
String m_username;
|
||||
DeprecatedString m_username;
|
||||
};
|
||||
|
||||
class VariableDeclarations final : public Node {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue