AK: Remove DeprecatedStringCodePointIterator
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

The functionality in this class is no longer used, we can just use
`Utf8View` instead.
This commit is contained in:
Jonne Ransijn 2024-11-14 20:28:30 +01:00 committed by Andreas Kling
parent dc9179bb1b
commit d842d04be4
Notes: github-actions[bot] 2024-11-15 09:47:25 +00:00
4 changed files with 5 additions and 40 deletions

View file

@ -387,9 +387,9 @@ Vector<size_t> ByteString::find_all(StringView needle) const
return StringUtils::find_all(*this, needle); return StringUtils::find_all(*this, needle);
} }
DeprecatedStringCodePointIterator ByteString::code_points() const Utf8CodePointIterator ByteString::code_points() const&
{ {
return DeprecatedStringCodePointIterator(*this); return Utf8CodePointIterator { reinterpret_cast<u8 const*>(characters()), length() };
} }
ErrorOr<ByteString> ByteString::from_utf8(ReadonlyBytes bytes) ErrorOr<ByteString> ByteString::from_utf8(ReadonlyBytes bytes)

View file

@ -141,7 +141,8 @@ public:
[[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); }
[[nodiscard]] DeprecatedStringCodePointIterator code_points() const; [[nodiscard]] Utf8CodePointIterator code_points() const&;
[[nodiscard]] Utf8CodePointIterator code_points() const&& = delete;
[[nodiscard]] ByteString trim(StringView characters, TrimMode mode = TrimMode::Both) const [[nodiscard]] ByteString trim(StringView characters, TrimMode mode = TrimMode::Both) const
{ {

View file

@ -31,7 +31,6 @@ class ConstrainedStream;
class CountingStream; class CountingStream;
class DeprecatedFlyString; class DeprecatedFlyString;
class ByteString; class ByteString;
class DeprecatedStringCodePointIterator;
class Duration; class Duration;
class Error; class Error;
class FlyString; class FlyString;
@ -163,7 +162,6 @@ using AK::CircularQueue;
using AK::ConstrainedStream; using AK::ConstrainedStream;
using AK::CountingStream; using AK::CountingStream;
using AK::DeprecatedFlyString; using AK::DeprecatedFlyString;
using AK::DeprecatedStringCodePointIterator;
using AK::DoublyLinkedList; using AK::DoublyLinkedList;
using AK::Error; using AK::Error;
using AK::ErrorOr; using AK::ErrorOr;

View file

@ -19,6 +19,7 @@ class Utf8View;
class Utf8CodePointIterator { class Utf8CodePointIterator {
friend class Utf8View; friend class Utf8View;
friend class ByteString;
public: public:
Utf8CodePointIterator() = default; Utf8CodePointIterator() = default;
@ -184,40 +185,6 @@ private:
mutable bool m_have_length { false }; mutable bool m_have_length { false };
}; };
class DeprecatedStringCodePointIterator {
public:
Optional<u32> next()
{
if (m_it.done())
return {};
auto value = *m_it;
++m_it;
return value;
}
[[nodiscard]] Optional<u32> peek() const
{
if (m_it.done())
return {};
return *m_it;
}
[[nodiscard]] size_t byte_offset() const
{
return Utf8View(m_string).byte_offset_of(m_it);
}
DeprecatedStringCodePointIterator(ByteString string)
: m_string(move(string))
, m_it(Utf8View(m_string).begin())
{
}
private:
ByteString m_string;
Utf8CodePointIterator m_it;
};
template<> template<>
struct Formatter<Utf8View> : Formatter<StringView> { struct Formatter<Utf8View> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder&, Utf8View const&); ErrorOr<void> format(FormatBuilder&, Utf8View const&);
@ -312,7 +279,6 @@ inline u32 Utf8CodePointIterator::operator*() const
} }
#if USING_AK_GLOBALLY #if USING_AK_GLOBALLY
using AK::DeprecatedStringCodePointIterator;
using AK::Utf8CodePointIterator; using AK::Utf8CodePointIterator;
using AK::Utf8View; using AK::Utf8View;
#endif #endif