summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-06-24 19:10:57 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-06-24 19:10:57 +0100
commit5b27b956adaec761bff0700c38387a1dfbb77efc (patch)
tree05e1027ec4e77103a31b78dcba89dd88f5ff569f /src
parentb934c8ede532284e5c961e10f1d7591d4e4de1a7 (diff)
Rename utf8::utf8_iterator to utf8::iterator
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc1
-rw-r--r--src/keys.cc2
-rw-r--r--src/ncurses.cc4
-rw-r--r--src/normal.cc1
-rw-r--r--src/selectors.hh2
-rw-r--r--src/string.cc2
-rw-r--r--src/utf8_iterator.hh46
-rw-r--r--src/word_db.cc3
8 files changed, 29 insertions, 32 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 9b19e053..5d66622c 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -22,7 +22,6 @@
#include "shell_manager.hh"
#include "string.hh"
#include "user_interface.hh"
-#include "utf8_iterator.hh"
#include "window.hh"
#include <sys/types.h>
diff --git a/src/keys.cc b/src/keys.cc
index a899fb99..5dc5a1b9 100644
--- a/src/keys.cc
+++ b/src/keys.cc
@@ -42,7 +42,7 @@ KeyList parse_keys(StringView str)
{
KeyList result;
using PassPolicy = utf8::InvalidBytePolicy::Pass;
- using Utf8It = utf8::utf8_iterator<const char*, PassPolicy>;
+ using Utf8It = utf8::iterator<const char*, PassPolicy>;
for (Utf8It it = str.begin(), str_end = str.end(); it < str_end; ++it)
{
if (*it == '<')
diff --git a/src/ncurses.cc b/src/ncurses.cc
index 539e8fca..0b571fd3 100644
--- a/src/ncurses.cc
+++ b/src/ncurses.cc
@@ -208,7 +208,7 @@ void NCursesUI::refresh()
}
using Utf8Policy = utf8::InvalidBytePolicy::Pass;
-using Utf8Iterator = utf8::utf8_iterator<const char*, Utf8Policy>;
+using Utf8Iterator = utf8::iterator<const char*, Utf8Policy>;
void addutf8str(WINDOW* win, Utf8Iterator begin, Utf8Iterator end)
{
waddstr(win, StringView(begin.base(), end.base()).zstr());
@@ -622,7 +622,7 @@ static std::vector<String> wrap_lines(StringView text, CharCount max_width)
: is_eol(c) ? Eol : Word;
};
- using Utf8It = utf8::utf8_iterator<const char*>;
+ using Utf8It = utf8::iterator<const char*>;
Utf8It word_begin{text.begin()};
Utf8It word_end{word_begin};
Utf8It end{text.end()};
diff --git a/src/normal.cc b/src/normal.cc
index b04fc513..1c3c48b9 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -15,7 +15,6 @@
#include "string.hh"
#include "window.hh"
#include "user_interface.hh"
-#include "utf8_iterator.hh"
#include "debug.hh"
namespace Kakoune
diff --git a/src/selectors.hh b/src/selectors.hh
index d9e5f770..5471a5c9 100644
--- a/src/selectors.hh
+++ b/src/selectors.hh
@@ -50,7 +50,7 @@ inline void remove_selection(SelectionList& selections, int index)
selections.check_invariant();
}
-using Utf8Iterator = utf8::utf8_iterator<BufferIterator, utf8::InvalidBytePolicy::Pass>;
+using Utf8Iterator = utf8::iterator<BufferIterator, utf8::InvalidBytePolicy::Pass>;
inline Selection utf8_range(const Utf8Iterator& first, const Utf8Iterator& last)
{
diff --git a/src/string.cc b/src/string.cc
index 91a31802..24db4579 100644
--- a/src/string.cc
+++ b/src/string.cc
@@ -115,7 +115,7 @@ bool subsequence_match(StringView str, StringView subseq)
String expand_tabs(StringView line, CharCount tabstop, CharCount col)
{
String res;
- using Utf8It = utf8::utf8_iterator<const char*>;
+ using Utf8It = utf8::iterator<const char*>;
for (Utf8It it = line.begin(); it.base() < line.end(); ++it)
{
if (*it == '\t')
diff --git a/src/utf8_iterator.hh b/src/utf8_iterator.hh
index cc1d3b47..c7ea102f 100644
--- a/src/utf8_iterator.hh
+++ b/src/utf8_iterator.hh
@@ -13,92 +13,92 @@ namespace utf8
// on unicode codepoints instead.
template<typename Iterator,
typename InvalidPolicy = InvalidBytePolicy::Assert>
-class utf8_iterator
+class iterator
{
public:
- utf8_iterator() = default;
- utf8_iterator(Iterator it) : m_it(std::move(it)) {}
+ iterator() = default;
+ iterator(Iterator it) : m_it(std::move(it)) {}
- utf8_iterator& operator++()
+ iterator& operator++()
{
m_it = utf8::next(m_it);
invalidate_value();
return *this;
}
- utf8_iterator operator++(int)
+ iterator operator++(int)
{
- utf8_iterator save = *this;
+ iterator save = *this;
++*this;
return save;
}
- void advance(CharCount count, const utf8_iterator& end)
+ void advance(CharCount count, const iterator& end)
{
while (*this != end and count-- > 0)
++*this;
}
- utf8_iterator& operator--()
+ iterator& operator--()
{
m_it = utf8::previous(m_it);
invalidate_value();
return *this;
}
- utf8_iterator operator--(int)
+ iterator operator--(int)
{
- utf8_iterator save = *this;
+ iterator save = *this;
--*this;
return save;
}
- utf8_iterator operator+(CharCount count) const
+ iterator operator+(CharCount count) const
{
if (count < 0)
return operator-(-count);
- utf8_iterator res = *this;
+ iterator res = *this;
while (count--)
++res;
return res;
}
- utf8_iterator operator-(CharCount count) const
+ iterator operator-(CharCount count) const
{
if (count < 0)
return operator+(-count);
- utf8_iterator res = *this;
+ iterator res = *this;
while (count--)
--res;
return res;
}
- bool operator==(const utf8_iterator& other) { return m_it == other.m_it; }
- bool operator!=(const utf8_iterator& other) { return m_it != other.m_it; }
+ bool operator==(const iterator& other) { return m_it == other.m_it; }
+ bool operator!=(const iterator& other) { return m_it != other.m_it; }
- bool operator< (const utf8_iterator& other) const
+ bool operator< (const iterator& other) const
{
return m_it < other.m_it;
}
- bool operator<= (const utf8_iterator& other) const
+ bool operator<= (const iterator& other) const
{
return m_it <= other.m_it;
}
- bool operator> (const utf8_iterator& other) const
+ bool operator> (const iterator& other) const
{
return m_it > other.m_it;
}
- bool operator>= (const utf8_iterator& other) const
+ bool operator>= (const iterator& other) const
{
return m_it >= other.m_it;
}
- CharCount operator-(utf8_iterator other) const
+ CharCount operator-(iterator other) const
{
//kak_assert(other < *this);
check_invariant();
@@ -141,9 +141,9 @@ private:
};
template<typename InvalidPolicy = InvalidBytePolicy::Assert, typename Iterator>
-utf8_iterator<Iterator, InvalidPolicy> make_iterator(Iterator it)
+iterator<Iterator, InvalidPolicy> make_iterator(Iterator it)
{
- return utf8_iterator<Iterator, InvalidPolicy>{std::move(it)};
+ return iterator<Iterator, InvalidPolicy>{std::move(it)};
}
}
diff --git a/src/word_db.cc b/src/word_db.cc
index 1ece5651..b120cb66 100644
--- a/src/word_db.cc
+++ b/src/word_db.cc
@@ -10,8 +10,7 @@ namespace Kakoune
static std::vector<String> get_words(StringView content)
{
std::vector<String> res;
- using Iterator = utf8::utf8_iterator<const char*,
- utf8::InvalidBytePolicy::Pass>;
+ using Iterator = utf8::iterator<const char*, utf8::InvalidBytePolicy::Pass>;
const char* word_start = content.begin();
bool in_word = false;
for (Iterator it{word_start}, end{content.end()}; it != end; ++it)