From d51f84501a218452cf873df4d0862fb765b51334 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 23 Dec 2023 15:58:33 +1300 Subject: [PATCH] AK: Remove now unused to_{int,uint,float,double} String functions --- AK/ByteString.cpp | 36 ------------------------------------ AK/ByteString.h | 9 --------- AK/DeprecatedFlyString.cpp | 34 ---------------------------------- AK/DeprecatedFlyString.h | 9 --------- AK/StringView.cpp | 33 --------------------------------- AK/StringView.h | 9 --------- 6 files changed, 130 deletions(-) diff --git a/AK/ByteString.cpp b/AK/ByteString.cpp index a121126176..1efd396105 100644 --- a/AK/ByteString.cpp +++ b/AK/ByteString.cpp @@ -158,42 +158,6 @@ ByteBuffer ByteString::to_byte_buffer() const return ByteBuffer::copy(bytes()).release_value_but_fixme_should_propagate_errors(); } -template -Optional ByteString::to_int(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_int(view(), trim_whitespace); -} - -template Optional ByteString::to_int(TrimWhitespace) const; -template Optional ByteString::to_int(TrimWhitespace) const; -template Optional ByteString::to_int(TrimWhitespace) const; -template Optional ByteString::to_int(TrimWhitespace) const; -template Optional ByteString::to_int(TrimWhitespace) const; - -template -Optional ByteString::to_uint(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_uint(view(), trim_whitespace); -} - -template Optional ByteString::to_uint(TrimWhitespace) const; -template Optional ByteString::to_uint(TrimWhitespace) const; -template Optional ByteString::to_uint(TrimWhitespace) const; -template Optional ByteString::to_uint(TrimWhitespace) const; -template Optional ByteString::to_uint(TrimWhitespace) const; - -#ifndef KERNEL -Optional ByteString::to_double(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_floating_point(*this, trim_whitespace); -} - -Optional ByteString::to_float(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_floating_point(*this, trim_whitespace); -} -#endif - bool ByteString::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(*this, str, case_sensitivity); diff --git a/AK/ByteString.h b/AK/ByteString.h index f8967f2aec..024d2f5f05 100644 --- a/AK/ByteString.h +++ b/AK/ByteString.h @@ -110,15 +110,6 @@ public: [[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; [[nodiscard]] bool matches(StringView mask, Vector&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; - template - [[nodiscard]] Optional to_int(TrimWhitespace = TrimWhitespace::Yes) const; - template - [[nodiscard]] Optional to_uint(TrimWhitespace = TrimWhitespace::Yes) const; -#ifndef KERNEL - [[nodiscard]] Optional to_double(TrimWhitespace = TrimWhitespace::Yes) const; - [[nodiscard]] Optional to_float(TrimWhitespace = TrimWhitespace::Yes) const; -#endif - template Optional to_number(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const { diff --git a/AK/DeprecatedFlyString.cpp b/AK/DeprecatedFlyString.cpp index 0ac1f52f97..e5d77f6f1a 100644 --- a/AK/DeprecatedFlyString.cpp +++ b/AK/DeprecatedFlyString.cpp @@ -71,40 +71,6 @@ DeprecatedFlyString::DeprecatedFlyString(StringView string) } } -template -Optional DeprecatedFlyString::to_int(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_int(view(), trim_whitespace); -} - -template Optional DeprecatedFlyString::to_int(TrimWhitespace) const; -template Optional DeprecatedFlyString::to_int(TrimWhitespace) const; -template Optional DeprecatedFlyString::to_int(TrimWhitespace) const; -template Optional DeprecatedFlyString::to_int(TrimWhitespace) const; - -template -Optional DeprecatedFlyString::to_uint(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_uint(view(), trim_whitespace); -} - -template Optional DeprecatedFlyString::to_uint(TrimWhitespace) const; -template Optional DeprecatedFlyString::to_uint(TrimWhitespace) const; -template Optional DeprecatedFlyString::to_uint(TrimWhitespace) const; -template Optional DeprecatedFlyString::to_uint(TrimWhitespace) const; - -#ifndef KERNEL -Optional DeprecatedFlyString::to_double(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_floating_point(view(), trim_whitespace); -} - -Optional DeprecatedFlyString::to_float(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_floating_point(view(), trim_whitespace); -} -#endif - bool DeprecatedFlyString::equals_ignoring_ascii_case(StringView other) const { return StringUtils::equals_ignoring_ascii_case(view(), other); diff --git a/AK/DeprecatedFlyString.h b/AK/DeprecatedFlyString.h index 3a64ab91f3..51aa425c96 100644 --- a/AK/DeprecatedFlyString.h +++ b/AK/DeprecatedFlyString.h @@ -75,15 +75,6 @@ public: return view().to_number(trim_whitespace); } - template - Optional to_int(TrimWhitespace = TrimWhitespace::Yes) const; - template - Optional to_uint(TrimWhitespace = TrimWhitespace::Yes) const; -#ifndef KERNEL - Optional to_double(TrimWhitespace = TrimWhitespace::Yes) const; - Optional to_float(TrimWhitespace = TrimWhitespace::Yes) const; -#endif - bool equals_ignoring_ascii_case(StringView) const; bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; diff --git a/AK/StringView.cpp b/AK/StringView.cpp index f5440c716d..6150943bf9 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -222,40 +222,7 @@ bool StringView::copy_characters_to_buffer(char* buffer, size_t buffer_size) con return characters_to_copy == m_length; } -template -Optional StringView::to_int() const -{ - return StringUtils::convert_to_int(*this); -} - -template Optional StringView::to_int() const; -template Optional StringView::to_int() const; -template Optional StringView::to_int() const; -template Optional StringView::to_int() const; -template Optional StringView::to_int() const; - -template -Optional StringView::to_uint() const -{ - return StringUtils::convert_to_uint(*this); -} - -template Optional StringView::to_uint() const; -template Optional StringView::to_uint() const; -template Optional StringView::to_uint() const; -template Optional StringView::to_uint() const; -template Optional StringView::to_uint() const; - #ifndef KERNEL -Optional StringView::to_double(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_floating_point(*this, trim_whitespace); -} - -Optional StringView::to_float(TrimWhitespace trim_whitespace) const -{ - return StringUtils::convert_to_floating_point(*this, trim_whitespace); -} bool StringView::operator==(ByteString const& string) const { diff --git a/AK/StringView.h b/AK/StringView.h index da8db21e7e..31c5172461 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -219,15 +219,6 @@ public: // following newline.". [[nodiscard]] Vector lines(bool consider_cr = true) const; - template - Optional to_int() const; - template - Optional to_uint() const; -#ifndef KERNEL - Optional to_double(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const; - Optional to_float(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const; -#endif - // Create a new substring view of this string view, starting either at the beginning of // the given substring view, or after its end, and continuing until the end of this string // view (that is, for the remaining part of its length). For example,