YSTest: StaticMapping.hpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

StaticMapping.hpp
浏览该文件的文档.
1 /*
2 © 2009-2015 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef INC_CHRLib_StaticMapping_hpp_
29 #define INC_CHRLib_StaticMapping_hpp_ 1
30
31 #include "YModules.h"
32 #include YFM_CHRLib_CharacterMapping
33 #include <ystdex/cstdio.h>
34 #include <ystdex/ref.hpp> // for ystdex::pseudo_object;
35
36 namespace CHRLib
37 {
38
40
41 template<typename _tIn>
43 inline bool
44 CheckIterator(_tIn& i) ynothrow
45 {
46 static_assert(std::is_constructible<const byte, decltype(*i)>(),
47 "Invalid mapping source type found.");
48 using ystdex::is_undereferenceable;
49
50 return !is_undereferenceable(i);
51 }
52
54
55 template<typename _tIn>
56 inline bool
57 FillByte(_tIn& i, byte& b) ynoexcept(noexcept(byte(*i)) && noexcept(++i))
58 {
59 if(CheckIterator(i))
60 {
61 const auto r = byte(*i);
62
63 yunseq(++i, b = r);
64 return true;
65 }
66 return {};
67 }
68 template<typename _tIn, typename _tState>
69 inline bool
70 FillByte(_tIn& i, _tState& st) ynoexcept(noexcept(byte(*i)) && noexcept(++i)
71 && noexcept(GetSequenceOf(st)[GetIndexOf(st)++] = byte()))
72 {
73 if(CheckIterator(i))
74 {
75 static_assert(!std::is_volatile<ystdex::remove_reference_t<_tState>>(),
76 "Volatile state is not supported.");
77 const auto r = byte(*i);
78
79 yunseq(++i, GetSequenceOf(st)[GetIndexOf(st)++] = r);
80 return true;
81 }
82 return {};
83 }
84 template<typename _tIn>
85 inline bool
86 FillByte(GuardPair<_tIn>& pr, byte& b) ynoexcept(noexcept(pr.first.get()
87 != pr.second) && noexcept(FillByte(pr.first.get(), b)))
88 {
89 return pr.first.get() != pr.second ? FillByte(pr.first.get(), b) : false;
90 }
91 template<typename _tIn, typename _tState>
92 inline bool
93 FillByte(GuardPair<_tIn>& pr, _tState& st) ynoexcept(noexcept(pr.first.get()
94 != pr.second) && noexcept(FillByte(pr.first.get(), st)))
95 {
96 return pr.first.get() != pr.second ? FillByte(pr.first.get(), st) : false;
97 }
99
100
101
103
104 yconstfn PDefH(bool, IsSurrogateHead, octet x) ynothrow
106 ImplRet(x >= 0xD8 && x < 0xE0)
107
108 yconstfn PDefH(bool, IsValidSurrogateHead, octet x) ynothrow
110 ImplRet(x >= 0xD8 && x < 0xDE)
111
113 yconstfn PDefH(bool, IsValidSurrogateTail, octet x) ynothrow
114 ImplRet(x >= 0xDC && x < 0xE0)
115
116
118 struct UCSMapperBase
119 {
121
122 static void
123 Assign(ystdex::pseudo_output, char32_t) ynothrow
124 {}
125 template<typename _tObj>
126 static void
127 Assign(_tObj& uc, char32_t c) ynothrow
128 {
129 ynoexcept_assert("Invalid type found", uc = _tObj(c));
130
131 uc = _tObj(c);
132 }
134 };
135
136
156 template<Encoding>
157 class GUCSMapper
158 {};
159
164 template<>
165 struct GUCSMapper<CharSet::UTF_8> : UCSMapperBase
166 {
167 using UCSMapperBase::Assign;
168
169 private:
170 template<typename _tObj, typename _tSeq>
171 static void
172 Assign1(_tObj& uc, const _tSeq& seq) ynothrow
173 {
174 ynoexcept_assert("Invalid type found", Assign(uc, char32_t()));
175
176 Assign(uc, (char32_t(seq[0] & 0x1CU) >> 2U << 8U)
177 | (char32_t(seq[0] & 0x03U) << 6) | (char32_t(seq[1]) & 0x3FU));
178 }
179
180 template<typename _tObj, typename _tSeq>
181 static void
182 Assign2(_tObj& uc, const _tSeq& seq) ynothrow
183 {
184 ynoexcept_assert("Invalid type found", Assign(uc, char32_t()));
185
186 Assign(uc, (((char32_t(seq[0]) & 0x0FU) << 4U
187 | char32_t(seq[1] & 0x3CU) >> 2U) << 8U)
188 | (char32_t(seq[1] & 0x3U) << 6U) | char32_t(seq[2] & 0x3FU));
189 }
190
191 static yconstfn bool
192 CheckInvalid(octet x, octet y = 0x80) ynothrow
193 {
194 return IsInvalid(x) || ((x & 0xC0) != y);
195 }
196
197 public:
202 static yconstfn bool
203 IsInvalid(octet x) ynothrow
204 {
205 return x == 0xC0 || x == 0xC1 || x > 0xF4;
206 }
207
212 template<typename _tObj, typename _tIn, typename _tState>
213 static ConversionResult
214 Decode(_tObj&& uc, _tIn&& i, _tState&& st)
215 ynoexcept(noexcept(GetSequenceOf(st)) && noexcept(GetIndexOf(st))
216 && noexcept(!FillByte(i, st)))
217 {
218 const auto seq(GetSequenceOf(st));
219
220 switch(GetIndexOf(st))
221 {
222 case 0:
223 if(YB_UNLIKELY(!FillByte(i, st)))
224 return ConversionResult::BadSource;
225 if((seq[0] & 0x80) == 0)
226 {
227 Assign(uc, seq[0]);
228 break;
229 }
230 if(YB_UNLIKELY(CheckInvalid(seq[0], 0xC0)))
231 return ConversionResult::Invalid;
232 case 1:
233 if(YB_UNLIKELY(!FillByte(i, st)))
234 return ConversionResult::BadSource;
235 if(YB_UNLIKELY(CheckInvalid(seq[1])))
236 return ConversionResult::Invalid;
237 if(((seq[0] ^ 0xC0) & 0xE0) == 0)
238 {
239 Assign1(uc, seq);
240 break;
241 }
242 case 2:
243 if(YB_UNLIKELY(!FillByte(i, st)))
244 return ConversionResult::BadSource;
245 if(YB_UNLIKELY(CheckInvalid(seq[2])))
246 return ConversionResult::Invalid;
247 if(((seq[0] ^ 0xE0) & 0xF0) == 0)
248 {
249 Assign2(uc, seq);
250 break;
251 }
252 case 3:
253 if(YB_UNLIKELY(!FillByte(i, st)))
254 return ConversionResult::BadSource;
255 if(YB_UNLIKELY(CheckInvalid(seq[3])))
256 return ConversionResult::Invalid;
257 if(YB_LIKELY(((seq[0] ^ 0xF0) & 0xF8) == 0))
258 {
259 Assign2(uc, seq);
260 break;
261 }
262 return ConversionResult::Unhandled;
263 default:
264 return ConversionResult::BadState;
265 }
266 return ConversionResult::OK;
267 }
274 template<typename _tObj, typename _tIn>
275 static ConversionResult
276 Decode(_tObj&& uc, _tIn&& i, ConversionState& st)
277 ynoexcept_spec(!FillByte(i, st))
278 {
279 byte b;
280
281 if(YB_UNLIKELY(!FillByte(i, b)))
282 return ConversionResult::BadSource;
283 if((b & 0x80U) == 0)
284 {
285 if(st.Index == 0)
286 {
287 uc = b;
288 return ConversionResult::OK;
289 }
290 return ConversionResult::Invalid;
291 }
292
293 using state_t = std::uint_fast8_t;
294 static yconstexpr const state_t t_data_1[]{
295 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3,
298 11, 6, 6, 6, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
299 };
300 static yconstexpr const state_t t_data_2[]{1, 2, 4, 4};
301 auto& code(st.Value.UCS4);
302 #define CHRLib_Impl_UTF8_Decode_Fill \
303 if(YB_UNLIKELY(!FillByte(i, b))) \
304 return ConversionResult::BadSource; \
305 code = (code << 6U) | (b & 0x3FU)
306 #define CHRLib_Impl_UTF8_Decode_Tail \
307 CHRLib_Impl_UTF8_Decode_Fill; \
308 trans(0x70U)
309 #define CHRLib_Impl_UTF8_Decode_FillTransTail(_mask) \
310 CHRLib_Impl_UTF8_Decode_Fill; \
311 trans(_mask); \
312 CHRLib_Impl_UTF8_Decode_Tail;
313 bool res(true);
314 auto trans([&](unsigned mask){
315 res &= (b & 0xC0U) == 0x80U
316 && (t_data_2[byte(b >> 4U) & 0x3U] & byte(mask)) != 0;
317 });
318 auto& type(st.Index);
319
320 if(type == 0)
321 {
322 if((b & 0xC0U) != 0)
323 {
324 type = state_t(t_data_1[b & 0x3FU]);
325 code = (0xFFU >> type) & byte(b);
326 }
327 else
328 return ConversionResult::Invalid;
329 }
330 switch(type)
331 {
332 case 6:
333 CHRLib_Impl_UTF8_Decode_Fill;
334 case 3:
335 CHRLib_Impl_UTF8_Decode_Fill;
336 case 2:
337 CHRLib_Impl_UTF8_Decode_Fill;
338 break;
339 case 4:
340 CHRLib_Impl_UTF8_Decode_FillTransTail(3U);
341 break;
342 case 10:
343 CHRLib_Impl_UTF8_Decode_FillTransTail(4U);
344 break;
345 case 5:
346 CHRLib_Impl_UTF8_Decode_FillTransTail(1U);
347 CHRLib_Impl_UTF8_Decode_Tail;
348 break;
349 case 11:
350 CHRLib_Impl_UTF8_Decode_FillTransTail(6U);
351 CHRLib_Impl_UTF8_Decode_Tail;
352 break;
353 case 8:
354 return ConversionResult::Invalid;
355 default:
356 return ConversionResult::BadState;
357 }
358 uc = code;
359 return res ? ConversionResult::OK : ConversionResult::Invalid;
360 #undef CHRLib_Impl_UTF8_Decode_FillTransTail
361 #undef CHRLib_Impl_UTF8_Decode_Tail
362 #undef CHRLib_Impl_UTF8_Decode_Fill
363 }
364 template<typename _tObj, typename _tIn>
365 static ConversionResult
366 Decode(_tObj&& uc, _tIn&& i, ConversionState&& st)
367 ynoexcept_spec(Decode(uc, yforward(i), st))
368 {
369 return Decode(uc, yforward(i), st);
370 }
372
374 template<typename _tOut>
375 static size_t
376 Encode(_tOut d, char32_t s) ynothrow
377 {
378 ynoexcept_assert("Invalid type found.", *d = char());
379 using ystdex::is_undereferenceable;
380 size_t l(0);
381
382 yconstraint(!is_undereferenceable(d));
383 if(s < 0x80U)
384 {
385 *d = s;
386 return 1;
387 }
388 if(s < 0x800U)
389 l = 2;
390 else
391 {
392 *d = char(0xE0U | s >> 12U);
393 ++d;
394 l = 3;
395 }
396 *d = char(0x80U | (s >> 6U & 0x3FU));
397 *++d = char(0x80U | (s & 0x3FU));
398 return l;
399 }
400 };
401
403 template<>
404 struct GUCSMapper<CharSet::UTF_16BE> : UCSMapperBase
405 {
406 using UCSMapperBase::Assign;
407
412 template<typename _tObj, typename _tIn, typename _tState>
413 static ConversionResult
414 Decode(_tObj&& uc, _tIn&& i, _tState&& st)
415 ynoexcept(noexcept(GetSequenceOf(st))
416 && noexcept(GetIndexOf(st)) && noexcept(!FillByte(i, st)))
417 {
418 const auto seq(GetSequenceOf(st));
419
420 switch(GetIndexOf(st))
421 {
422 case 0:
423 if(YB_UNLIKELY(!FillByte(i, st)))
424 return ConversionResult::BadSource;
425 case 1:
426 if(YB_UNLIKELY(!FillByte(i, st)))
427 return ConversionResult::BadSource;
428 if(YB_UNLIKELY(CHRLib::IsSurrogateHead(seq[0])))
429 {
430 if(YB_UNLIKELY(!CHRLib::IsValidSurrogateHead(seq[0])))
431 return ConversionResult::Invalid;
432 }
433 else
434 {
435 Assign(uc, char32_t(seq[0]) << 8U | char32_t(seq[1]));
436 break;
437 }
438 case 2:
439 if(YB_UNLIKELY(!FillByte(i, st)))
440 return ConversionResult::BadSource;
441 case 3:
442 if(YB_UNLIKELY(!FillByte(i, st)))
443 return ConversionResult::BadSource;
444 if(YB_UNLIKELY(!CHRLib::IsValidSurrogateTail(seq[2])))
445 return ConversionResult::Invalid;
446 Assign(uc, char32_t(seq[0] & 0x03U) << 18U | char32_t(seq[1]) << 10U
447 | char32_t(seq[2] & 0x03U) << 8U | char32_t(seq[3]));
448 break;
449 default:
450 return ConversionResult::BadState;
451 }
452 return ConversionResult::OK;
453 }
454 };
455
457 template<>
458 struct GUCSMapper<CharSet::UTF_16LE> : UCSMapperBase
459 {
460 using UCSMapperBase::Assign;
461
466 template<typename _tObj, typename _tIn, typename _tState>
467 static ConversionResult
468 Decode(_tObj&& uc, _tIn&& i, _tState&& st)
469 ynoexcept(noexcept(GetSequenceOf(st))
470 && noexcept(GetIndexOf(st)) && noexcept(!FillByte(i, st)))
471 {
472 const auto seq(GetSequenceOf(st));
473
474 switch(GetIndexOf(st))
475 {
476 case 0:
477 if(YB_UNLIKELY(!FillByte(i, st)))
478 return ConversionResult::BadSource;
479 case 1:
480 if(YB_UNLIKELY(!FillByte(i, st)))
481 return ConversionResult::BadSource;
482 if(YB_UNLIKELY(CHRLib::IsSurrogateHead(seq[1])))
483 {
484 if(YB_UNLIKELY(!CHRLib::IsValidSurrogateHead(seq[1])))
485 return ConversionResult::Invalid;
486 }
487 else
488 {
489 Assign(uc, char32_t(seq[0]) | char32_t(seq[1]) << 8U);
490 break;
491 }
492 case 2:
493 if(YB_UNLIKELY(!FillByte(i, st)))
494 return ConversionResult::BadSource;
495 case 3:
496 if(YB_UNLIKELY(!FillByte(i, st)))
497 return ConversionResult::BadSource;
498 if(YB_UNLIKELY(!CHRLib::IsValidSurrogateTail(seq[3])))
499 return ConversionResult::Invalid;
500 Assign(uc, char32_t(seq[0] << 10U) | char32_t(seq[1] & 0x03U) << 18U
501 | char32_t(seq[2]) | char32_t(seq[3] & 0x03U) << 8U);
502 break;
503 default:
504 return ConversionResult::BadState;
505 }
506 return ConversionResult::OK;
507 }
508 };
509
511 template<>
512 struct GUCSMapper<CharSet::UTF_32BE> : UCSMapperBase
513 {
514 using UCSMapperBase::Assign;
515
520 template<typename _tObj, typename _tIn, typename _tState>
521 static ConversionResult
522 Decode(_tObj&& uc, _tIn&& i, _tState&& st)
523 ynoexcept(noexcept(GetSequenceOf(st))
524 && noexcept(GetIndexOf(st)) && noexcept(!FillByte(i, st)))
525 {
526 const auto seq(GetSequenceOf(st));
527
528 switch(GetIndexOf(st))
529 {
530 case 0:
531 if(YB_UNLIKELY(!FillByte(i, st)))
532 return ConversionResult::BadSource;
533 case 1:
534 if(YB_UNLIKELY(!FillByte(i, st)))
535 return ConversionResult::BadSource;
536 case 2:
537 if(YB_UNLIKELY(!FillByte(i, st)))
538 return ConversionResult::BadSource;
539 case 3:
540 if(YB_UNLIKELY(!FillByte(i, st)))
541 return ConversionResult::BadSource;
542 Assign(uc, char32_t(seq[0]) << 24U | char32_t(seq[1]) << 16U
543 | char32_t(seq[2]) << 8U | char32_t(seq[3]));
544 break;
545 default:
546 return ConversionResult::BadState;
547 }
548 return ConversionResult::OK;
549 }
550 };
551
553 template<>
554 struct GUCSMapper<CharSet::UTF_32LE> : UCSMapperBase
555 {
556 using UCSMapperBase::Assign;
557
562 template<typename _tObj, typename _tIn, typename _tState>
563 static ConversionResult
564 Decode(_tObj&& uc, _tIn&& i, _tState&& st)
565 ynoexcept(noexcept(GetSequenceOf(st))
566 && noexcept(GetIndexOf(st)) && noexcept(!FillByte(i, st)))
567 {
568 const auto seq(GetSequenceOf(st));
569
570 switch(GetIndexOf(st))
571 {
572 case 0:
573 if(YB_UNLIKELY(!FillByte(i, st)))
574 return ConversionResult::BadSource;
575 case 1:
576 if(YB_UNLIKELY(!FillByte(i, st)))
577 return ConversionResult::BadSource;
578 case 2:
579 if(YB_UNLIKELY(!FillByte(i, st)))
580 return ConversionResult::BadSource;
581 case 3:
582 if(YB_UNLIKELY(!FillByte(i, st)))
583 return ConversionResult::BadSource;
584 Assign(uc, char32_t(seq[2]) | char32_t(seq[3]) << 8U
585 | char32_t(seq[0]) << 16U | char32_t(seq[1]) << 24U);
586 break;
587 default:
588 return ConversionResult::BadState;
589 }
590 return ConversionResult::OK;
591 }
592 };
594
595
596 } // namespace CHRLib;
597
598 #endif
599
CHRLib::GUCSMapper< CharSet::UTF_8 >::Assign2
static void Assign2(_tObj &uc, const _tSeq &seq) ynothrow
Definition: StaticMapping.hpp:182
YSLib::Drawing::x
The boundary is out of the const Rect SDst SPos x
Definition: YDraw.h:127
CHRLib::ConversionState
编码转换状态。
Definition: CharacterMapping.h:106
CHRLib_Impl_UTF8_Decode_Fill
#define CHRLib_Impl_UTF8_Decode_Fill
Definition: StaticMapping.hpp:302
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:653
CHRLib::GUCSMapper< CharSet::UTF_32BE >::Decode
static ConversionResult Decode(_tObj &&uc, _tIn &&i, _tState &&st) ynoexcept(noexcept(GetSequenceOf(st))&&noexcept(GetIndexOf(st))&&noexcept(!FillByte(i, st)))
解码： UTF-32BE 。
Definition: StaticMapping.hpp:522
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:740
CHRLib::GUCSMapper
静态编码操作模板及 Unicode 编码特化。
Definition: StaticMapping.hpp:157
CHRLib::GuardPair
std::pair< ystdex::lref< _tIn >, const _tIn > GuardPair
Definition: CharacterMapping.h:185
CHRLib::GUCSMapper< CharSet::UTF_8 >::Decode
static ConversionResult Decode(_tObj &&uc, _tIn &&i, _tState &&st) ynoexcept(noexcept(GetSequenceOf(st))&&noexcept(GetIndexOf(st))&&noexcept(!FillByte(i, st)))
解码： UTF-8 。
Definition: StaticMapping.hpp:214
yconstraint
#define yconstraint(_expr)
约束：接口语义。
Definition: cassert.h:82
cstdio.h
CHRLib::GUCSMapper< CharSet::UTF_8 >::Assign1
static void Assign1(_tObj &uc, const _tSeq &seq) ynothrow
Definition: StaticMapping.hpp:172
CHRLib::CharSet::UTF_8
yconstexpr const Encoding UTF_8(csUTF8)
CHRLib::GUCSMapper< CharSet::UTF_8 >::CheckInvalid
static yconstfn bool CheckInvalid(octet x, octet y=0x80) ynothrow
Definition: StaticMapping.hpp:192
CHRLib::d
_tDst * d
Definition: CharacterProcessing.h:139
ref.hpp
引用包装。
YSLib::Drawing::char32_t
tr TextRegion &tr char32_t
Definition: TextLayout.h:92
CHRLib::CheckIterator
bool CheckIterator(_tIn &i) ynothrow
Definition: StaticMapping.hpp:44
CHRLib::c
c
Definition: CharacterProcessing.h:81
CHRLib::CharSet::UTF_32LE
yconstexpr const Encoding UTF_32LE(csUTF32LE)
platform_ex::Windows::Invalid
Definition: MinGW32.h:461
ystdex::octet
void octet
Definition: ydef.h:818
ynoexcept_spec
#define ynoexcept_spec(...)
表达式 noexcept 异常规范。
Definition: ydef.h:768
YB_UNLIKELY
#define YB_UNLIKELY(_expr)
分支预测提示。
Definition: ydef.h:438
ynoexcept_assert
#define ynoexcept_assert(_msg,...)
表达式 noexcept 静态断言。
Definition: ydef.h:721
CHRLib::PDefH
PDefH(char16_t, FetchBiCharBE, const char *c_ptr) ImplRet(yconstraint(c_ptr)
取 c_ptr 指向的大端序双字节字符。
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:996
CHRLib::CharSet::UTF_32BE
yconstexpr const Encoding UTF_32BE(csUTF32BE)
CHRLib::GetSequenceOf
yconstfn ConversionState &st GetSequenceOf
Definition: CharacterMapping.h:138
CHRLib::GUCSMapper< CharSet::UTF_8 >::Encode
static size_t Encode(_tOut d, char32_t s) ynothrow
Definition: StaticMapping.hpp:376
CHRLib::IsValidSurrogateHead
yconstfn IsValidSurrogateHead
Definition: StaticMapping.hpp:109
CHRLib::CharSet::UTF_16BE
yconstexpr const Encoding UTF_16BE(csUTF16BE)
YSLib::Drawing::r
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect & r
Definition: YDraw.h:174
YModules.h
CHRLib::GUCSMapper< CharSet::UTF_32LE >::Decode
static ConversionResult Decode(_tObj &&uc, _tIn &&i, _tState &&st) ynoexcept(noexcept(GetSequenceOf(st))&&noexcept(GetIndexOf(st))&&noexcept(!FillByte(i, st)))
解码： UTF-32LE 。
Definition: StaticMapping.hpp:564
ystdex::pseudo_output
伪输出对象。
Definition: ref.hpp:254
ystdex::is_undereferenceable
bool is_undereferenceable(const _tIter &)
Definition: deref_op.hpp:45
CHRLib::IsValidSurrogateTail
yconstfn octet x ynothrow IsValidSurrogateTail
Definition: StaticMapping.hpp:113
CHRLib::GUCSMapper< CharSet::UTF_16LE >::Decode
static ConversionResult Decode(_tObj &&uc, _tIn &&i, _tState &&st) ynoexcept(noexcept(GetSequenceOf(st))&&noexcept(GetIndexOf(st))&&noexcept(!FillByte(i, st)))
解码： UTF-16LE 。
Definition: StaticMapping.hpp:468
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
YSLib::i
return i
Definition: YCoreUtilities.h:176
CHRLib
Definition: CharacterDefinition.h:38
ystdex::byte
unsigned char byte
字节类型。
Definition: ydef.h:808
CHRLib_Impl_UTF8_Decode_Tail
#define CHRLib_Impl_UTF8_Decode_Tail
Definition: StaticMapping.hpp:306
CHRLib::GUCSMapper< CharSet::UTF_8 >::state_t
std::uint_fast8_t state_t
Definition: StaticMapping.hpp:293
ynoexcept
#define ynoexcept(...)
YSLib 无异常抛出保证：指定特定的异常规范。
Definition: ydef.h:720
YB_LIKELY
#define YB_LIKELY(_expr)
Definition: ydef.h:437
CHRLib::CharSet::UTF_16LE
yconstexpr const Encoding UTF_16LE(csUTF16LE)
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:654
CHRLib::GUCSMapper< CharSet::UTF_8 >::IsInvalid
static yconstfn bool IsInvalid(octet x) ynothrow
检查 UTF-8 文本序列中非法字节。
Definition: StaticMapping.hpp:203
CHRLib::GUCSMapper< CharSet::UTF_16BE >::Decode
static ConversionResult Decode(_tObj &&uc, _tIn &&i, _tState &&st) ynoexcept(noexcept(GetSequenceOf(st))&&noexcept(GetIndexOf(st))&&noexcept(!FillByte(i, st)))
解码： UTF-16BE 。
Definition: StaticMapping.hpp:414
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:969
CHRLib::FillByte
bool FillByte(_tIn &i, byte &b) ynoexcept(noexcept(byte(*i))&&noexcept(++i))
以输入迭代器指向内容填充有效输入迭代器指定的字节。
Definition: StaticMapping.hpp:57
YSLib::char
char
Definition: ValueNode.h:851
CHRLib_Impl_UTF8_Decode_FillTransTail
#define CHRLib_Impl_UTF8_Decode_FillTransTail(_mask)
Definition: StaticMapping.hpp:309
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
CHRLib::ImplRet
const char *c_ptr ImplRet(yconstraint(c_ptr), char16_t((c_ptr[1]<< CHAR_BIT)|*c_ptr)) enum class ConversionResult
编码转换结果。
Definition: CharacterMapping.h:84