diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Utilities/expr.cpp | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip |
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 :^)
Diffstat (limited to 'Userland/Utilities/expr.cpp')
-rw-r--r-- | Userland/Utilities/expr.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Userland/Utilities/expr.cpp b/Userland/Utilities/expr.cpp index f2ad7d59ba..a49f90ade0 100644 --- a/Userland/Utilities/expr.cpp +++ b/Userland/Utilities/expr.cpp @@ -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 { |