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

@ -570,12 +570,12 @@ public:
return *m_state;
}
String to_string() const
DeprecatedString to_string() const
{
return String::formatted("[{:#02X}] {}", (int)opcode_id(), name(opcode_id()));
return DeprecatedString::formatted("[{:#02X}] {}", (int)opcode_id(), name(opcode_id()));
}
virtual String arguments_string() const = 0;
virtual DeprecatedString arguments_string() const = 0;
ALWAYS_INLINE ByteCode const& bytecode() const { return *m_bytecode; }
@ -589,7 +589,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::Exit; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_FailForks final : public OpCode {
@ -597,7 +597,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::FailForks; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_Save final : public OpCode {
@ -605,7 +605,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::Save; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_Restore final : public OpCode {
@ -613,7 +613,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::Restore; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_GoBack final : public OpCode {
@ -622,7 +622,7 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::GoBack; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE size_t count() const { return argument(0); }
String arguments_string() const override { return String::formatted("count={}", count()); }
DeprecatedString arguments_string() const override { return DeprecatedString::formatted("count={}", count()); }
};
class OpCode_Jump final : public OpCode {
@ -631,9 +631,9 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::Jump; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE ssize_t offset() const { return argument(0); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
return String::formatted("offset={} [&{}]", offset(), state().instruction_position + size() + offset());
return DeprecatedString::formatted("offset={} [&{}]", offset(), state().instruction_position + size() + offset());
}
};
@ -643,9 +643,9 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::ForkJump; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE ssize_t offset() const { return argument(0); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
return String::formatted("offset={} [&{}], sp: {}", offset(), state().instruction_position + size() + offset(), state().string_position);
return DeprecatedString::formatted("offset={} [&{}], sp: {}", offset(), state().instruction_position + size() + offset(), state().string_position);
}
};
@ -661,9 +661,9 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::ForkStay; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE ssize_t offset() const { return argument(0); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
return String::formatted("offset={} [&{}], sp: {}", offset(), state().instruction_position + size() + offset(), state().string_position);
return DeprecatedString::formatted("offset={} [&{}], sp: {}", offset(), state().instruction_position + size() + offset(), state().string_position);
}
};
@ -678,7 +678,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::CheckBegin; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_CheckEnd final : public OpCode {
@ -686,7 +686,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::CheckEnd; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_CheckBoundary final : public OpCode {
@ -696,7 +696,7 @@ public:
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE size_t arguments_count() const { return 1; }
ALWAYS_INLINE BoundaryCheckType type() const { return static_cast<BoundaryCheckType>(argument(0)); }
String arguments_string() const override { return String::formatted("kind={} ({})", (long unsigned int)argument(0), boundary_check_type_name(type())); }
DeprecatedString arguments_string() const override { return DeprecatedString::formatted("kind={} ({})", (long unsigned int)argument(0), boundary_check_type_name(type())); }
};
class OpCode_ClearCaptureGroup final : public OpCode {
@ -705,7 +705,7 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::ClearCaptureGroup; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE size_t id() const { return argument(0); }
String arguments_string() const override { return String::formatted("id={}", id()); }
DeprecatedString arguments_string() const override { return DeprecatedString::formatted("id={}", id()); }
};
class OpCode_SaveLeftCaptureGroup final : public OpCode {
@ -714,7 +714,7 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::SaveLeftCaptureGroup; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE size_t id() const { return argument(0); }
String arguments_string() const override { return String::formatted("id={}", id()); }
DeprecatedString arguments_string() const override { return DeprecatedString::formatted("id={}", id()); }
};
class OpCode_SaveRightCaptureGroup final : public OpCode {
@ -723,7 +723,7 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::SaveRightCaptureGroup; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE size_t id() const { return argument(0); }
String arguments_string() const override { return String::formatted("id={}", id()); }
DeprecatedString arguments_string() const override { return DeprecatedString::formatted("id={}", id()); }
};
class OpCode_SaveRightNamedCaptureGroup final : public OpCode {
@ -734,9 +734,9 @@ public:
ALWAYS_INLINE StringView name() const { return { reinterpret_cast<char*>(argument(0)), length() }; }
ALWAYS_INLINE size_t length() const { return argument(1); }
ALWAYS_INLINE size_t id() const { return argument(2); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
return String::formatted("name={}, length={}", name(), length());
return DeprecatedString::formatted("name={}, length={}", name(), length());
}
};
@ -747,8 +747,8 @@ public:
ALWAYS_INLINE size_t size() const override { return arguments_size() + 3; }
ALWAYS_INLINE size_t arguments_count() const { return argument(0); }
ALWAYS_INLINE size_t arguments_size() const { return argument(1); }
String arguments_string() const override;
Vector<String> variable_arguments_to_string(Optional<MatchInput const&> input = {}) const;
DeprecatedString arguments_string() const override;
Vector<DeprecatedString> variable_arguments_to_string(Optional<MatchInput const&> input = {}) const;
Vector<CompareTypeAndValuePair> flat_compares() const;
static bool matches_character_class(CharClass, u32, bool insensitive);
@ -771,10 +771,10 @@ public:
ALWAYS_INLINE size_t offset() const { return argument(0); }
ALWAYS_INLINE u64 count() const { return argument(1); }
ALWAYS_INLINE size_t id() const { return argument(2); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
auto reps = id() < state().repetition_marks.size() ? state().repetition_marks.at(id()) : 0;
return String::formatted("offset={} count={} id={} rep={}, sp: {}", offset(), count() + 1, id(), reps + 1, state().string_position);
return DeprecatedString::formatted("offset={} count={} id={} rep={}, sp: {}", offset(), count() + 1, id(), reps + 1, state().string_position);
}
};
@ -784,10 +784,10 @@ public:
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::ResetRepeat; }
ALWAYS_INLINE size_t size() const override { return 2; }
ALWAYS_INLINE size_t id() const { return argument(0); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
auto reps = id() < state().repetition_marks.size() ? state().repetition_marks.at(id()) : 0;
return String::formatted("id={} rep={}", id(), reps + 1);
return DeprecatedString::formatted("id={} rep={}", id(), reps + 1);
}
};
@ -796,7 +796,7 @@ public:
ExecutionResult execute(MatchInput const& input, MatchState& state) const override;
ALWAYS_INLINE OpCodeId opcode_id() const override { return OpCodeId::Checkpoint; }
ALWAYS_INLINE size_t size() const override { return 1; }
String arguments_string() const override { return String::empty(); }
DeprecatedString arguments_string() const override { return DeprecatedString::empty(); }
};
class OpCode_JumpNonEmpty final : public OpCode {
@ -807,9 +807,9 @@ public:
ALWAYS_INLINE ssize_t offset() const { return argument(0); }
ALWAYS_INLINE ssize_t checkpoint() const { return argument(1); }
ALWAYS_INLINE OpCodeId form() const { return (OpCodeId)argument(2); }
String arguments_string() const override
DeprecatedString arguments_string() const override
{
return String::formatted("{} offset={} [&{}], cp={} [&{}]",
return DeprecatedString::formatted("{} offset={} [&{}], cp={} [&{}]",
opcode_id_name(form()),
offset(), state().instruction_position + size() + offset(),
checkpoint(), state().instruction_position + size() + checkpoint());