TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
utf8::unchecked Namespace Reference

Classes

class  iterator
 

Functions

template<typename octet_iterator >
octet_iterator append (uint32_t cp, octet_iterator result)
 
template<typename octet_iterator >
uint32_t next (octet_iterator &it)
 
template<typename octet_iterator >
uint32_t peek_next (octet_iterator it)
 
template<typename octet_iterator >
uint32_t prior (octet_iterator &it)
 
template<typename octet_iterator >
uint32_t previous (octet_iterator &it)
 
template<typename octet_iterator , typename distance_type >
void advance (octet_iterator &it, distance_type n)
 
template<typename octet_iterator >
std::iterator_traits
< octet_iterator >
::difference_type 
distance (octet_iterator first, octet_iterator last)
 
template<typename u16bit_iterator , typename octet_iterator >
octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
 
template<typename u16bit_iterator , typename octet_iterator >
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
 
template<typename octet_iterator , typename u32bit_iterator >
octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
 
template<typename octet_iterator , typename u32bit_iterator >
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
 

Function Documentation

template<typename octet_iterator , typename distance_type >
void utf8::unchecked::advance ( octet_iterator &  it,
distance_type  n 
)
114  {
115  for (distance_type i = 0; i < n; ++i)
117  }
uint32_t next(octet_iterator &it)
Definition: unchecked.h:61

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename octet_iterator >
octet_iterator utf8::unchecked::append ( uint32_t  cp,
octet_iterator  result 
)
39  {
40  if (cp < 0x80) // one octet
41  *(result++) = static_cast<uint8_t>(cp);
42  else if (cp < 0x800) { // two octets
43  *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
44  *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
45  }
46  else if (cp < 0x10000) { // three octets
47  *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
48  *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
49  *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
50  }
51  else { // four octets
52  *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
53  *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f)| 0x80);
54  *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
55  *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
56  }
57  return result;
58  }

+ Here is the caller graph for this function:

template<typename octet_iterator >
std::iterator_traits<octet_iterator>::difference_type utf8::unchecked::distance ( octet_iterator  first,
octet_iterator  last 
)
122  {
123  typename std::iterator_traits<octet_iterator>::difference_type dist;
124  for (dist = 0; first < last; ++dist)
125  utf8::unchecked::next(first);
126  return dist;
127  }
uint32_t next(octet_iterator &it)
Definition: unchecked.h:61

+ Here is the call graph for this function:

template<typename octet_iterator >
uint32_t utf8::unchecked::next ( octet_iterator &  it)
62  {
64  typename std::iterator_traits<octet_iterator>::difference_type length = utf8::internal::sequence_length(it);
65  switch (length) {
66  case 1:
67  break;
68  case 2:
69  it++;
70  cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
71  break;
72  case 3:
73  ++it;
74  cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
75  ++it;
76  cp += (*it) & 0x3f;
77  break;
78  case 4:
79  ++it;
80  cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
81  ++it;
82  cp += (utf8::internal::mask8(*it) << 6) & 0xfff;
83  ++it;
84  cp += (*it) & 0x3f;
85  break;
86  }
87  ++it;
88  return cp;
89  }
std::iterator_traits< octet_iterator >::difference_type sequence_length(octet_iterator lead_it)
Definition: core.h:100
uint8_t mask8(octet_type oc)
Definition: core.h:59
unsigned int uint32_t
Definition: stdint.h:80
float length(float v)
Definition: vectorMath.h:208

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename octet_iterator >
uint32_t utf8::unchecked::peek_next ( octet_iterator  it)
93  {
94  return utf8::unchecked::next(it);
95  }
uint32_t next(octet_iterator &it)
Definition: unchecked.h:61

+ Here is the call graph for this function:

template<typename octet_iterator >
uint32_t utf8::unchecked::previous ( octet_iterator &  it)
inline
108  {
109  return utf8::unchecked::prior(it);
110  }
uint32_t prior(octet_iterator &it)
Definition: unchecked.h:98

+ Here is the call graph for this function:

template<typename octet_iterator >
uint32_t utf8::unchecked::prior ( octet_iterator &  it)
99  {
100  while (utf8::internal::is_trail(*(--it))) ;
101  octet_iterator temp = it;
102  return utf8::unchecked::next(temp);
103  }
uint32_t next(octet_iterator &it)
Definition: unchecked.h:61
bool is_trail(octet_type oc)
Definition: core.h:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename u16bit_iterator , typename octet_iterator >
octet_iterator utf8::unchecked::utf16to8 ( u16bit_iterator  start,
u16bit_iterator  end,
octet_iterator  result 
)
131  {
132  while (start != end) {
133  uint32_t cp = utf8::internal::mask16(*start++);
134  // Take care of surrogate pairs first
136  uint32_t trail_surrogate = utf8::internal::mask16(*start++);
137  cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
138  }
139  result = utf8::unchecked::append(cp, result);
140  }
141  return result;
142  }
octet_iterator append(uint32_t cp, octet_iterator result)
Definition: unchecked.h:38
bool is_lead_surrogate(u16 cp)
Definition: core.h:75
unsigned int uint32_t
Definition: stdint.h:80
const uint32_t SURROGATE_OFFSET
Definition: core.h:53
uint16_t mask16(u16_type oc)
Definition: core.h:64

+ Here is the call graph for this function:

template<typename octet_iterator , typename u32bit_iterator >
octet_iterator utf8::unchecked::utf32to8 ( u32bit_iterator  start,
u32bit_iterator  end,
octet_iterator  result 
)
161  {
162  while (start != end)
163  result = utf8::unchecked::append(*(start++), result);
164 
165  return result;
166  }
octet_iterator append(uint32_t cp, octet_iterator result)
Definition: unchecked.h:38

+ Here is the call graph for this function:

template<typename u16bit_iterator , typename octet_iterator >
u16bit_iterator utf8::unchecked::utf8to16 ( octet_iterator  start,
octet_iterator  end,
u16bit_iterator  result 
)
146  {
147  while (start < end) {
148  uint32_t cp = utf8::unchecked::next(start);
149  if (cp > 0xffff) { //make a surrogate pair
150  *result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
151  *result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
152  }
153  else
154  *result++ = static_cast<uint16_t>(cp);
155  }
156  return result;
157  }
const uint16_t TRAIL_SURROGATE_MIN
Definition: core.h:50
uint32_t next(octet_iterator &it)
Definition: unchecked.h:61
unsigned int uint32_t
Definition: stdint.h:80
const uint16_t LEAD_OFFSET
Definition: core.h:52
unsigned short uint16_t
Definition: stdint.h:79

+ Here is the call graph for this function:

template<typename octet_iterator , typename u32bit_iterator >
u32bit_iterator utf8::unchecked::utf8to32 ( octet_iterator  start,
octet_iterator  end,
u32bit_iterator  result 
)
170  {
171  while (start < end)
172  (*result++) = utf8::unchecked::next(start);
173 
174  return result;
175  }
uint32_t next(octet_iterator &it)
Definition: unchecked.h:61

+ Here is the call graph for this function: