gcn::UTF8StringEditor Class Reference

#include <utf8stringeditor.h>

List of all members.

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:
text UTF-8 text to navigate.
byteOffset Byte offset inside the text.
Returns:
Number of characters.

Definition at line 90 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:
text UTF-8 text to modify.
byteOffset Byte offset of the character to erase.
Returns:
New byte offset (is equal to byteOffset).

Definition at line 57 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:
text UTF-8 text to navigate.
charIndex Character index to move to.
Returns:
Byte offset of character at charIndex.

Definition at line 95 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:
text UTF-8 text to modify.
byteOffset Byte offset where character will be inserted.
ch Unicode character to insert.
Returns:
New byte offset (after the new character).

Definition at line 68 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:
text UTF-8 text to navigate.
byteOffset Byte offset of current character.
Returns:
Byte offset of the next character.

Definition at line 35 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:
text UTF-8 text to navigate.
byteOffset Byte offset of current character.
Returns:
Byte offset of the previous character.

Definition at line 46 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:
Generated on Wed Nov 23 13:05:24 2011 for FIFE by  doxygen 1.6.3