KiCad PCB EDA Suite
UTF8::uni_iter Class Reference

class uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string. More...

#include <utf8.h>

Public Member Functions

 uni_iter ()
 
 uni_iter (const uni_iter &o)
 
const uni_iteroperator++ ()
 pre-increment and return uni_iter at new position More...
 
uni_iter operator++ (int)
 post-increment and return uni_iter at initial position More...
 
unsigned operator-> () const
 return unicode at current position More...
 
unsigned operator* () const
 return unicode at current position More...
 
uni_iter operator- (int aVal) const
 
bool operator== (const uni_iter &other) const
 
bool operator!= (const uni_iter &other) const
 
bool operator< (const uni_iter &other) const
 Since the ++ operators advance more than one byte, this is your best loop termination test, < end(), not == end(). More...
 
bool operator<= (const uni_iter &other) const
 
bool operator> (const uni_iter &other) const
 
bool operator>= (const uni_iter &other) const
 

Private Member Functions

 uni_iter (const char *start)
 

Private Attributes

const unsigned char * it
 

Friends

class UTF8
 

Detailed Description

class uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string.

The normal ++(), ++(int), ->(), and *() operators are all supported for read only access and some return an unsigned holding the unicode character appropriate for the respective operator.

Definition at line 200 of file utf8.h.

Constructor & Destructor Documentation

UTF8::uni_iter::uni_iter ( const char *  start)
inlineprivate

Definition at line 207 of file utf8.h.

207  :
208  it( (const unsigned char*) start )
209  {
210  }
const unsigned char * it
Definition: utf8.h:204
UTF8::uni_iter::uni_iter ( )
inline

Definition at line 215 of file utf8.h.

Referenced by operator-().

216  {
217  it = NULL;
218  }
const unsigned char * it
Definition: utf8.h:204
UTF8::uni_iter::uni_iter ( const uni_iter o)
inline

Definition at line 220 of file utf8.h.

References it.

221  {
222  it = o.it;
223  }
const unsigned char * it
Definition: utf8.h:204

Member Function Documentation

bool UTF8::uni_iter::operator!= ( const uni_iter other) const
inline

Definition at line 264 of file utf8.h.

References it.

264 { return it != other.it; }
const unsigned char * it
Definition: utf8.h:204
unsigned UTF8::uni_iter::operator* ( ) const
inline

return unicode at current position

Definition at line 252 of file utf8.h.

References UTF8::uni_forward().

253  {
254  unsigned result;
255 
256  // grab the result, do not advance
257  uni_forward( it, &result );
258  return result;
259  }
static int uni_forward(const unsigned char *aSequence, unsigned *aResult=NULL)
Function uni_forward advances over a single UTF8 encoded multibyte character, capturing the unicode c...
Definition: utf8.cpp:70
const unsigned char * it
Definition: utf8.h:204
const uni_iter& UTF8::uni_iter::operator++ ( )
inline

pre-increment and return uni_iter at new position

Definition at line 226 of file utf8.h.

References UTF8::uni_forward().

227  {
228  it += uni_forward( it );
229  return *this;
230  }
static int uni_forward(const unsigned char *aSequence, unsigned *aResult=NULL)
Function uni_forward advances over a single UTF8 encoded multibyte character, capturing the unicode c...
Definition: utf8.cpp:70
const unsigned char * it
Definition: utf8.h:204
uni_iter UTF8::uni_iter::operator++ ( int  )
inline

post-increment and return uni_iter at initial position

Definition at line 233 of file utf8.h.

References UTF8::uni_forward().

234  {
235  uni_iter ret = *this;
236 
237  it += uni_forward( it );
238  return ret;
239  }
static int uni_forward(const unsigned char *aSequence, unsigned *aResult=NULL)
Function uni_forward advances over a single UTF8 encoded multibyte character, capturing the unicode c...
Definition: utf8.cpp:70
const unsigned char * it
Definition: utf8.h:204
uni_iter UTF8::uni_iter::operator- ( int  aVal) const
inline

Definition at line 261 of file utf8.h.

References uni_iter().

261 { return uni_iter( (char*) it - aVal ); }
const unsigned char * it
Definition: utf8.h:204
unsigned UTF8::uni_iter::operator-> ( ) const
inline

return unicode at current position

Definition at line 242 of file utf8.h.

References UTF8::uni_forward().

243  {
244  unsigned result;
245 
246  // grab the result, do not advance
247  uni_forward( it, &result );
248  return result;
249  }
static int uni_forward(const unsigned char *aSequence, unsigned *aResult=NULL)
Function uni_forward advances over a single UTF8 encoded multibyte character, capturing the unicode c...
Definition: utf8.cpp:70
const unsigned char * it
Definition: utf8.h:204
bool UTF8::uni_iter::operator< ( const uni_iter other) const
inline

Since the ++ operators advance more than one byte, this is your best loop termination test, < end(), not == end().

Definition at line 268 of file utf8.h.

References it.

268 { return it < other.it; }
const unsigned char * it
Definition: utf8.h:204
bool UTF8::uni_iter::operator<= ( const uni_iter other) const
inline

Definition at line 269 of file utf8.h.

References it.

269 { return it <= other.it; }
const unsigned char * it
Definition: utf8.h:204
bool UTF8::uni_iter::operator== ( const uni_iter other) const
inline

Definition at line 263 of file utf8.h.

References it.

263 { return it == other.it; }
const unsigned char * it
Definition: utf8.h:204
bool UTF8::uni_iter::operator> ( const uni_iter other) const
inline

Definition at line 270 of file utf8.h.

References it.

270 { return it > other.it; }
const unsigned char * it
Definition: utf8.h:204
bool UTF8::uni_iter::operator>= ( const uni_iter other) const
inline

Definition at line 271 of file utf8.h.

References it.

271 { return it >= other.it; }
const unsigned char * it
Definition: utf8.h:204

Friends And Related Function Documentation

friend class UTF8
friend

Definition at line 202 of file utf8.h.

Member Data Documentation

const unsigned char* UTF8::uni_iter::it
private

Definition at line 204 of file utf8.h.

Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and uni_iter().


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