1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:34:57 +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

@ -5,11 +5,11 @@
*/
#include <AK/Assertions.h>
#include <AK/DeprecatedString.h>
#include <AK/GenericLexer.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/OwnPtr.h>
#include <AK/Queue.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@ -56,7 +56,7 @@ public:
virtual bool truth() const = 0;
virtual int integer() const = 0;
virtual String string() const = 0;
virtual DeprecatedString string() const = 0;
virtual Type type() const = 0;
virtual ~Expression() = default;
};
@ -69,7 +69,7 @@ public:
{
}
ValueExpression(String&& v)
ValueExpression(DeprecatedString&& v)
: as_string(move(v))
, m_type(Type::String)
{
@ -96,11 +96,11 @@ private:
}
VERIFY_NOT_REACHED();
}
virtual String string() const override
virtual DeprecatedString string() const override
{
switch (m_type) {
case Type::Integer:
return String::formatted("{}", as_integer);
return DeprecatedString::formatted("{}", as_integer);
case Type::String:
return as_string;
}
@ -110,7 +110,7 @@ private:
union {
int as_integer;
String as_string;
DeprecatedString as_string;
};
Type m_type { Type::String };
};
@ -161,7 +161,7 @@ private:
VERIFY_NOT_REACHED();
}
virtual String string() const override
virtual DeprecatedString string() const override
{
switch (m_op) {
case BooleanOperator::And:
@ -260,7 +260,7 @@ private:
VERIFY_NOT_REACHED();
}
virtual int integer() const override { return truth(); }
virtual String string() const override { return truth() ? "1" : "0"; }
virtual DeprecatedString string() const override { return truth() ? "1" : "0"; }
virtual Type type() const override { return Type::Integer; }
ComparisonOperation m_op { ComparisonOperation::Less };
@ -330,9 +330,9 @@ private:
}
VERIFY_NOT_REACHED();
}
virtual String string() const override
virtual DeprecatedString string() const override
{
return String::formatted("{}", integer());
return DeprecatedString::formatted("{}", integer());
}
virtual Type type() const override
{
@ -388,7 +388,7 @@ private:
VERIFY_NOT_REACHED();
}
static auto safe_substring(String const& str, int start, int length)
static auto safe_substring(DeprecatedString const& str, int start, int length)
{
if (start < 1 || (size_t)start > str.length())
fail("Index out of range");
@ -397,7 +397,7 @@ private:
fail("Index out of range");
return str.substring(start, length);
}
virtual String string() const override
virtual DeprecatedString string() const override
{
if (m_op == StringOperation::Substring)
return safe_substring(m_str->string(), m_pos_or_chars->integer(), m_length->integer());
@ -412,7 +412,7 @@ private:
for (auto& m : match.matches)
count += m.view.length();
return String::number(count);
return DeprecatedString::number(count);
} else {
if (!match.success)
return "";
@ -425,7 +425,7 @@ private:
}
}
return String::number(integer());
return DeprecatedString::number(integer());
}
virtual Type type() const override
{