(svn r25653) -Add: Caret movement by words for CJK languages.

This commit is contained in:
michi_cc
2013-08-05 20:35:31 +00:00
parent e7dc14b25a
commit 76367f6bf1
5 changed files with 220 additions and 123 deletions

View File

@@ -15,6 +15,12 @@
/** Class for iterating over different kind of parts of a string. */
class StringIterator {
public:
/** Type of the iterator. */
enum IterType {
ITER_CHARACTER, ///< Iterate over characters (or more exactly grapheme clusters).
ITER_WORD, ///< Iterate over words.
};
/** Sentinel to indicate end-of-iteration. */
static const size_t END = SIZE_MAX;
@@ -45,13 +51,13 @@ public:
* Advance the cursor by one iteration unit.
* @return New cursor position (in bytes) or #END if the cursor is already at the end of the string.
*/
virtual size_t Next() = 0;
virtual size_t Next(IterType what = ITER_CHARACTER) = 0;
/**
* Move the cursor back by one iteration unit.
* @return New cursor position (in bytes) or #END if the cursor is already at the start of the string.
*/
virtual size_t Prev() = 0;
virtual size_t Prev(IterType what = ITER_CHARACTER) = 0;
protected:
StringIterator() {}