summaryrefslogtreecommitdiff
path: root/src/string_utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-08-12 22:42:43 +1000
committerMaxime Coste <mawww@kakoune.org>2024-08-14 22:04:52 +1000
commitb804693630f61be757413e6e5a700995be1b164b (patch)
treed83d92d767b6cb850d67e7bfd7565f2d22f39039 /src/string_utils.hh
parent449adb14a56f24fcfd9c836bcf69e1c4661fae89 (diff)
Remove unused wrap_to and reduce string_utils headers
Diffstat (limited to 'src/string_utils.hh')
-rw-r--r--src/string_utils.hh40
1 files changed, 1 insertions, 39 deletions
diff --git a/src/string_utils.hh b/src/string_utils.hh
index 24da0111..7c115269 100644
--- a/src/string_utils.hh
+++ b/src/string_utils.hh
@@ -7,7 +7,7 @@
#include "optional.hh"
#include "utils.hh"
#include "format.hh"
-#include "ranges.hh"
+#include "constexpr_utils.hh"
namespace Kakoune
{
@@ -67,44 +67,6 @@ bool subsequence_match(StringView str, StringView subseq);
String expand_tabs(StringView line, ColumnCount tabstop, ColumnCount col = 0);
-struct WrapView
-{
- struct Iterator
- {
- using difference_type = ptrdiff_t;
- using value_type = StringView;
- using pointer = StringView*;
- using reference = StringView&;
- using iterator_category = std::forward_iterator_tag;
-
- Iterator(StringView text, ColumnCount max_width);
-
- Iterator& operator++();
- Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }
-
- bool operator==(Iterator other) const { return m_remaining == other.m_remaining and m_current == other.m_current; }
- StringView operator*() { return m_current; }
-
- private:
- StringView m_current;
- StringView m_remaining;
- ColumnCount m_max_width;
- };
-
- Iterator begin() const { return {text, max_width}; }
- Iterator end() const { return {{}, 1}; }
-
- StringView text;
- ColumnCount max_width;
-};
-
-inline auto wrap_at(ColumnCount max_width)
-{
- return ViewFactory{[=](StringView text) {
- return WrapView{text, max_width};
- }};
-}
-
int str_to_int(StringView str); // throws on error
Optional<int> str_to_int_ifp(StringView str);