From bf81e34921e3e30b05313efbcf5c9fa839cb7c05 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sun, 22 Sep 2024 10:19:15 -0500 Subject: Initial commit. --- include/utf8_iterator.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/utf8_iterator.hpp (limited to 'include/utf8_iterator.hpp') diff --git a/include/utf8_iterator.hpp b/include/utf8_iterator.hpp new file mode 100644 index 0000000..1f9674b --- /dev/null +++ b/include/utf8_iterator.hpp @@ -0,0 +1,39 @@ +#ifndef FUD_UTF8_ITERATOR_HPP +#define FUD_UTF8_ITERATOR_HPP + +#include "string.hpp" +#include "utf8.hpp" + +#include +#include + +namespace fud { + +class Utf8Iterator { + private: + size_t m_index{0}; + // NOLINTBEGIN(cppcoreguidelines-avoid-const-or-ref-data-members) + const StringView m_view; + // NOLINTEND(cppcoreguidelines-avoid-const-or-ref-data-members) + + public: + explicit constexpr Utf8Iterator(const String& extString) : m_view{extString} + { + } + + explicit constexpr Utf8Iterator(const StringView& view) : m_view{view} + { + } + + constexpr void reset() + { + m_index = 0; + } + + [[nodiscard]] std::optional peek() const; + std::optional next(); +}; + +} // namespace fud + +#endif -- cgit v1.2.3