Lines Matching defs:from

102     read_bom(range<const char>& from, const unsigned char (&bom)[N])
104 if (from.size() >= N && !memcmp(from.next, bom, N))
106 from.next += N;
112 // If consume_header is set in mode update from.next to after any BOM.
114 read_utf8_bom(range<const char>& from, codecvt_mode mode)
117 read_bom(from, utf8_bom);
120 // If consume_header is set in mode update from.next to after any BOM.
123 read_utf16_bom(range<const char16_t>& from, codecvt_mode mode)
125 if (mode & consume_header && from.size())
127 if (*from.next == 0xFEFF)
128 ++from.next;
129 else if (*from.next == 0xFFFE)
131 ++from.next;
138 // Read a codepoint from a UTF-8 multibyte sequence.
139 // Updates from.next if the codepoint is not greater than maxcode.
142 read_utf8_code_point(range<const char>& from, unsigned long maxcode)
144 const size_t avail = from.size();
147 unsigned char c1 = from.next[0];
151 ++from.next;
160 unsigned char c2 = from.next[1];
165 from.next += 2;
172 unsigned char c2 = from.next[1];
177 unsigned char c3 = from.next[2];
182 from.next += 3;
189 unsigned char c2 = from.next[1];
196 unsigned char c3 = from.next[2];
199 unsigned char c4 = from.next[3];
204 from.next += 4;
279 // Read a codepoint from a UTF-16 multibyte sequence.
281 // Updates from.next if the codepoint is not greater than maxcode.
284 read_utf16_code_point(range<const char16_t>& from, unsigned long maxcode,
287 const size_t avail = from.size();
291 char32_t c = adjust_byte_order(from.next[0], mode);
296 const char16_t c2 = adjust_byte_order(from.next[1], mode);
308 from.next += inc;
329 // Algorithm from http://www.unicode.org/faq/utf_bom.html#utf16-4
343 ucs4_in(range<const char>& from, range<char32_t>& to,
346 read_utf8_bom(from, mode);
347 while (from.size() && to.size())
349 const char32_t codepoint = read_utf8_code_point(from, maxcode);
356 return from.size() ? codecvt_base::partial : codecvt_base::ok;
361 ucs4_out(range<const char32_t>& from, range<char>& to,
366 while (from.size())
368 const char32_t c = from.next[0];
373 ++from.next;
380 ucs4_in(range<const char16_t>& from, range<char32_t>& to,
383 if (read_utf16_bom(from, mode) == little_endian)
385 while (from.size() && to.size())
387 const char32_t codepoint = read_utf16_code_point(from, maxcode, mode);
394 return from.size() ? codecvt_base::partial : codecvt_base::ok;
399 ucs4_out(range<const char32_t>& from, range<char16_t>& to,
404 while (from.size())
406 const char32_t c = from.next[0];
411 ++from.next;
419 utf16_in(range<const char>& from, range<C>& to,
422 read_utf8_bom(from, mode);
423 while (from.size() && to.size())
425 const char* const first = from.next;
426 const char32_t codepoint = read_utf8_code_point(from, maxcode);
433 from.next = first;
443 utf16_out(range<const C>& from, range<char>& to,
448 while (from.size())
450 char32_t c = from.next[0];
454 if (from.size() < 2)
457 const char32_t c2 = from.next[1];
472 from.next += inc;
482 range<const char> from{ begin, end };
483 read_utf8_bom(from, mode);
487 char32_t c = read_utf8_code_point(from, maxcode);
489 return from.next;
495 read_utf8_code_point(from, std::max(max_single_utf16_unit, maxcode));
496 return from.next;
501 ucs2_in(range<const char>& from, range<char16_t>& to,
504 return utf16_in(from, to, std::max(max_single_utf16_unit, maxcode), mode);
509 ucs2_out(range<const char16_t>& from, range<char>& to,
512 return utf16_out(from, to, std::max(max_single_utf16_unit, maxcode), mode);
517 ucs2_out(range<const char16_t>& from, range<char16_t>& to,
522 while (from.size() && to.size())
524 char16_t c = from.next[0];
530 ++from.next;
532 return from.size() == 0 ? codecvt_base::ok : codecvt_base::partial;
537 ucs2_in(range<const char16_t>& from, range<char16_t>& to,
540 if (read_utf16_bom(from, mode) == little_endian)
543 while (from.size() && to.size())
545 const char32_t c = read_utf16_code_point(from, maxcode, mode);
552 return from.size() == 0 ? codecvt_base::ok : codecvt_base::partial;
559 range<const char16_t> from{ begin, end };
560 if (read_utf16_bom(from, mode) == little_endian)
565 c = read_utf16_code_point(from, maxcode, mode);
566 return from.next;
573 range<const char> from{ begin, end };
574 read_utf8_bom(from, mode);
578 c = read_utf8_code_point(from, maxcode);
579 return from.next;
587 range<const char> from{ begin, end };
588 read_utf8_bom(from, mode);
591 c = read_utf8_code_point(from, maxcode);
592 return from.next;
600 range<const char16_t> from{ begin, end };
601 if (read_utf16_bom(from, mode) == little_endian)
605 c = read_utf16_code_point(from, maxcode, mode);
606 return from.next;
611 // Converts from UTF-8 to UTF-16.
625 range<const char16_t> from{ __from, __from_end };
627 auto res = utf16_out(from, to);
628 __from_next = from.next;
649 range<const char> from{ __from, __from_end };
656 auto res = utf16_in(from, to, max_code_point, mode);
657 __from_next = from.next;
688 // Converts from UTF-8 to UTF-32 (aka UCS-4).
701 range<const char32_t> from{ __from, __from_end };
703 auto res = ucs4_out(from, to);
704 __from_next = from.next;
725 range<const char> from{ __from, __from_end };
727 auto res = ucs4_in(from, to);
728 __from_next = from.next;
755 // Converts from UTF-8 to UCS-2.
766 range<const char16_t> from{ __from, __from_end };
768 auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
769 __from_next = from.next;
790 range<const char> from{ __from, __from_end };
796 auto res = ucs2_in(from, to, _M_maxcode, mode);
797 __from_next = from.next;
824 // Converts from UTF-8 to UTF-32 (aka UCS-4).
835 range<const char32_t> from{ __from, __from_end };
837 auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
838 __from_next = from.next;
859 range<const char> from{ __from, __from_end };
861 auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
862 __from_next = from.next;
890 // Converts from UTF-8 to UCS-2 or UCS-4 depending on sizeof(wchar_t).
903 range<const char16_t> from{
907 auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
909 range<const char32_t> from{
913 auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
917 __from_next = reinterpret_cast<const wchar_t*>(from.next);
938 range<const char> from{ __from, __from_end };
944 auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
950 auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
954 __from_next = from.next;
988 // Converts from UTF-16 to UCS-2.
999 range<const char16_t> from{ __from, __from_end };
1004 auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
1005 __from_next = from.next;
1026 range<const char16_t> from{
1031 auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
1032 __from_next = reinterpret_cast<const char*>(from.next);
1061 // Converts from UTF-16 to UTF-32 (aka UCS-4).
1072 range<const char32_t> from{ __from, __from_end };
1077 auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
1078 __from_next = from.next;
1099 range<const char16_t> from{
1104 auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
1105 __from_next = reinterpret_cast<const char*>(from.next);
1135 // Converts from UTF-8 to UCS-2 or UCS-4 depending on sizeof(wchar_t).
1148 range<const char16_t> from{
1152 auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
1154 range<const char32_t> from{
1158 auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
1162 __from_next = reinterpret_cast<const wchar_t*>(from.next);
1183 range<const char> from{ __from, __from_end };
1189 auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
1195 auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
1199 __from_next = from.next;
1234 // Converts from UTF-8 to UTF-16.
1245 range<const char16_t> from{ __from, __from_end };
1247 auto res = utf16_out(from, to, _M_maxcode, _M_mode);
1248 __from_next = from.next;
1269 range<const char> from{ __from, __from_end };
1275 auto res = utf16_in(from, to, _M_maxcode, mode);
1276 __from_next = from.next;
1307 // Converts from UTF-8 to UTF-16.
1318 range<const char32_t> from{ __from, __from_end };
1320 auto res = utf16_out(from, to, _M_maxcode, _M_mode);
1321 __from_next = from.next;
1342 range<const char> from{ __from, __from_end };
1344 auto res = utf16_in(from, to, _M_maxcode, _M_mode);
1345 __from_next = from.next;
1377 // Converts from UTF-8 to UTF-16.
1388 range<const wchar_t> from{ __from, __from_end };
1390 auto res = utf16_out(from, to, _M_maxcode, _M_mode);
1391 __from_next = from.next;
1412 range<const char> from{ __from, __from_end };
1414 auto res = utf16_in(from, to, _M_maxcode, _M_mode);
1415 __from_next = from.next;