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 207 of file utf8.h.

Constructor & Destructor Documentation

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

Definition at line 214 of file utf8.h.

214  :
215  it( (const unsigned char*) start )
216  {
217  }
const unsigned char * it
Definition: utf8.h:211
UTF8::uni_iter::uni_iter ( )
inline

Definition at line 222 of file utf8.h.

Referenced by operator-(), UTF8::ubegin(), and UTF8::uend().

223  {
224  it = NULL;
225  }
const unsigned char * it
Definition: utf8.h:211
UTF8::uni_iter::uni_iter ( const uni_iter o)
inline

Definition at line 227 of file utf8.h.

References it.

228  {
229  it = o.it;
230  }
const unsigned char * it
Definition: utf8.h:211

Member Function Documentation

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:211
unsigned UTF8::uni_iter::operator* ( ) const
inline

return unicode at current position

Definition at line 259 of file utf8.h.

References UTF8::uni_forward().

260  {
261  unsigned result;
262 
263  // grab the result, do not advance
264  uni_forward( it, &result );
265  return result;
266  }
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:211
const uni_iter& UTF8::uni_iter::operator++ ( )
inline

pre-increment and return uni_iter at new position

Definition at line 233 of file utf8.h.

References UTF8::uni_forward().

234  {
235  it += uni_forward( it );
236  return *this;
237  }
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:211
uni_iter UTF8::uni_iter::operator++ ( int  )
inline

post-increment and return uni_iter at initial position

Definition at line 240 of file utf8.h.

References UTF8::uni_forward().

241  {
242  uni_iter ret = *this;
243 
244  it += uni_forward( it );
245  return ret;
246  }
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:211
uni_iter UTF8::uni_iter::operator- ( int  aVal) const
inline

Definition at line 268 of file utf8.h.

References uni_iter().

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

return unicode at current position

Definition at line 249 of file utf8.h.

References UTF8::uni_forward().

250  {
251  unsigned result;
252 
253  // grab the result, do not advance
254  uni_forward( it, &result );
255  return result;
256  }
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:211
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 275 of file utf8.h.

References it.

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

Definition at line 276 of file utf8.h.

References it.

276 { return it <= other.it; }
const unsigned char * it
Definition: utf8.h:211
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:211
bool UTF8::uni_iter::operator> ( const uni_iter other) const
inline

Definition at line 277 of file utf8.h.

References it.

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

Definition at line 278 of file utf8.h.

References it.

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

Friends And Related Function Documentation

friend class UTF8
friend

Definition at line 209 of file utf8.h.

Member Data Documentation

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

Definition at line 211 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: