Commit a0623d95 authored by Dick Hollenbeck's avatar Dick Hollenbeck

UTF8::uni_iter made leaner.

parent 391ff669
...@@ -59,11 +59,11 @@ public: ...@@ -59,11 +59,11 @@ public:
return wxString( c_str(), wxConvUTF8 ); return wxString( c_str(), wxConvUTF8 );
} }
static int uni_forward( const_iterator it, uint32_t* result ) static int uni_forward( unsigned char* it, uint32_t* result )
{ {
// @todo: have this read UTF8 characters into result, not bytes. // @todo: have this read UTF8 characters into result, not bytes.
// What's here now is scaffolding, reading single byte characters only. // What's here now is scaffolding, reading single byte characters only.
*result = (unsigned char) *it; *result = *it;
return 1; return 1;
} }
...@@ -74,13 +74,13 @@ public: ...@@ -74,13 +74,13 @@ public:
* they return a uint32_t holding the unicode character appropriate for respective * they return a uint32_t holding the unicode character appropriate for respective
* operation. * operation.
*/ */
class uni_iter : public std::string::const_iterator class uni_iter
{ {
const_iterator it; unsigned char* it;
public: public:
uni_iter( const_iterator start ) : uni_iter( const char* start ) :
it( start ) it( (unsigned char*) start )
{ {
} }
...@@ -138,12 +138,12 @@ public: ...@@ -138,12 +138,12 @@ public:
uni_iter ubegin() const uni_iter ubegin() const
{ {
return uni_iter( begin() ); return uni_iter( data() );
} }
uni_iter uend() const uni_iter uend() const
{ {
return uni_iter( end() ); return uni_iter( data() + size() );
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment