FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
gcn::UTF8StringEditor Class Reference

#include <utf8stringeditor.h>

Collaboration diagram for gcn::UTF8StringEditor:
Collaboration graph

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)
 

Detailed Description

UTF-8 string editor.

This is a helper class which allows to use UTF-8 strings in your application.

Author
Przemyslaw Grzywacz

Definition at line 45 of file utf8stringeditor.h.

Member Function Documentation

int gcn::UTF8StringEditor::countChars ( const std::string &  text,
int  byteOffset 
)
static

Counts characters up to byteOffset.

Parameters
textUTF-8 text to navigate.
byteOffsetByte offset inside the text.
Returns
Number of characters.

Definition at line 91 of file utf8stringeditor.cpp.

Referenced by gcn::UTF8TextBox::keyPressed(), and gcn::UTF8TextBox::setCaretRowUTF8().

Here is the caller graph for this function:

int gcn::UTF8StringEditor::eraseChar ( std::string &  text,
int  byteOffset 
)
static

Erase character at specified byte offset.

Parameters
textUTF-8 text to modify.
byteOffsetByte offset of the character to erase.
Returns
New byte offset (is equal to byteOffset).

Definition at line 58 of file utf8stringeditor.cpp.

Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().

Here is the caller graph for this function:

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

Parameters
textUTF-8 text to navigate.
charIndexCharacter index to move to.
Returns
Byte offset of character at charIndex.

Definition at line 96 of file utf8stringeditor.cpp.

Referenced by gcn::UTF8TextBox::keyPressed(), gcn::UTF8TextBox::setCaretColumnUTF8(), and gcn::UTF8TextBox::setCaretRowUTF8().

Here is the caller graph for this function:

int gcn::UTF8StringEditor::insertChar ( std::string &  text,
int  byteOffset,
int  ch 
)
static

Insert a character at specified byte offset.

Parameters
textUTF-8 text to modify.
byteOffsetByte offset where character will be inserted.
chUnicode character to insert.
Returns
New byte offset (after the new character).

Definition at line 69 of file utf8stringeditor.cpp.

Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().

Here is the caller graph for this function:

int gcn::UTF8StringEditor::nextChar ( const std::string &  text,
int  byteOffset 
)
static

Returns byte offset of the next character.

Parameters
textUTF-8 text to navigate.
byteOffsetByte offset of current character.
Returns
Byte offset of the next character.

Definition at line 36 of file utf8stringeditor.cpp.

Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().

Here is the caller graph for this function:

int gcn::UTF8StringEditor::prevChar ( const std::string &  text,
int  byteOffset 
)
static

Returns byte offset of the previous character.

Parameters
textUTF-8 text to navigate.
byteOffsetByte offset of current character.
Returns
Byte offset of the previous character.

Definition at line 47 of file utf8stringeditor.cpp.

Referenced by gcn::UTF8TextField::keyPressed(), and gcn::UTF8TextBox::keyPressed().

Here is the caller graph for this function:


The documentation for this class was generated from the following files: