|
a/src/utils/utf8iter.h |
|
b/src/utils/utf8iter.h |
1 |
#ifndef _UTF8ITER_H_INCLUDED_
|
1 |
#ifndef _UTF8ITER_H_INCLUDED_
|
2 |
#define _UTF8ITER_H_INCLUDED_
|
2 |
#define _UTF8ITER_H_INCLUDED_
|
3 |
/* @(#$Id: utf8iter.h,v 1.2 2005-02-11 11:20:02 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: utf8iter.h,v 1.3 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes */
|
4 |
|
4 |
|
5 |
/**
|
5 |
/**
|
6 |
* A small helper class to iterate over utf8 strings. This is not an
|
6 |
* A small helper class to iterate over utf8 strings. This is not an
|
7 |
* STL iterator and this is not well designed, just convenient for
|
7 |
* STL iterator and this is not well designed, just convenient for
|
8 |
some specific uses
|
8 |
some specific uses
|
|
... |
|
... |
115 |
return getvalueat(mypos, get_cl(mypos));
|
115 |
return getvalueat(mypos, get_cl(mypos));
|
116 |
}
|
116 |
}
|
117 |
return (unsigned int)-1;
|
117 |
return (unsigned int)-1;
|
118 |
}
|
118 |
}
|
119 |
|
119 |
|
|
|
120 |
/** Set current position before next utf-8 character */
|
120 |
string::size_type operator++(int) {
|
121 |
string::size_type operator++(int) {
|
121 |
if (bad || (!cl && compute_cl() < 0)) {
|
122 |
if (bad || (!cl && compute_cl() < 0)) {
|
122 |
return string::npos;
|
123 |
return pos = string::npos;
|
123 |
}
|
124 |
}
|
124 |
pos += cl;
|
125 |
pos += cl;
|
125 |
m_charpos++;
|
126 |
m_charpos++;
|
126 |
cl = 0;
|
127 |
cl = 0;
|
127 |
return pos;
|
128 |
return pos;
|