1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:47:45 +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

@ -9,7 +9,7 @@
namespace Crypto::ASN1 {
String kind_name(Kind kind)
DeprecatedString kind_name(Kind kind)
{
switch (kind) {
case Kind::Eol:
@ -45,7 +45,7 @@ String kind_name(Kind kind)
return "InvalidKind";
}
String class_name(Class class_)
DeprecatedString class_name(Class class_)
{
switch (class_) {
case Class::Application:
@ -61,7 +61,7 @@ String class_name(Class class_)
return "InvalidClass";
}
String type_name(Type type)
DeprecatedString type_name(Type type)
{
switch (type) {
case Type::Constructed:

View file

@ -48,9 +48,9 @@ struct Tag {
Type type;
};
String kind_name(Kind);
String class_name(Class);
String type_name(Type);
DeprecatedString kind_name(Kind);
DeprecatedString class_name(Class);
DeprecatedString type_name(Type);
Optional<Core::DateTime> parse_utc_time(StringView);
Optional<Core::DateTime> parse_generalized_time(StringView);

View file

@ -12,7 +12,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -49,7 +49,7 @@ public:
constexpr static size_t digest_size() { return TagType::Size; }
#ifndef KERNEL
String class_name() const
DeprecatedString class_name() const
{
return "GHash";
}

View file

@ -13,7 +13,7 @@
#include <AK/Vector.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
constexpr static auto IPAD = 0x36;
@ -74,7 +74,7 @@ public:
}
#ifndef KERNEL
String class_name() const
DeprecatedString class_name() const
{
StringBuilder builder;
builder.append("HMAC-"sv);

View file

@ -5,8 +5,8 @@
*/
#include "BigFraction.h"
#include <AK/DeprecatedString.h>
#include <AK/Math.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCrypto/NumberTheory/ModularFunctions.h>
@ -184,7 +184,7 @@ void BigFraction::reduce()
m_denominator = denominator_divide.quotient;
}
String BigFraction::to_string(unsigned rounding_threshold) const
DeprecatedString BigFraction::to_string(unsigned rounding_threshold) const
{
StringBuilder builder;
if (m_numerator.is_negative() && m_numerator != "0"_bigint)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibCrypto/BigInt/SignedBigInteger.h>
namespace Crypto {
@ -54,7 +54,7 @@ public:
// - m_denominator = 10000
BigFraction rounded(unsigned rounding_threshold) const;
String to_string(unsigned rounding_threshold) const;
DeprecatedString to_string(unsigned rounding_threshold) const;
double to_double() const;
private:

View file

@ -51,7 +51,7 @@ SignedBigInteger SignedBigInteger::from_base(u16 N, StringView str)
return { move(unsigned_data), sign };
}
String SignedBigInteger::to_base(u16 N) const
DeprecatedString SignedBigInteger::to_base(u16 N) const
{
StringBuilder builder;

View file

@ -62,7 +62,7 @@ public:
size_t export_data(Bytes, bool remove_leading_zeros = false) const;
[[nodiscard]] static SignedBigInteger from_base(u16 N, StringView str);
[[nodiscard]] String to_base(u16 N) const;
[[nodiscard]] DeprecatedString to_base(u16 N) const;
[[nodiscard]] u64 to_u64() const;
[[nodiscard]] double to_double(UnsignedBigInteger::RoundingMode rounding_mode = UnsignedBigInteger::RoundingMode::IEEERoundAndTiesToEvenMantissa) const;

View file

@ -146,7 +146,7 @@ UnsignedBigInteger UnsignedBigInteger::from_base(u16 N, StringView str)
return result;
}
String UnsignedBigInteger::to_base(u16 N) const
DeprecatedString UnsignedBigInteger::to_base(u16 N) const
{
VERIFY(N <= 36);
if (*this == UnsignedBigInteger { 0 })

View file

@ -9,8 +9,8 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/DeprecatedString.h>
#include <AK/Span.h>
#include <AK/String.h>
#include <AK/Types.h>
#include <AK/Vector.h>
@ -62,7 +62,7 @@ public:
size_t export_data(Bytes, bool remove_leading_zeros = false) const;
[[nodiscard]] static UnsignedBigInteger from_base(u16 N, StringView str);
[[nodiscard]] String to_base(u16 N) const;
[[nodiscard]] DeprecatedString to_base(u16 N) const;
[[nodiscard]] u64 to_u64() const;

View file

@ -25,7 +25,7 @@ constexpr void swap_keys(u32* keys, size_t i, size_t j)
}
#ifndef KERNEL
String AESCipherBlock::to_string() const
DeprecatedString AESCipherBlock::to_string() const
{
StringBuilder builder;
for (auto value : m_data)
@ -33,7 +33,7 @@ String AESCipherBlock::to_string() const
return builder.build();
}
String AESCipherKey::to_string() const
DeprecatedString AESCipherKey::to_string() const
{
StringBuilder builder;
for (size_t i = 0; i < (rounds() + 1) * 4; ++i)

View file

@ -14,7 +14,7 @@
#include <LibCrypto/Cipher/Mode/GCM.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -49,7 +49,7 @@ public:
}
#ifndef KERNEL
String to_string() const;
DeprecatedString to_string() const;
#endif
private:
@ -65,7 +65,7 @@ struct AESCipherKey : public CipherKey {
static bool is_valid_key_size(size_t bits) { return bits == 128 || bits == 192 || bits == 256; };
#ifndef KERNEL
String to_string() const;
DeprecatedString to_string() const;
#endif
u32 const* round_keys() const
@ -121,7 +121,7 @@ public:
virtual void decrypt_block(BlockType const& in, BlockType& out) override;
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return "AES";
}

View file

@ -113,7 +113,7 @@ public:
virtual void decrypt_block(BlockType const& in, BlockType& out) = 0;
#ifndef KERNEL
virtual String class_name() const = 0;
virtual DeprecatedString class_name() const = 0;
#endif
protected:

View file

@ -11,7 +11,7 @@
#include <LibCrypto/Cipher/Mode/Mode.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -30,7 +30,7 @@ public:
}
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());

View file

@ -11,7 +11,7 @@
#include <LibCrypto/Cipher/Mode/Mode.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -105,7 +105,7 @@ public:
}
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());

View file

@ -15,7 +15,7 @@
#include <LibCrypto/Verification.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -45,7 +45,7 @@ public:
}
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());

View file

@ -36,7 +36,7 @@ public:
}
#ifndef KERNEL
virtual String class_name() const = 0;
virtual DeprecatedString class_name() const = 0;
#endif
T& cipher()

View file

@ -5,9 +5,9 @@
*/
#include <AK/ByteReader.h>
#include <AK/DeprecatedString.h>
#include <AK/Endian.h>
#include <AK/Random.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/UFixedBigInt.h>
#include <LibCrypto/Curves/SECP256r1.h>

View file

@ -52,7 +52,7 @@ public:
virtual void reset() = 0;
#ifndef KERNEL
virtual String class_name() const = 0;
virtual DeprecatedString class_name() const = 0;
#endif
protected:

View file

@ -192,10 +192,10 @@ public:
}
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return m_algorithm.visit(
[&](Empty const&) -> String { return "UninitializedHashManager"; },
[&](Empty const&) -> DeprecatedString { return "UninitializedHashManager"; },
[&](auto const& hash) { return hash.class_name(); });
}
#endif

View file

@ -10,7 +10,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -57,7 +57,7 @@ public:
virtual DigestType peek() override;
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return "MD5";
}

View file

@ -9,7 +9,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -53,7 +53,7 @@ public:
inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return "SHA1";
}

View file

@ -10,7 +10,7 @@
#include <LibCrypto/Hash/HashFunction.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -101,9 +101,9 @@ public:
inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return String::formatted("SHA{}", DigestSize * 8);
return DeprecatedString::formatted("SHA{}", DigestSize * 8);
}
#endif
@ -153,9 +153,9 @@ public:
inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return String::formatted("SHA{}", DigestSize * 8);
return DeprecatedString::formatted("SHA{}", DigestSize * 8);
}
#endif
@ -205,9 +205,9 @@ public:
inline static DigestType hash(StringView buffer) { return hash((u8 const*)buffer.characters_without_null_termination(), buffer.length()); }
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return String::formatted("SHA{}", DigestSize * 8);
return DeprecatedString::formatted("SHA{}", DigestSize * 8);
}
#endif

View file

@ -9,7 +9,7 @@
#include <AK/ByteBuffer.h>
#ifndef KERNEL
# include <AK/String.h>
# include <AK/DeprecatedString.h>
#endif
namespace Crypto {
@ -37,7 +37,7 @@ public:
virtual void verify(ReadonlyBytes in, Bytes& out) = 0;
#ifndef KERNEL
virtual String class_name() const = 0;
virtual DeprecatedString class_name() const = 0;
#endif
virtual size_t output_size() const = 0;

View file

@ -162,7 +162,7 @@ public:
virtual void verify(ReadonlyBytes in, Bytes& out) override;
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return "RSA";
}
@ -214,7 +214,7 @@ public:
virtual void verify(ReadonlyBytes, Bytes&) override;
#ifndef KERNEL
virtual String class_name() const override
virtual DeprecatedString class_name() const override
{
return "RSA_PKCS1-EME";
}