@ -295,7 +295,8 @@ class UnicodeText {
/ / the data is tested for interchange - validity . If it is not
/ / the data is tested for interchange - validity . If it is not
/ / interchange - valid , a LOG ( WARNING ) is issued , and each
/ / interchange - valid , a LOG ( WARNING ) is issued , and each
/ / structurally invalid byte and each interchange - invalid codepoint
/ / structurally invalid byte and each interchange - invalid codepoint
/ / is replaced with a space .
/ / is replaced with a space . The ` utf8_was_valid_ ` status is set
/ / appropriately and may be queried afterwards .
/ / x . CopyUTF8 ( buf , len ) copies buf into x .
/ / x . CopyUTF8 ( buf , len ) copies buf into x .
UnicodeText & CopyUTF8 ( const char * utf8_buffer , int byte_length ) ;
UnicodeText & CopyUTF8 ( const char * utf8_buffer , int byte_length ) ;
@ -312,6 +313,9 @@ class UnicodeText {
/ / CopyUTF8 ( utf8_buffer , byte_length ) .
/ / CopyUTF8 ( utf8_buffer , byte_length ) .
UnicodeText & PointToUTF8 ( const char * utf8_buffer , int byte_length ) ;
UnicodeText & PointToUTF8 ( const char * utf8_buffer , int byte_length ) ;
/ / Was this UnicodeText created from valid UTF - 8 ?
bool UTF8WasValid ( ) const { return repr_ . utf8_was_valid_ ; }
/ / Occasionally it is necessary to use functions that operate on the
/ / Occasionally it is necessary to use functions that operate on the
/ / pointer returned by utf8_data ( ) . MakeIterator ( p ) provides a way
/ / pointer returned by utf8_data ( ) . MakeIterator ( p ) provides a way
/ / to get back to the UnicodeText level . It uses CHECK to ensure
/ / to get back to the UnicodeText level . It uses CHECK to ensure
@ -331,8 +335,9 @@ class UnicodeText {
int size_ ;
int size_ ;
int capacity_ ;
int capacity_ ;
bool ours_ ; / / Do we own data_ ?
bool ours_ ; / / Do we own data_ ?
bool utf8_was_valid_ ; / / Were we created from valid UTF - 8 ?
Repr ( ) : data_ ( NULL ) , size_ ( 0 ) , capacity_ ( 0 ) , ours_ ( true ) { }
Repr ( ) : data_ ( NULL ) , size_ ( 0 ) , capacity_ ( 0 ) , ours_ ( true ) , utf8_was_valid_ ( true ) { }
~ Repr ( ) { if ( ours_ ) delete [ ] data_ ; }
~ Repr ( ) { if ( ours_ ) delete [ ] data_ ; }
void clear ( ) ;
void clear ( ) ;