Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ustl::utf8in_iterator< Iterator, WChar > Class Template Reference
[Iterator Adaptors]

An iterator adaptor to character containers for reading UTF-8 encoded text. More...

#include <ustl.h>

List of all members.

Public Types

typedef iterator_traits< Iterator
>::value_type 
value_type
typedef iterator_traits< Iterator
>::difference_type 
difference_type
typedef iterator_traits< Iterator
>::pointer 
pointer
typedef iterator_traits< Iterator
>::reference 
reference

Public Member Functions

 utf8in_iterator (const Iterator &is)
 utf8in_iterator (const utf8in_iterator &i)
const Iterator & base (void) const
const utf8in_iteratoroperator= (const utf8in_iterator &i)
WChar operator * (void) const
 Steps to the next character and updates current returnable value.
utf8in_iteratoroperator++ (void)
utf8in_iterator operator++ (int)
bool operator== (const utf8in_iterator &i) const
bool operator< (const utf8in_iterator &i) const
utf8in_iteratoroperator+= (size_t n)
difference_type operator- (const utf8in_iterator &i) const
 Returns the distance in characters (as opposed to the distance in bytes).


Detailed Description

template<typename Iterator, typename WChar = wchar_t>
class ustl::utf8in_iterator< Iterator, WChar >

An iterator adaptor to character containers for reading UTF-8 encoded text.

For example, you can copy from ustl::string to ustl::vector<wchar_t> with copy (utf8in (str.begin()), utf8in (str.end()), back_inserter(wvect)); There is no error handling; if the reading frame slips you'll get extra characters, one for every misaligned byte. Although it is possible to skip to the start of the next character, that would result in omitting the misformatted character and the one after it, making it very difficult to detect by the user. It is better to write some strange characters and let the user know his file is corrupted. Another problem is overflow on bad encodings (like a 0xFF on the end of a string). This is checked through the end-of-string nul character, which will always be there as long as you are using the string class.


The documentation for this class was generated from the following file:
Generated on Mon Jan 17 14:35:03 2005 for uSTL by 1.3.9 Doxygen Hosted on SourceForge.net