Lines Matching defs:UnicodeText
32 // ***************************** UnicodeText **************************
34 // A UnicodeText object is a container for a sequence of Unicode
36 // Data can be appended to it from another UnicodeText, from
40 // variable-width format, UnicodeText does not provide random access
43 // The UnicodeText class defines a const_iterator. The dereferencing
56 // 0x10FFFF], but UnicodeText has the additional restriction that it
66 // UnicodeText tests for interchange-validity, and will substitute a
72 // A UnicodeText is either an "owner", meaning that it owns the memory
73 // for the data buffer and will free it when the UnicodeText is
76 // There are three methods for storing UTF-8 data in a UnicodeText:
98 // and the UnicodeText will become an owner. If clear() is called on
102 // That is, after direct initialization ("UnicodeText x(y);") or copy
103 // initialization ("UnicodeText x = y;") x will be an owner, even if y
110 // quite useful to have a UnicodeText "window" through which to see a
121 class UnicodeText {
128 UnicodeText(); // Create an empty text.
129 UnicodeText(const UnicodeText& src); // copy constructor
131 UnicodeText(const const_iterator& first, const const_iterator& last);
135 UnicodeText& operator=(const UnicodeText& src);
138 UnicodeText& Copy(const UnicodeText& src);
139 inline UnicodeText& assign(const UnicodeText& src) { return Copy(src); }
143 UnicodeText& PointTo(const UnicodeText& src);
144 UnicodeText& PointTo(const const_iterator& first,
147 ~UnicodeText();
165 UnicodeText& append(ForwardIterator first, const ForwardIterator last) {
171 UnicodeText& append(const const_iterator& first, const const_iterator& last);
174 UnicodeText& append(const UnicodeText& source);
178 friend bool operator==(const UnicodeText& lhs, const UnicodeText& rhs);
179 friend bool operator!=(const UnicodeText& lhs, const UnicodeText& rhs);
193 // It's safe to make multiple passes over a UnicodeText.
239 friend class UnicodeText;
272 const_iterator find(const UnicodeText& look, const_iterator start_pos) const;
274 const_iterator find(const UnicodeText& look) const;
293 // There are three methods for initializing a UnicodeText from UTF-8
302 UnicodeText& CopyUTF8(const char* utf8_buffer, int byte_length);
306 UnicodeText& TakeOwnershipOfUTF8(char* utf8_buffer,
314 UnicodeText& PointToUTF8(const char* utf8_buffer, int byte_length);
316 // Was this UnicodeText created from valid UTF-8?
321 // to get back to the UnicodeText level. It uses CHECK to ensure
367 UnicodeText& UnsafeCopyUTF8(const char* utf8_buffer, int byte_length);
368 UnicodeText& UnsafeTakeOwnershipOfUTF8(
370 UnicodeText& UnsafePointToUTF8(const char* utf8_buffer, int byte_length);
371 UnicodeText& UnsafeAppendUTF8(const char* utf8_buffer, int byte_length);
372 const_iterator UnsafeFind(const UnicodeText& look,
376 bool operator==(const UnicodeText& lhs, const UnicodeText& rhs);
378 inline bool operator!=(const UnicodeText& lhs, const UnicodeText& rhs) {
384 typedef pair<UnicodeText::const_iterator,
385 UnicodeText::const_iterator> UnicodeTextRange;
394 // A factory function for creating a UnicodeText from a buffer of
395 // UTF-8 data. The new UnicodeText takes ownership of the buffer. (It
403 inline UnicodeText MakeUnicodeTextAcceptingOwnership(
405 return UnicodeText().TakeOwnershipOfUTF8(
409 // A factory function for creating a UnicodeText from a buffer of
410 // UTF-8 data. The new UnicodeText does not take ownership of the
413 inline UnicodeText MakeUnicodeTextWithoutAcceptingOwnership(
415 return UnicodeText().PointToUTF8(utf8_buffer, byte_length);
418 // Create a UnicodeText from a UTF-8 string or buffer.
421 // owned by the resulting UnicodeText object and will be freed when
422 // the object is destroyed. This UnicodeText object is referred to
426 // UnicodeText object does NOT take ownership of the string; in this
427 // case, the lifetime of the UnicodeText object must not exceed the
435 inline UnicodeText UTF8ToUnicodeText(const char* utf8_buf, int len,
437 UnicodeText t;
446 inline UnicodeText UTF8ToUnicodeText(const string& utf_string, bool do_copy) {
450 inline UnicodeText UTF8ToUnicodeText(const char* utf8_buf, int len) {
453 inline UnicodeText UTF8ToUnicodeText(const string& utf8_string) {
459 inline string UnicodeTextToUTF8(const UnicodeText& t) {