|
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.3 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes */
|
3 |
/* @(#$Id: utf8iter.h,v 1.4 2005-12-07 15:41:50 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
|
|
... |
|
... |
135 |
out += s.substr(pos, cl);
|
135 |
out += s.substr(pos, cl);
|
136 |
return true;
|
136 |
return true;
|
137 |
}
|
137 |
}
|
138 |
operator string() {
|
138 |
operator string() {
|
139 |
if (bad || (!cl && compute_cl() < 0)) {
|
139 |
if (bad || (!cl && compute_cl() < 0)) {
|
140 |
return false;
|
140 |
return std::string("");
|
141 |
}
|
141 |
}
|
142 |
return s.substr(pos, cl);
|
142 |
return s.substr(pos, cl);
|
143 |
}
|
143 |
}
|
144 |
bool eof() {
|
144 |
bool eof() {
|
145 |
return bad || pos == s.length();
|
145 |
return bad || pos == s.length();
|