fe::UTF32Iterator< EncTraits, Forward > Class Template Reference
[Ferry Core library]

Iterates over UTF-encoded code unit sequence and reads UTF32-encoded characters from it. More...

List of all members.

Public Types

enum  { EndOfInput = utf32_char_type(-1) }
enum  { MaxCodeUnits = EncTraits::utf32_max_code_units }
typedef EncTraits::code_unit_type code_unit_type

Public Member Functions

const code_unit_typebegin () const
unsigned codeUnitIdx () const
const code_unit_typecursor () const
const code_unit_typeend () const
utf32_char_type next ()
void rewind ()
 UTF32Iterator (const code_unit_type *str, unsigned len)

Static Public Member Functions

static unsigned codeUnitSize (utf32_char_type chr)


Detailed Description

template<class EncTraits, bool Forward>
class fe::UTF32Iterator< EncTraits, Forward >

Iterates over UTF-encoded code unit sequence and reads UTF32-encoded characters from it.

EncTraits - encoding traits;
Forward - iteration direction.

See also:
fe::enc_traits_utf8

fe::enc_traits_utf16

http://en.wikipedia.org/wiki/UTF-32/UCS-4

http://en.wikipedia.org/wiki/Unicode


Member Typedef Documentation

template<class EncTraits , bool Forward>
typedef EncTraits::code_unit_type fe::UTF32Iterator< EncTraits, Forward >::code_unit_type


Member Enumeration Documentation

template<class EncTraits , bool Forward>
anonymous enum

Enumerator:
EndOfInput  End of input indicator.

template<class EncTraits , bool Forward>
anonymous enum

Enumerator:
MaxCodeUnits  Maximum number of code units needed to represent any valid UTF32-encoded character.


Constructor & Destructor Documentation

template<class EncTraits , bool Forward>
fe::UTF32Iterator< EncTraits, Forward >::UTF32Iterator ( const code_unit_type str,
unsigned  len 
) [inline]

Initializes the UTF32Iterator with the input code unit sequence. If Forward template parameter is true reads code units from the [str, str + len) region, otherwise from the (str, str - len] region.

Parameters:
str pointer to the first input code unit;
len number of available code units in the input sequence.


Member Function Documentation

template<class EncTraits , bool Forward>
void fe::UTF32Iterator< EncTraits, Forward >::rewind (  )  [inline]

Moves cursor to the beginning of the code unit sequence. After this call cursor() returns the same value begin() returns.

See also:
cursor()

template<class EncTraits , bool Forward>
const code_unit_type* fe::UTF32Iterator< EncTraits, Forward >::begin (  )  const [inline]

If Forward template parameter is true returns pointer to the first code unit of the input code unit sequence. Otherwise returns pointer addressing the code unit after the first code unit of the input code unit sequence. The returned value is equal to str parameter of the ctor.

template<class EncTraits , bool Forward>
const code_unit_type* fe::UTF32Iterator< EncTraits, Forward >::end (  )  const [inline]

If Forward template parameter is true returns pointer addressing the code unit after the last code unit of the input sequence. Otherwise returns pointer addressing the last code unit of the input sequence.

template<class EncTraits , bool Forward>
const code_unit_type* fe::UTF32Iterator< EncTraits, Forward >::cursor (  )  const [inline]

Returns cursor. Cursor is a pointer to a code unit in the input sequence starting from which next() extracts the next UTF32 character.

See also:
next()

rewind()

template<class EncTraits , bool Forward>
utf32_char_type fe::UTF32Iterator< EncTraits, Forward >::next (  )  [inline]

Returns the next UTF32 character extracted from the input code unit sequence. Decoding begins with a code unit in the sequence pointed by cursor(). Returns either EndOfInput or a legal UTF32 character even if the input code unit sequence encodes illegal UTF32 character or is malformed itself. EndOfInput return value indicates that there are no more code units to read, i.e. cursor() is equal to end(). If method returns value other then EndOfInput cursor is moved to a new position.

See also:
Fe_IsLegalUTF32()

template<class EncTraits , bool Forward>
unsigned fe::UTF32Iterator< EncTraits, Forward >::codeUnitIdx (  )  const [inline]

Returns index of the code unit addressed by cursor() in the input code unit sequence.

template<class EncTraits , bool Forward>
static unsigned fe::UTF32Iterator< EncTraits, Forward >::codeUnitSize ( utf32_char_type  chr  )  [inline, static]

Returns number of code units needed to represent the given legal UTF32-encoded character. Return value is always less or equal to MaxCodeUnits.

Parameters:
chr legal UTF32-encoded character to measure.
See also:
Fe_IsLegalUTF32()


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

Generated on Tue Nov 18 21:08:23 2008 for Ferry by doxygen 1.5.7.1
http://sourceforge.net