#include <utf8stringeditor.h>
Static Public Member Functions | |
static int | nextChar (const std::string &text, int byteOffset) |
static int | prevChar (const std::string &text, int byteOffset) |
static int | eraseChar (std::string &text, int byteOffset) |
static int | insertChar (std::string &text, int byteOffset, int ch) |
static int | countChars (const std::string &text, int byteOffset) |
static int | getOffset (const std::string &text, int charIndex) |
UTF-8 string editor.
This is a helper class which allows to use UTF-8 strings in your application.
Definition at line 45 of file utf8stringeditor.h.
int gcn::UTF8StringEditor::countChars | ( | const std::string & | text, | |
int | byteOffset | |||
) | [static] |
Counts characters up to byteOffset.
text | UTF-8 text to navigate. | |
byteOffset | Byte offset inside the text. |
Definition at line 90 of file utf8stringeditor.cpp.
Referenced by gcn::UTF8TextBox::keyPressed(), and gcn::UTF8TextBox::setCaretRowUTF8().
int gcn::UTF8StringEditor::eraseChar | ( | std::string & | text, | |
int | byteOffset | |||
) | [static] |
Erase character at specified byte offset.
text | UTF-8 text to modify. | |
byteOffset | Byte offset of the character to erase. |
Definition at line 57 of file utf8stringeditor.cpp.
Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().
int gcn::UTF8StringEditor::getOffset | ( | const std::string & | text, | |
int | charIndex | |||
) | [static] |
Gets byte offset for character index.
This method automaticly clips charIndex to be inside the string + EOF
text | UTF-8 text to navigate. | |
charIndex | Character index to move to. |
Definition at line 95 of file utf8stringeditor.cpp.
Referenced by gcn::UTF8TextBox::keyPressed(), gcn::UTF8TextBox::setCaretColumnUTF8(), and gcn::UTF8TextBox::setCaretRowUTF8().
int gcn::UTF8StringEditor::insertChar | ( | std::string & | text, | |
int | byteOffset, | |||
int | ch | |||
) | [static] |
Insert a character at specified byte offset.
text | UTF-8 text to modify. | |
byteOffset | Byte offset where character will be inserted. | |
ch | Unicode character to insert. |
Definition at line 68 of file utf8stringeditor.cpp.
Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().
int gcn::UTF8StringEditor::nextChar | ( | const std::string & | text, | |
int | byteOffset | |||
) | [static] |
Returns byte offset of the next character.
text | UTF-8 text to navigate. | |
byteOffset | Byte offset of current character. |
Definition at line 35 of file utf8stringeditor.cpp.
Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().
int gcn::UTF8StringEditor::prevChar | ( | const std::string & | text, | |
int | byteOffset | |||
) | [static] |
Returns byte offset of the previous character.
text | UTF-8 text to navigate. | |
byteOffset | Byte offset of current character. |
Definition at line 46 of file utf8stringeditor.cpp.
Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().