tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
17 #ifndef UTIL_UTF8_PUBLIC_UNICODETEXT_H_
18 #define UTIL_UTF8_PUBLIC_UNICODETEXT_H_
145 bool empty()
const {
return repr_.size_ == 0; }
159 template<
typename ForwardIterator>
210 return lhs.it_ == rhs.it_; }
212 return !(lhs == rhs); }
213 friend bool operator<(
const CI& lhs,
const CI& rhs);
217 return !(rhs < lhs); }
219 return !(lhs < rhs); }
255 return (--tmp_it).utf8_data();
259 return (--tmp_it).get_utf8(buf);
263 return (--tmp_it).get_utf8_string();
267 return (--tmp_it).utf8_length();
342 Repr() : data_(nullptr), size_(0), capacity_(0), ours_(true) {}
343 ~Repr() {
if (ours_)
delete[] data_; }
346 void reserve(
int capacity);
347 void resize(
int size);
349 void append(
const char* bytes,
int byte_length);
350 void Copy(
const char* data,
int size);
351 void TakeOwnershipOf(
char* data,
int size,
int capacity);
358 Repr(
const Repr& other);
369 UnicodeText& UnsafeCopyUTF8(
const char* utf8_buffer,
int byte_length);
371 char* utf8_buffer,
int byte_length,
int byte_capacity);
372 UnicodeText& UnsafePointToUTF8(
const char* utf8_buffer,
int byte_length);
373 UnicodeText& UnsafeAppendUTF8(
const char* utf8_buffer,
int byte_length);
381 return !(lhs == rhs);
390 return r.first == r.second;
406 char* utf8_buffer,
int byte_length,
int byte_capacity) {
408 utf8_buffer, byte_length, byte_capacity);
416 const char* utf8_buffer,
int byte_length) {
468 template <
typename T,
size_t N>
470 #define arraysize(array) (sizeof(ArraySizeHelper(array)))
477 #endif // UTIL_UTF8_PUBLIC_UNICODETEXT_H_
friend bool operator<(const CI &lhs, const CI &rhs)
UnicodeText UTF8ToUnicodeText(const char *utf8_buf, int len, bool do_copy)
const_reverse_iterator(const_iterator it)
friend class const_iterator
std::bidirectional_iterator_tag iterator_category
const_reverse_iterator rbegin() const
string CodepointString(const UnicodeText &t)
friend bool operator>(const CI &lhs, const CI &rhs)
const_reverse_iterator rend() const
friend bool operator!=(const CI &lhs, const CI &rhs)
friend bool operator==(const UnicodeText &lhs, const UnicodeText &rhs)
friend class UnicodeTextUtils
ptrdiff_t difference_type
pair< UnicodeText::const_iterator, UnicodeText::const_iterator > UnicodeTextRange
const_iterator & operator=(const const_iterator &other)
static string UTF8Substring(const const_iterator &first, const const_iterator &last)
void push_back(char32 codepoint)
string get_utf8_string() const
bool operator==(const UnicodeText &lhs, const UnicodeText &rhs)
friend difference_type distance(const CI &first, const CI &last)
friend class UTF8StateTableProperty
string DebugString() const
friend class UnicodeTextUtils
const_iterator & operator--()
const_iterator operator++(int)
int get_utf8(char *buf) const
const_iterator MakeIterator(const char *p) const
UnicodeText & TakeOwnershipOfUTF8(char *utf8_buffer, int byte_length, int byte_capacity)
const char * utf8_data() const
UnicodeText & operator=(const UnicodeText &src)
const_iterator find(const UnicodeText &look, const_iterator start_pos) const
const_iterator operator--(int)
friend bool operator==(const CI &lhs, const CI &rhs)
bool UnicodeTextRangeIsEmpty(const UnicodeTextRange &r)
UnicodeText & PointTo(const UnicodeText &src)
const typedef char32 reference
UnicodeText MakeUnicodeTextWithoutAcceptingOwnership(const char *utf8_buffer, int byte_length)
const char * utf8_data() const
const_iterator & operator++()
UnicodeText & PointToUTF8(const char *utf8_buffer, int byte_length)
string DebugString() const
string UnicodeTextToUTF8(const UnicodeText &t)
const_iterator end() const
bool HasReplacementChar() const
friend bool operator<=(const CI &lhs, const CI &rhs)
friend bool operator>=(const CI &lhs, const CI &rhs)
UnicodeText MakeUnicodeTextAcceptingOwnership(char *utf8_buffer, int byte_length, int byte_capacity)
int utf8_capacity() const
UnicodeText & append(ForwardIterator first, const ForwardIterator last)
const char * utf8_data() const
UnicodeText & Copy(const UnicodeText &src)
friend bool operator!=(const UnicodeText &lhs, const UnicodeText &rhs)
UnicodeText & assign(const UnicodeText &src)
char(& ArraySizeHelper(T(&array)[N]))[N]
string get_utf8_string() const
bool operator!=(const UnicodeText &lhs, const UnicodeText &rhs)
UnicodeText & CopyUTF8(const char *utf8_buffer, int byte_length)
int get_utf8(char *buf) const
const_iterator begin() const