UTF8Iterator Class Reference

#include <utf8_iterator.hpp>

List of all members.

Public Member Functions

 UTF8Iterator (const std::string &text_)
bool done () const
UTF8Iteratoroperator++ ()
uint32_t operator * () const

Public Attributes

const std::string & text
std::string::size_type pos
uint32_t chr


Detailed Description

Definition at line 24 of file utf8_iterator.hpp.


Constructor & Destructor Documentation

UTF8Iterator::UTF8Iterator ( const std::string &  text_  ) 

Definition at line 90 of file utf8_iterator.cpp.

References chr, decode_utf8(), log_debug, pos, and text.

00090                                                  :
00091   text(text_),
00092   pos(0),
00093   chr()
00094 {
00095   try {
00096     chr = decode_utf8(text, pos);
00097   } catch (std::exception) {
00098     log_debug << "Malformed utf-8 sequence beginning with " << *((uint32_t*)(text.c_str() + pos)) << " found " << std::endl;
00099     chr = 0;
00100   }
00101 }


Member Function Documentation

bool UTF8Iterator::done (  )  const

Definition at line 104 of file utf8_iterator.cpp.

References pos, and text.

00105   {
00106     return pos > text.size();
00107   }

UTF8Iterator & UTF8Iterator::operator++ (  ) 

Definition at line 110 of file utf8_iterator.cpp.

References chr, decode_utf8(), log_debug, pos, and text.

00110                          {
00111     try {
00112       chr = decode_utf8(text, pos);
00113     } catch (std::exception) {
00114       log_debug << "Malformed utf-8 sequence beginning with " << *((uint32_t*)(text.c_str() + pos)) << " found " << std::endl;
00115       chr = 0;
00116       ++pos;
00117     }
00118 
00119     return *this;
00120   }

uint32_t UTF8Iterator::operator * (  )  const

Definition at line 123 of file utf8_iterator.cpp.

References chr.

00123                                 {
00124     return chr;
00125   }


Member Data Documentation

const std::string& UTF8Iterator::text

Definition at line 27 of file utf8_iterator.hpp.

Referenced by done(), operator++(), and UTF8Iterator().

std::string::size_type UTF8Iterator::pos

Definition at line 28 of file utf8_iterator.hpp.

Referenced by done(), operator++(), and UTF8Iterator().

uint32_t UTF8Iterator::chr

Definition at line 29 of file utf8_iterator.hpp.

Referenced by operator *(), operator++(), and UTF8Iterator().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:38 2014 for SuperTux by  doxygen 1.5.1