| utf.h | | utf.h | |
| | | | |
| skipping to change at line 281 | | skipping to change at line 281 | |
| case 1: | | case 1: | |
| c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F); | | c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F); | |
| } | | } | |
| | | | |
| return c; | | return c; | |
| } | | } | |
| | | | |
| template<typename Iterator> | | template<typename Iterator> | |
| static Iterator encode(code_point value,Iterator out) | | static Iterator encode(code_point value,Iterator out) | |
| { | | { | |
|
| if(value <=0x7F) { | | if(value <= 0x7F) { | |
| *out++ = value; | | *out++ = static_cast<char_type>(value); | |
| } | | } | |
|
| else if(value <=0x7FF) { | | else if(value <= 0x7FF) { | |
| *out++=(value >> 6) | 0xC0; | | *out++ = static_cast<char_type>((value >> 6) | 0xC0); | |
| *out++=(value & 0x3F) | 0x80; | | *out++ = static_cast<char_type>((value & 0x3F) | 0x80); | |
| } | | } | |
| else if(BOOSTER_LOCALE_LIKELY(value <=0xFFFF)) { | | else if(BOOSTER_LOCALE_LIKELY(value <= 0xFFFF)) { | |
| *out++=(value >> 12) | 0xE0; | | *out++ = static_cast<char_type>((value >> 12) | 0xE0); | |
| *out++=((value >> 6) & 0x3F) | 0x80; | | *out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x8 | |
| *out++=(value & 0x3F) | 0x80; | | 0); | |
| | | *out++ = static_cast<char_type>((value & 0x3F) | 0x80); | |
| } | | } | |
| else { | | else { | |
|
| *out++=(value >> 18) | 0xF0; | | *out++ = static_cast<char_type>((value >> 18) | 0xF0); | |
| *out++=((value >> 12) & 0x3F) | 0x80; | | *out++ = static_cast<char_type>(((value >> 12) & 0x3F) | 0x | |
| *out++=((value >> 6) & 0x3F) | 0x80; | | 80); | |
| *out++=(value & 0x3F) | 0x80; | | *out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x8 | |
| | | 0); | |
| | | *out++ = static_cast<char_type>((value & 0x3F) | 0x80); | |
| } | | } | |
| return out; | | return out; | |
| } | | } | |
| }; // utf8 | | }; // utf8 | |
| | | | |
| template<typename CharType> | | template<typename CharType> | |
| struct utf_traits<CharType,2> { | | struct utf_traits<CharType,2> { | |
| typedef CharType char_type; | | typedef CharType char_type; | |
| | | | |
| // See RFC 2781 | | // See RFC 2781 | |
| | | | |
| skipping to change at line 381 | | skipping to change at line 381 | |
| | | | |
| static const int max_width = 2; | | static const int max_width = 2; | |
| static int width(code_point u) | | static int width(code_point u) | |
| { | | { | |
| return u>=0x10000 ? 2 : 1; | | return u>=0x10000 ? 2 : 1; | |
| } | | } | |
| template<typename It> | | template<typename It> | |
| static It encode(code_point u,It out) | | static It encode(code_point u,It out) | |
| { | | { | |
| if(BOOSTER_LOCALE_LIKELY(u<=0xFFFF)) { | | if(BOOSTER_LOCALE_LIKELY(u<=0xFFFF)) { | |
|
| *out++ = u; | | *out++ = static_cast<char_type>(u); | |
| } | | } | |
| else { | | else { | |
|
| u-=0x10000; | | u -= 0x10000; | |
| *out++=0xD800 | (u>>10); | | *out++ = static_cast<char_type>(0xD800 | (u>>10)); | |
| *out++=0xDC00 | (u & 0x3FF); | | *out++ = static_cast<char_type>(0xDC00 | (u & 0x3FF)); | |
| } | | } | |
| return out; | | return out; | |
| } | | } | |
| }; // utf16; | | }; // utf16; | |
| | | | |
| template<typename CharType> | | template<typename CharType> | |
| struct utf_traits<CharType,4> { | | struct utf_traits<CharType,4> { | |
| typedef CharType char_type; | | typedef CharType char_type; | |
| static int trail_length(char_type c) | | static int trail_length(char_type c) | |
| { | | { | |
| | | | |
| skipping to change at line 434 | | skipping to change at line 434 | |
| return c; | | return c; | |
| } | | } | |
| static const int max_width = 1; | | static const int max_width = 1; | |
| static int width(code_point /*u*/) | | static int width(code_point /*u*/) | |
| { | | { | |
| return 1; | | return 1; | |
| } | | } | |
| template<typename It> | | template<typename It> | |
| static It encode(code_point u,It out) | | static It encode(code_point u,It out) | |
| { | | { | |
|
| *out++ = u; | | *out++ = static_cast<char_type>(u); | |
| return out; | | return out; | |
| } | | } | |
| | | | |
| }; // utf32 | | }; // utf32 | |
| | | | |
| #endif | | #endif | |
| | | | |
| } // utf | | } // utf | |
| } // locale | | } // locale | |
| } // boost | | } // boost | |
| | | | |
End of changes. 6 change blocks. |
| 19 lines changed or deleted | | 22 lines changed or added | |
|