From 0c1c50461a62cf749edb742981c972c659652461 Mon Sep 17 00:00:00 2001 From: rozmansi Date: Tue, 19 Sep 2023 16:02:48 +0000 Subject: [PATCH] deploy: b5984ea8f2c4b988dcbab5a026f69c5d29e9ab55 --- _unit_tests_2compat_8hpp_source.html | 92 +- annotated.html | 2 +- base64_8hpp_source.html | 2 +- chrono_8hpp_source.html | 2 +- classes.html | 2 +- classstdex_1_1base64__dec-members.html | 2 +- classstdex_1_1base64__dec.html | 2 +- classstdex_1_1base64__enc-members.html | 2 +- classstdex_1_1base64__enc.html | 2 +- classstdex_1_1charset__encoder-members.html | 2 +- classstdex_1_1charset__encoder.html | 2 +- classstdex_1_1errno__error-members.html | 2 +- classstdex_1_1errno__error.html | 2 +- classstdex_1_1global__progress-members.html | 2 +- classstdex_1_1global__progress.html | 2 +- classstdex_1_1hex__dec-members.html | 2 +- classstdex_1_1hex__dec.html | 2 +- classstdex_1_1hex__enc-members.html | 2 +- classstdex_1_1hex__enc.html | 2 +- classstdex_1_1idrec_1_1record-members.html | 2 +- classstdex_1_1idrec_1_1record.html | 2 +- classstdex_1_1lazy__progress-members.html | 2 +- classstdex_1_1lazy__progress.html | 2 +- ...dex_1_1parser_1_1basic__angle-members.html | 2 +- classstdex_1_1parser_1_1basic__angle.html | 2 +- ...x_1_1parser_1_1basic__any__cu-members.html | 2 +- classstdex_1_1parser_1_1basic__any__cu.html | 2 +- ...stdex_1_1parser_1_1basic__bol-members.html | 2 +- classstdex_1_1parser_1_1basic__bol.html | 2 +- ...ex_1_1parser_1_1basic__branch-members.html | 2 +- classstdex_1_1parser_1_1basic__branch.html | 2 +- ...r_1_1basic__chemical__formula-members.html | 2 +- ...1_1parser_1_1basic__chemical__formula.html | 2 +- ...1_1basic__creditor__reference-members.html | 2 +- ...1parser_1_1basic__creditor__reference.html | 2 +- ...sstdex_1_1parser_1_1basic__cu-members.html | 2 +- classstdex_1_1parser_1_1basic__cu.html | 2 +- ...x_1_1parser_1_1basic__cu__set-members.html | 2 +- classstdex_1_1parser_1_1basic__cu__set.html | 2 +- ...tdex_1_1parser_1_1basic__date-members.html | 2 +- classstdex_1_1parser_1_1basic__date.html | 2 +- ...r_1_1basic__dns__domain__char-members.html | 2 +- ...1_1parser_1_1basic__dns__domain__char.html | 2 +- ...1_1parser_1_1basic__dns__name-members.html | 2 +- classstdex_1_1parser_1_1basic__dns__name.html | 2 +- ...rser_1_1basic__email__address-members.html | 2 +- ...ex_1_1parser_1_1basic__email__address.html | 2 +- ..._1_1parser_1_1basic__emoticon-members.html | 2 +- classstdex_1_1parser_1_1basic__emoticon.html | 2 +- ...stdex_1_1parser_1_1basic__eol-members.html | 2 +- classstdex_1_1parser_1_1basic__eol.html | 2 +- ..._1_1parser_1_1basic__fraction-members.html | 2 +- classstdex_1_1parser_1_1basic__fraction.html | 2 +- ...tdex_1_1parser_1_1basic__iban-members.html | 2 +- classstdex_1_1parser_1_1basic__iban.html | 2 +- ...x_1_1parser_1_1basic__integer-members.html | 2 +- classstdex_1_1parser_1_1basic__integer.html | 2 +- ...1_1parser_1_1basic__integer10-members.html | 2 +- classstdex_1_1parser_1_1basic__integer10.html | 2 +- ...1parser_1_1basic__integer10ts-members.html | 2 +- ...stdex_1_1parser_1_1basic__integer10ts.html | 2 +- ...1_1parser_1_1basic__integer16-members.html | 2 +- classstdex_1_1parser_1_1basic__integer16.html | 2 +- ...arser_1_1basic__ipv4__address-members.html | 2 +- ...dex_1_1parser_1_1basic__ipv4__address.html | 2 +- ...arser_1_1basic__ipv6__address-members.html | 2 +- ...dex_1_1parser_1_1basic__ipv6__address.html | 2 +- ...1basic__ipv6__scope__id__char-members.html | 2 +- ...arser_1_1basic__ipv6__scope__id__char.html | 2 +- ..._1parser_1_1basic__iterations-members.html | 2 +- ...sstdex_1_1parser_1_1basic__iterations.html | 2 +- ...parser_1_1basic__json__string-members.html | 2 +- ...tdex_1_1parser_1_1basic__json__string.html | 2 +- ...rser_1_1basic__mixed__numeral-members.html | 2 +- ...ex_1_1parser_1_1basic__mixed__numeral.html | 2 +- ...r_1_1basic__monetary__numeral-members.html | 2 +- ...1_1parser_1_1basic__monetary__numeral.html | 2 +- ...tdex_1_1parser_1_1basic__noop-members.html | 2 +- classstdex_1_1parser_1_1basic__noop.html | 2 +- ...ex_1_1parser_1_1basic__parser-members.html | 2 +- classstdex_1_1parser_1_1basic__parser.html | 2 +- ...1parser_1_1basic__permutation-members.html | 2 +- ...stdex_1_1parser_1_1basic__permutation.html | 2 +- ...arser_1_1basic__phone__number-members.html | 2 +- ...dex_1_1parser_1_1basic__phone__number.html | 2 +- ...1_1parser_1_1basic__punct__cu-members.html | 2 +- classstdex_1_1parser_1_1basic__punct__cu.html | 2 +- ...rser_1_1basic__roman__numeral-members.html | 2 +- ...ex_1_1parser_1_1basic__roman__numeral.html | 2 +- ...1_1basic__scientific__numeral-members.html | 2 +- ...1parser_1_1basic__scientific__numeral.html | 2 +- ...dex_1_1parser_1_1basic__score-members.html | 2 +- classstdex_1_1parser_1_1basic__score.html | 2 +- ..._1_1parser_1_1basic__sequence-members.html | 2 +- classstdex_1_1parser_1_1basic__sequence.html | 2 +- ...stdex_1_1parser_1_1basic__set-members.html | 2 +- classstdex_1_1parser_1_1basic__set.html | 2 +- ...arser_1_1basic__si__reference-members.html | 2 +- ...dex_1_1parser_1_1basic__si__reference.html | 2 +- ...sic__si__reference__delimiter-members.html | 2 +- ...er_1_1basic__si__reference__delimiter.html | 2 +- ...1_1basic__si__reference__part-members.html | 2 +- ...1parser_1_1basic__si__reference__part.html | 2 +- ...ser_1_1basic__signed__numeral-members.html | 2 +- ...x_1_1parser_1_1basic__signed__numeral.html | 2 +- ...1_1parser_1_1basic__space__cu-members.html | 2 +- classstdex_1_1parser_1_1basic__space__cu.html | 2 +- ..._1basic__space__or__punct__cu-members.html | 2 +- ...parser_1_1basic__space__or__punct__cu.html | 2 +- ...ex_1_1parser_1_1basic__string-members.html | 2 +- classstdex_1_1parser_1_1basic__string.html | 2 +- ...rser_1_1basic__string__branch-members.html | 2 +- ...ex_1_1parser_1_1basic__string__branch.html | 2 +- ...tdex_1_1parser_1_1basic__time-members.html | 2 +- classstdex_1_1parser_1_1basic__time.html | 2 +- ...stdex_1_1parser_1_1basic__url-members.html | 2 +- classstdex_1_1parser_1_1basic__url.html | 2 +- ...1_1basic__url__password__char-members.html | 2 +- ...1parser_1_1basic__url__password__char.html | 2 +- ...1_1parser_1_1basic__url__path-members.html | 2 +- classstdex_1_1parser_1_1basic__url__path.html | 2 +- ...ser_1_1basic__url__path__char-members.html | 2 +- ...x_1_1parser_1_1basic__url__path__char.html | 2 +- ...1_1basic__url__username__char-members.html | 2 +- ...1parser_1_1basic__url__username__char.html | 2 +- ...tdex_1_1parser_1_1http__agent-members.html | 2 +- classstdex_1_1parser_1_1http__agent.html | 2 +- ..._1_1parser_1_1http__any__type-members.html | 2 +- classstdex_1_1parser_1_1http__any__type.html | 2 +- ...x_1_1parser_1_1http__asterisk-members.html | 2 +- classstdex_1_1parser_1_1http__asterisk.html | 2 +- ...dex_1_1parser_1_1http__cookie-members.html | 2 +- classstdex_1_1parser_1_1http__cookie.html | 2 +- ...er_1_1http__cookie__parameter-members.html | 2 +- ..._1_1parser_1_1http__cookie__parameter.html | 2 +- ...dex_1_1parser_1_1http__header-members.html | 2 +- classstdex_1_1parser_1_1http__header.html | 2 +- ...x_1_1parser_1_1http__language-members.html | 2 +- classstdex_1_1parser_1_1http__language.html | 2 +- ..._1parser_1_1http__line__break-members.html | 2 +- ...sstdex_1_1parser_1_1http__line__break.html | 2 +- ...1parser_1_1http__media__range-members.html | 2 +- ...stdex_1_1parser_1_1http__media__range.html | 2 +- ..._1parser_1_1http__media__type-members.html | 2 +- ...sstdex_1_1parser_1_1http__media__type.html | 2 +- ..._1_1parser_1_1http__parameter-members.html | 2 +- classstdex_1_1parser_1_1http__parameter.html | 2 +- ...x_1_1parser_1_1http__protocol-members.html | 2 +- classstdex_1_1parser_1_1http__protocol.html | 2 +- ...arser_1_1http__quoted__string-members.html | 2 +- ...dex_1_1parser_1_1http__quoted__string.html | 2 +- ...ex_1_1parser_1_1http__request-members.html | 2 +- classstdex_1_1parser_1_1http__request.html | 2 +- ...tdex_1_1parser_1_1http__space-members.html | 2 +- classstdex_1_1parser_1_1http__space.html | 2 +- ...1_1parser_1_1http__text__char-members.html | 2 +- classstdex_1_1parser_1_1http__text__char.html | 2 +- ...tdex_1_1parser_1_1http__token-members.html | 2 +- classstdex_1_1parser_1_1http__token.html | 2 +- ...sstdex_1_1parser_1_1http__url-members.html | 2 +- classstdex_1_1parser_1_1http__url.html | 2 +- ...arser_1_1http__url__parameter-members.html | 2 +- ...dex_1_1parser_1_1http__url__parameter.html | 2 +- ..._1_1parser_1_1http__url__path-members.html | 2 +- classstdex_1_1parser_1_1http__url__path.html | 2 +- ...r_1_1http__url__path__segment-members.html | 2 +- ...1_1parser_1_1http__url__path__segment.html | 2 +- ..._1_1parser_1_1http__url__port-members.html | 2 +- classstdex_1_1parser_1_1http__url__port.html | 2 +- ..._1parser_1_1http__url__server-members.html | 2 +- ...sstdex_1_1parser_1_1http__url__server.html | 2 +- ...tdex_1_1parser_1_1http__value-members.html | 2 +- classstdex_1_1parser_1_1http__value.html | 2 +- ...er_1_1http__value__collection-members.html | 2 +- ..._1_1parser_1_1http__value__collection.html | 2 +- ...dex_1_1parser_1_1http__weight-members.html | 2 +- classstdex_1_1parser_1_1http__weight.html | 2 +- ...rser_1_1http__weighted__value-members.html | 2 +- ...ex_1_1parser_1_1http__weighted__value.html | 2 +- ...1parser_1_1parser__collection-members.html | 2 +- ...stdex_1_1parser_1_1parser__collection.html | 2 +- ...ex_1_1parser_1_1sgml__any__cp-members.html | 2 +- classstdex_1_1parser_1_1sgml__any__cp.html | 2 +- classstdex_1_1parser_1_1sgml__cp-members.html | 2 +- classstdex_1_1parser_1_1sgml__cp.html | 2 +- ...ex_1_1parser_1_1sgml__cp__set-members.html | 2 +- classstdex_1_1parser_1_1sgml__cp__set.html | 2 +- ...er_1_1sgml__dns__domain__char-members.html | 2 +- ..._1_1parser_1_1sgml__dns__domain__char.html | 2 +- ..._1sgml__ipv6__scope__id__char-members.html | 2 +- ...parser_1_1sgml__ipv6__scope__id__char.html | 2 +- ..._1_1parser_1_1sgml__punct__cp-members.html | 2 +- classstdex_1_1parser_1_1sgml__punct__cp.html | 2 +- ..._1_1parser_1_1sgml__space__cp-members.html | 2 +- classstdex_1_1parser_1_1sgml__space__cp.html | 2 +- ...1_1sgml__space__or__punct__cp-members.html | 2 +- ...1parser_1_1sgml__space__or__punct__cp.html | 2 +- ...dex_1_1parser_1_1sgml__string-members.html | 2 +- classstdex_1_1parser_1_1sgml__string.html | 2 +- ..._1_1sgml__url__password__char-members.html | 2 +- ..._1parser_1_1sgml__url__password__char.html | 2 +- ...rser_1_1sgml__url__path__char-members.html | 2 +- ...ex_1_1parser_1_1sgml__url__path__char.html | 2 +- ..._1_1sgml__url__username__char-members.html | 2 +- ..._1parser_1_1sgml__url__username__char.html | 2 +- classstdex_1_1progress-members.html | 2 +- classstdex_1_1progress.html | 2 +- classstdex_1_1progress__switcher-members.html | 2 +- classstdex_1_1progress__switcher.html | 2 +- classstdex_1_1ring-members.html | 2 +- classstdex_1_1ring.html | 2 +- ...ex_1_1stream_1_1async__reader-members.html | 3 +- classstdex_1_1stream_1_1async__reader.html | 2 +- ...ex_1_1stream_1_1async__writer-members.html | 3 +- classstdex_1_1stream_1_1async__writer.html | 2 +- classstdex_1_1stream_1_1basic-members.html | 3 +- classstdex_1_1stream_1_1basic.html | 2 +- ...tdex_1_1stream_1_1basic__file-members.html | 3 +- classstdex_1_1stream_1_1basic__file.html | 2 +- ...stdex_1_1stream_1_1basic__sys-members.html | 5 +- classstdex_1_1stream_1_1basic__sys.html | 2 +- classstdex_1_1stream_1_1buffer-members.html | 5 +- classstdex_1_1stream_1_1buffer.html | 2 +- ...ex_1_1stream_1_1buffered__sys-members.html | 7 +- classstdex_1_1stream_1_1buffered__sys.html | 2 +- classstdex_1_1stream_1_1cache-members.html | 5 +- classstdex_1_1stream_1_1cache.html | 2 +- ...dex_1_1stream_1_1cached__file-members.html | 7 +- classstdex_1_1stream_1_1cached__file.html | 2 +- ...sstdex_1_1stream_1_1converter-members.html | 3 +- classstdex_1_1stream_1_1converter.html | 2 +- ...stdex_1_1stream_1_1diag__file-members.html | 3 +- classstdex_1_1stream_1_1diag__file.html | 2 +- classstdex_1_1stream_1_1fifo-members.html | 5 +- classstdex_1_1stream_1_1fifo.html | 2 +- classstdex_1_1stream_1_1file-members.html | 5 +- classstdex_1_1stream_1_1file.html | 2 +- ...dex_1_1stream_1_1file__window-members.html | 3 +- classstdex_1_1stream_1_1file__window.html | 2 +- classstdex_1_1stream_1_1limiter-members.html | 3 +- classstdex_1_1stream_1_1limiter.html | 2 +- ...dex_1_1stream_1_1memory__file-members.html | 5 +- classstdex_1_1stream_1_1memory__file.html | 2 +- ...stdex_1_1stream_1_1replicator-members.html | 5 +- classstdex_1_1stream_1_1replicator.html | 2 +- ...tream_1_1replicator_1_1worker-members.html | 2 +- ...dex_1_1stream_1_1replicator_1_1worker.html | 2 +- classstdex_1_1stream_1_1window-members.html | 3 +- classstdex_1_1stream_1_1window.html | 2 +- classstdex_1_1sys__object-members.html | 4 +- classstdex_1_1sys__object.html | 2 +- classstdex_1_1user__cancelled-members.html | 2 +- classstdex_1_1user__cancelled.html | 2 +- classstdex_1_1vector__queue-members.html | 2 +- classstdex_1_1vector__queue.html | 2 +- dir_4be4f7b278e009bf0f1906cf31fb73bd.html | 2 +- dir_d44c64559bbebec7f509842c48db8b23.html | 2 +- dir_fca3c47b2ea228727bd6729832f89576.html | 2 +- endian_8hpp_source.html | 2 +- errno_8hpp_source.html | 2 +- exception_8hpp_source.html | 2 +- files.html | 2 +- functions.html | 2 +- functions_b.html | 2 +- functions_c.html | 2 +- functions_d.html | 2 +- functions_e.html | 2 +- functions_f.html | 2 +- functions_func.html | 2 +- functions_func_b.html | 2 +- functions_func_c.html | 2 +- functions_func_d.html | 2 +- functions_func_e.html | 2 +- functions_func_f.html | 2 +- functions_func_g.html | 2 +- functions_func_h.html | 2 +- functions_func_i.html | 2 +- functions_func_l.html | 2 +- functions_func_m.html | 2 +- functions_func_n.html | 2 +- functions_func_o.html | 2 +- functions_func_p.html | 2 +- functions_func_q.html | 2 +- functions_func_r.html | 2 +- functions_func_s.html | 2 +- functions_func_t.html | 2 +- functions_func_u.html | 2 +- functions_func_v.html | 2 +- functions_func_w.html | 2 +- functions_func_~.html | 2 +- functions_g.html | 2 +- functions_h.html | 2 +- functions_i.html | 2 +- functions_l.html | 2 +- functions_m.html | 2 +- functions_n.html | 2 +- functions_o.html | 2 +- functions_p.html | 2 +- functions_q.html | 2 +- functions_r.html | 2 +- functions_s.html | 2 +- functions_t.html | 2 +- functions_type.html | 2 +- functions_u.html | 2 +- functions_v.html | 2 +- functions_vars.html | 2 +- functions_w.html | 2 +- functions_~.html | 2 +- hex_8hpp_source.html | 2 +- hierarchy.html | 2 +- idrec_8hpp_source.html | 6 +- include_2stdex_2compat_8hpp_source.html | 2 +- index.html | 2 +- interval_8hpp_source.html | 2 +- mapping_8hpp_source.html | 2 +- math_8cpp_source.html | 2 +- math_8hpp_source.html | 2 +- memory_8hpp_source.html | 2 +- parser_8cpp_source.html | 550 +- parser_8hpp_source.html | 5371 +++++++------ pch_8h_source.html | 2 +- progress_8hpp_source.html | 2 +- ring_8cpp_source.html | 2 +- ring_8hpp_source.html | 2 +- sgml_8cpp_source.html | 2 +- sgml_8hpp_source.html | 2 +- sgml__unicode_8hpp_source.html | 2 +- stream_8cpp_source.html | 20 +- stream_8hpp_source.html | 7062 +++++++++-------- string_8hpp_source.html | 1160 +-- ...stdex_1_1chrono_1_1aosn__date-members.html | 2 +- structstdex_1_1chrono_1_1aosn__date.html | 2 +- ..._1_1chrono_1_1aosn__timestamp-members.html | 2 +- structstdex_1_1chrono_1_1aosn__timestamp.html | 2 +- ...stdex_1_1free__locale__delete-members.html | 2 +- structstdex_1_1free__locale__delete.html | 2 +- structstdex_1_1interval-members.html | 2 +- structstdex_1_1interval.html | 2 +- structstdex_1_1mapping-members.html | 2 +- structstdex_1_1mapping.html | 2 +- structstdex_1_1no__delete-members.html | 2 +- structstdex_1_1no__delete.html | 2 +- ..._1_1no__delete_3_01_t_0f_0e_4-members.html | 2 +- structstdex_1_1no__delete_3_01_t_0f_0e_4.html | 2 +- ...1parser_1_1http__factor__more-members.html | 2 +- ...stdex_1_1parser_1_1http__factor__more.html | 2 +- ...stream_1_1buffer_1_1buffer__t-members.html | 2 +- ...tdex_1_1stream_1_1buffer_1_1buffer__t.html | 2 +- ..._1stream_1_1cache_1_1cache__t-members.html | 2 +- ...tstdex_1_1stream_1_1cache_1_1cache__t.html | 2 +- ..._1_1stream_1_1fifo_1_1node__t-members.html | 2 +- structstdex_1_1stream_1_1fifo_1_1node__t.html | 2 +- system_8hpp_source.html | 4 +- unicode_8cpp_source.html | 2 +- unicode_8hpp_source.html | 2 +- vector__queue_8hpp_source.html | 2 +- 356 files changed, 7535 insertions(+), 7468 deletions(-) diff --git a/_unit_tests_2compat_8hpp_source.html b/_unit_tests_2compat_8hpp_source.html index 7aa5b32ec..93cabd28a 100644 --- a/_unit_tests_2compat_8hpp_source.html +++ b/_unit_tests_2compat_8hpp_source.html @@ -118,51 +118,59 @@ $(document).ready(function() { init_codefold(0); });
34 throw std::runtime_error("not equal");
35 }
36
-
37 inline void AreEqual(const char* a, const char* b)
-
38 {
-
39 if (strcmp(a, b) != 0)
-
40 throw std::runtime_error("not equal");
-
41 }
-
42
-
43 inline void AreEqual(const wchar_t* a, const wchar_t* b)
-
44 {
-
45 if (wcscmp(a, b) != 0)
-
46 throw std::runtime_error("not equal");
-
47 }
-
48
-
49 template <class T>
-
50 inline void AreNotEqual(const T& a, const T& b)
-
51 {
-
52 if (a == b)
-
53 throw std::runtime_error("equal");
-
54 }
-
55
-
56 inline void AreNotEqual(const char* a, const char* b)
-
57 {
-
58 if (strcmp(a, b) == 0)
-
59 throw std::runtime_error("equal");
-
60 }
-
61
-
62 inline void AreNotEqual(const wchar_t* a, const wchar_t* b)
-
63 {
-
64 if (wcscmp(a, b) == 0)
-
65 throw std::runtime_error("equal");
-
66 }
-
67
-
68 template <class E, typename F>
-
69 inline void ExpectException(F functor)
-
70 {
-
71 try { functor(); }
-
72 catch (const E&) { return; }
-
73 catch (...) { throw std::runtime_error("unexpected exception"); }
-
74 throw std::runtime_error("exception not thrown");
-
75 }
-
76}
-
77#endif
+
37 template <class T, size_t N>
+
38 inline void AreEqual(const T (&a)[N], const T (&b)[N])
+
39 {
+
40 for (size_t i = 0; i < N; ++i)
+
41 if (!(a[i] == b[i]))
+
42 throw std::runtime_error("not equal");
+
43 }
+
44
+
45 inline void AreEqual(const char* a, const char* b)
+
46 {
+
47 if (strcmp(a, b) != 0)
+
48 throw std::runtime_error("not equal");
+
49 }
+
50
+
51 inline void AreEqual(const wchar_t* a, const wchar_t* b)
+
52 {
+
53 if (wcscmp(a, b) != 0)
+
54 throw std::runtime_error("not equal");
+
55 }
+
56
+
57 template <class T>
+
58 inline void AreNotEqual(const T& a, const T& b)
+
59 {
+
60 if (a == b)
+
61 throw std::runtime_error("equal");
+
62 }
+
63
+
64 inline void AreNotEqual(const char* a, const char* b)
+
65 {
+
66 if (strcmp(a, b) == 0)
+
67 throw std::runtime_error("equal");
+
68 }
+
69
+
70 inline void AreNotEqual(const wchar_t* a, const wchar_t* b)
+
71 {
+
72 if (wcscmp(a, b) == 0)
+
73 throw std::runtime_error("equal");
+
74 }
+
75
+
76 template <class E, typename F>
+
77 inline void ExpectException(F functor)
+
78 {
+
79 try { functor(); }
+
80 catch (const E&) { return; }
+
81 catch (...) { throw std::runtime_error("unexpected exception"); }
+
82 throw std::runtime_error("exception not thrown");
+
83 }
+
84}
+
85#endif
diff --git a/annotated.html b/annotated.html index c3a1984ab..d260635ce 100644 --- a/annotated.html +++ b/annotated.html @@ -224,7 +224,7 @@ $(function() { diff --git a/base64_8hpp_source.html b/base64_8hpp_source.html index 6e1753884..61bcc35fe 100644 --- a/base64_8hpp_source.html +++ b/base64_8hpp_source.html @@ -346,7 +346,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/chrono_8hpp_source.html b/chrono_8hpp_source.html index a5b3969ab..f9d0e7ba6 100644 --- a/chrono_8hpp_source.html +++ b/chrono_8hpp_source.html @@ -466,7 +466,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/classes.html b/classes.html index f02f891b1..45356f675 100644 --- a/classes.html +++ b/classes.html @@ -133,7 +133,7 @@ $(function() { diff --git a/classstdex_1_1base64__dec-members.html b/classstdex_1_1base64__dec-members.html index bfb3d987f..16a381425 100644 --- a/classstdex_1_1base64__dec-members.html +++ b/classstdex_1_1base64__dec-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1base64__dec.html b/classstdex_1_1base64__dec.html index a912f125c..45172a8e5 100644 --- a/classstdex_1_1base64__dec.html +++ b/classstdex_1_1base64__dec.html @@ -230,7 +230,7 @@ template<class _Ty , class _Ax , class _Tchr > diff --git a/classstdex_1_1base64__enc-members.html b/classstdex_1_1base64__enc-members.html index 5e621e203..d739c2ab0 100644 --- a/classstdex_1_1base64__enc-members.html +++ b/classstdex_1_1base64__enc-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1base64__enc.html b/classstdex_1_1base64__enc.html index 069034538..c95c15d08 100644 --- a/classstdex_1_1base64__enc.html +++ b/classstdex_1_1base64__enc.html @@ -235,7 +235,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classstdex_1_1charset__encoder-members.html b/classstdex_1_1charset__encoder-members.html index ba5b42275..0fe0bf116 100644 --- a/classstdex_1_1charset__encoder-members.html +++ b/classstdex_1_1charset__encoder-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1charset__encoder.html b/classstdex_1_1charset__encoder.html index cc98902e1..ded249a12 100644 --- a/classstdex_1_1charset__encoder.html +++ b/classstdex_1_1charset__encoder.html @@ -595,7 +595,7 @@ template<class _Traits_to = std::char_traits<T_to>, class _Alloc_to = diff --git a/classstdex_1_1errno__error-members.html b/classstdex_1_1errno__error-members.html index 192c8371c..4b08c38bd 100644 --- a/classstdex_1_1errno__error-members.html +++ b/classstdex_1_1errno__error-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1errno__error.html b/classstdex_1_1errno__error.html index 3ccefc9e3..a2b9bd054 100644 --- a/classstdex_1_1errno__error.html +++ b/classstdex_1_1errno__error.html @@ -286,7 +286,7 @@ errno_t m_num diff --git a/classstdex_1_1global__progress-members.html b/classstdex_1_1global__progress-members.html index bfb953d22..da904558c 100644 --- a/classstdex_1_1global__progress-members.html +++ b/classstdex_1_1global__progress-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1global__progress.html b/classstdex_1_1global__progress.html index 26bccd552..3a1d47e5d 100644 --- a/classstdex_1_1global__progress.html +++ b/classstdex_1_1global__progress.html @@ -547,7 +547,7 @@ template<class T > diff --git a/classstdex_1_1hex__dec-members.html b/classstdex_1_1hex__dec-members.html index 0ce222e6b..7638eb6d1 100644 --- a/classstdex_1_1hex__dec-members.html +++ b/classstdex_1_1hex__dec-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1hex__dec.html b/classstdex_1_1hex__dec.html index 2e5245922..b29e4df03 100644 --- a/classstdex_1_1hex__dec.html +++ b/classstdex_1_1hex__dec.html @@ -221,7 +221,7 @@ template<class _Ty , class _Ax , class _Tchr > diff --git a/classstdex_1_1hex__enc-members.html b/classstdex_1_1hex__enc-members.html index ba5856e05..dff2a721d 100644 --- a/classstdex_1_1hex__enc-members.html +++ b/classstdex_1_1hex__enc-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classstdex_1_1hex__enc.html b/classstdex_1_1hex__enc.html index 98b9ea571..5a8db092f 100644 --- a/classstdex_1_1hex__enc.html +++ b/classstdex_1_1hex__enc.html @@ -198,7 +198,7 @@ template<class _Elem , class _Traits , class _Ax > diff --git a/classstdex_1_1idrec_1_1record-members.html b/classstdex_1_1idrec_1_1record-members.html index f66dc710f..da382f386 100644 --- a/classstdex_1_1idrec_1_1record-members.html +++ b/classstdex_1_1idrec_1_1record-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1idrec_1_1record.html b/classstdex_1_1idrec_1_1record.html index a89b6eac3..6db134a72 100644 --- a/classstdex_1_1idrec_1_1record.html +++ b/classstdex_1_1idrec_1_1record.html @@ -526,7 +526,7 @@ template<class T , class T_ID , const T_ID ID, class T_SIZE , unsigned int AL diff --git a/classstdex_1_1lazy__progress-members.html b/classstdex_1_1lazy__progress-members.html index e9a4b55a1..b5e321cd0 100644 --- a/classstdex_1_1lazy__progress-members.html +++ b/classstdex_1_1lazy__progress-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1lazy__progress.html b/classstdex_1_1lazy__progress.html index 8ea2c40f8..0347462c9 100644 --- a/classstdex_1_1lazy__progress.html +++ b/classstdex_1_1lazy__progress.html @@ -279,7 +279,7 @@ template<class T > diff --git a/classstdex_1_1parser_1_1basic__angle-members.html b/classstdex_1_1parser_1_1basic__angle-members.html index d1afbd324..e552bdd3e 100644 --- a/classstdex_1_1parser_1_1basic__angle-members.html +++ b/classstdex_1_1parser_1_1basic__angle-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__angle.html b/classstdex_1_1parser_1_1basic__angle.html index c9c4379c8..e36edd398 100644 --- a/classstdex_1_1parser_1_1basic__angle.html +++ b/classstdex_1_1parser_1_1basic__angle.html @@ -244,7 +244,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__any__cu-members.html b/classstdex_1_1parser_1_1basic__any__cu-members.html index 7aac4d47d..53c8801b5 100644 --- a/classstdex_1_1parser_1_1basic__any__cu-members.html +++ b/classstdex_1_1parser_1_1basic__any__cu-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__any__cu.html b/classstdex_1_1parser_1_1basic__any__cu.html index 947deee2f..d6291f8da 100644 --- a/classstdex_1_1parser_1_1basic__any__cu.html +++ b/classstdex_1_1parser_1_1basic__any__cu.html @@ -191,7 +191,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__bol-members.html b/classstdex_1_1parser_1_1basic__bol-members.html index dd320e8d6..ef5df4eb6 100644 --- a/classstdex_1_1parser_1_1basic__bol-members.html +++ b/classstdex_1_1parser_1_1basic__bol-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__bol.html b/classstdex_1_1parser_1_1basic__bol.html index b45069ac5..096ad9c83 100644 --- a/classstdex_1_1parser_1_1basic__bol.html +++ b/classstdex_1_1parser_1_1basic__bol.html @@ -198,7 +198,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__branch-members.html b/classstdex_1_1parser_1_1basic__branch-members.html index cc4cc84dc..4d736e068 100644 --- a/classstdex_1_1parser_1_1basic__branch-members.html +++ b/classstdex_1_1parser_1_1basic__branch-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__branch.html b/classstdex_1_1parser_1_1basic__branch.html index 4b327023b..d099848aa 100644 --- a/classstdex_1_1parser_1_1basic__branch.html +++ b/classstdex_1_1parser_1_1basic__branch.html @@ -253,7 +253,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__chemical__formula-members.html b/classstdex_1_1parser_1_1basic__chemical__formula-members.html index 35acd2c11..aff6ed823 100644 --- a/classstdex_1_1parser_1_1basic__chemical__formula-members.html +++ b/classstdex_1_1parser_1_1basic__chemical__formula-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__chemical__formula.html b/classstdex_1_1parser_1_1basic__chemical__formula.html index 9ccceea9c..f72f57f3d 100644 --- a/classstdex_1_1parser_1_1basic__chemical__formula.html +++ b/classstdex_1_1parser_1_1basic__chemical__formula.html @@ -239,7 +239,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__creditor__reference-members.html b/classstdex_1_1parser_1_1basic__creditor__reference-members.html index 8de7895b1..192201692 100644 --- a/classstdex_1_1parser_1_1basic__creditor__reference-members.html +++ b/classstdex_1_1parser_1_1basic__creditor__reference-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__creditor__reference.html b/classstdex_1_1parser_1_1basic__creditor__reference.html index d7a4a4ceb..609b0712e 100644 --- a/classstdex_1_1parser_1_1basic__creditor__reference.html +++ b/classstdex_1_1parser_1_1basic__creditor__reference.html @@ -240,7 +240,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__cu-members.html b/classstdex_1_1parser_1_1basic__cu-members.html index 48f96518a..f4dae879c 100644 --- a/classstdex_1_1parser_1_1basic__cu-members.html +++ b/classstdex_1_1parser_1_1basic__cu-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__cu.html b/classstdex_1_1parser_1_1basic__cu.html index 061d83498..cce88b86e 100644 --- a/classstdex_1_1parser_1_1basic__cu.html +++ b/classstdex_1_1parser_1_1basic__cu.html @@ -201,7 +201,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__cu__set-members.html b/classstdex_1_1parser_1_1basic__cu__set-members.html index 3354ee03c..cff1a40d7 100644 --- a/classstdex_1_1parser_1_1basic__cu__set-members.html +++ b/classstdex_1_1parser_1_1basic__cu__set-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__cu__set.html b/classstdex_1_1parser_1_1basic__cu__set.html index 64205acc7..d907a2302 100644 --- a/classstdex_1_1parser_1_1basic__cu__set.html +++ b/classstdex_1_1parser_1_1basic__cu__set.html @@ -210,7 +210,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__date-members.html b/classstdex_1_1parser_1_1basic__date-members.html index 1b475f6cb..4bc7e2e67 100644 --- a/classstdex_1_1parser_1_1basic__date-members.html +++ b/classstdex_1_1parser_1_1basic__date-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__date.html b/classstdex_1_1parser_1_1basic__date.html index 7cd8bbb08..1ae788c6c 100644 --- a/classstdex_1_1parser_1_1basic__date.html +++ b/classstdex_1_1parser_1_1basic__date.html @@ -252,7 +252,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__dns__domain__char-members.html b/classstdex_1_1parser_1_1basic__dns__domain__char-members.html index 75340ab94..fa40beaff 100644 --- a/classstdex_1_1parser_1_1basic__dns__domain__char-members.html +++ b/classstdex_1_1parser_1_1basic__dns__domain__char-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__dns__domain__char.html b/classstdex_1_1parser_1_1basic__dns__domain__char.html index 7d5bf3d79..c11e29401 100644 --- a/classstdex_1_1parser_1_1basic__dns__domain__char.html +++ b/classstdex_1_1parser_1_1basic__dns__domain__char.html @@ -203,7 +203,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__dns__name-members.html b/classstdex_1_1parser_1_1basic__dns__name-members.html index 27260aa65..901d08388 100644 --- a/classstdex_1_1parser_1_1basic__dns__name-members.html +++ b/classstdex_1_1parser_1_1basic__dns__name-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__dns__name.html b/classstdex_1_1parser_1_1basic__dns__name.html index f62a4bd18..de54c2eaa 100644 --- a/classstdex_1_1parser_1_1basic__dns__name.html +++ b/classstdex_1_1parser_1_1basic__dns__name.html @@ -205,7 +205,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__email__address-members.html b/classstdex_1_1parser_1_1basic__email__address-members.html index 32e2c9bed..a55b844c9 100644 --- a/classstdex_1_1parser_1_1basic__email__address-members.html +++ b/classstdex_1_1parser_1_1basic__email__address-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__email__address.html b/classstdex_1_1parser_1_1basic__email__address.html index 7cd6d7e8f..e346f5566 100644 --- a/classstdex_1_1parser_1_1basic__email__address.html +++ b/classstdex_1_1parser_1_1basic__email__address.html @@ -245,7 +245,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__emoticon-members.html b/classstdex_1_1parser_1_1basic__emoticon-members.html index 7647544d4..44e855136 100644 --- a/classstdex_1_1parser_1_1basic__emoticon-members.html +++ b/classstdex_1_1parser_1_1basic__emoticon-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__emoticon.html b/classstdex_1_1parser_1_1basic__emoticon.html index ad75f6cbc..cb228fe68 100644 --- a/classstdex_1_1parser_1_1basic__emoticon.html +++ b/classstdex_1_1parser_1_1basic__emoticon.html @@ -243,7 +243,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__eol-members.html b/classstdex_1_1parser_1_1basic__eol-members.html index 97dd65617..6cf50ef8a 100644 --- a/classstdex_1_1parser_1_1basic__eol-members.html +++ b/classstdex_1_1parser_1_1basic__eol-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__eol.html b/classstdex_1_1parser_1_1basic__eol.html index 9047cae69..1bffb2b7c 100644 --- a/classstdex_1_1parser_1_1basic__eol.html +++ b/classstdex_1_1parser_1_1basic__eol.html @@ -198,7 +198,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__fraction-members.html b/classstdex_1_1parser_1_1basic__fraction-members.html index 6a4b32cd6..8869494e2 100644 --- a/classstdex_1_1parser_1_1basic__fraction-members.html +++ b/classstdex_1_1parser_1_1basic__fraction-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__fraction.html b/classstdex_1_1parser_1_1basic__fraction.html index d10883b1c..2cf7c09a4 100644 --- a/classstdex_1_1parser_1_1basic__fraction.html +++ b/classstdex_1_1parser_1_1basic__fraction.html @@ -232,7 +232,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__iban-members.html b/classstdex_1_1parser_1_1basic__iban-members.html index 7cca00fb8..53a4291c7 100644 --- a/classstdex_1_1parser_1_1basic__iban-members.html +++ b/classstdex_1_1parser_1_1basic__iban-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__iban.html b/classstdex_1_1parser_1_1basic__iban.html index 55cd252de..7fe03e033 100644 --- a/classstdex_1_1parser_1_1basic__iban.html +++ b/classstdex_1_1parser_1_1basic__iban.html @@ -244,7 +244,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer-members.html b/classstdex_1_1parser_1_1basic__integer-members.html index 9db610331..87f7f0367 100644 --- a/classstdex_1_1parser_1_1basic__integer-members.html +++ b/classstdex_1_1parser_1_1basic__integer-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer.html b/classstdex_1_1parser_1_1basic__integer.html index 11ed4e28a..1e41f15a7 100644 --- a/classstdex_1_1parser_1_1basic__integer.html +++ b/classstdex_1_1parser_1_1basic__integer.html @@ -180,7 +180,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer10-members.html b/classstdex_1_1parser_1_1basic__integer10-members.html index e45bb13ba..8cb3dcbed 100644 --- a/classstdex_1_1parser_1_1basic__integer10-members.html +++ b/classstdex_1_1parser_1_1basic__integer10-members.html @@ -104,7 +104,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer10.html b/classstdex_1_1parser_1_1basic__integer10.html index 7b9596121..af089543c 100644 --- a/classstdex_1_1parser_1_1basic__integer10.html +++ b/classstdex_1_1parser_1_1basic__integer10.html @@ -234,7 +234,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer10ts-members.html b/classstdex_1_1parser_1_1basic__integer10ts-members.html index 5b15c96ab..84d849276 100644 --- a/classstdex_1_1parser_1_1basic__integer10ts-members.html +++ b/classstdex_1_1parser_1_1basic__integer10ts-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer10ts.html b/classstdex_1_1parser_1_1basic__integer10ts.html index 9f502658c..8cc8b5485 100644 --- a/classstdex_1_1parser_1_1basic__integer10ts.html +++ b/classstdex_1_1parser_1_1basic__integer10ts.html @@ -248,7 +248,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer16-members.html b/classstdex_1_1parser_1_1basic__integer16-members.html index 9e955d0c6..a1bbeea2b 100644 --- a/classstdex_1_1parser_1_1basic__integer16-members.html +++ b/classstdex_1_1parser_1_1basic__integer16-members.html @@ -110,7 +110,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer16.html b/classstdex_1_1parser_1_1basic__integer16.html index 0306eb687..2e4d18b40 100644 --- a/classstdex_1_1parser_1_1basic__integer16.html +++ b/classstdex_1_1parser_1_1basic__integer16.html @@ -252,7 +252,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__ipv4__address-members.html b/classstdex_1_1parser_1_1basic__ipv4__address-members.html index 80a01bf21..4ccaa98aa 100644 --- a/classstdex_1_1parser_1_1basic__ipv4__address-members.html +++ b/classstdex_1_1parser_1_1basic__ipv4__address-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__ipv4__address.html b/classstdex_1_1parser_1_1basic__ipv4__address.html index 8a7b5ca6e..36a314329 100644 --- a/classstdex_1_1parser_1_1basic__ipv4__address.html +++ b/classstdex_1_1parser_1_1basic__ipv4__address.html @@ -265,7 +265,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__ipv6__address-members.html b/classstdex_1_1parser_1_1basic__ipv6__address-members.html index e28f76c59..062b594a3 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__address-members.html +++ b/classstdex_1_1parser_1_1basic__ipv6__address-members.html @@ -113,7 +113,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__ipv6__address.html b/classstdex_1_1parser_1_1basic__ipv6__address.html index 71d4f1b03..2a19f4607 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__address.html +++ b/classstdex_1_1parser_1_1basic__ipv6__address.html @@ -290,7 +290,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__ipv6__scope__id__char-members.html b/classstdex_1_1parser_1_1basic__ipv6__scope__id__char-members.html index 934f2d7ef..1380a4ddb 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__scope__id__char-members.html +++ b/classstdex_1_1parser_1_1basic__ipv6__scope__id__char-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__ipv6__scope__id__char.html b/classstdex_1_1parser_1_1basic__ipv6__scope__id__char.html index ef6afd2e1..9f687cecb 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__scope__id__char.html +++ b/classstdex_1_1parser_1_1basic__ipv6__scope__id__char.html @@ -191,7 +191,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__iterations-members.html b/classstdex_1_1parser_1_1basic__iterations-members.html index eac7726e2..e9d5d25a2 100644 --- a/classstdex_1_1parser_1_1basic__iterations-members.html +++ b/classstdex_1_1parser_1_1basic__iterations-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__iterations.html b/classstdex_1_1parser_1_1basic__iterations.html index 82655327f..d15c88c0b 100644 --- a/classstdex_1_1parser_1_1basic__iterations.html +++ b/classstdex_1_1parser_1_1basic__iterations.html @@ -211,7 +211,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__json__string-members.html b/classstdex_1_1parser_1_1basic__json__string-members.html index 7eb7f1f9e..6bd33b974 100644 --- a/classstdex_1_1parser_1_1basic__json__string-members.html +++ b/classstdex_1_1parser_1_1basic__json__string-members.html @@ -104,7 +104,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__json__string.html b/classstdex_1_1parser_1_1basic__json__string.html index 95308b598..df4b3fb25 100644 --- a/classstdex_1_1parser_1_1basic__json__string.html +++ b/classstdex_1_1parser_1_1basic__json__string.html @@ -260,7 +260,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__mixed__numeral-members.html b/classstdex_1_1parser_1_1basic__mixed__numeral-members.html index b53a071a2..d8657ada1 100644 --- a/classstdex_1_1parser_1_1basic__mixed__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__mixed__numeral-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__mixed__numeral.html b/classstdex_1_1parser_1_1basic__mixed__numeral.html index fbf597185..5f177b194 100644 --- a/classstdex_1_1parser_1_1basic__mixed__numeral.html +++ b/classstdex_1_1parser_1_1basic__mixed__numeral.html @@ -247,7 +247,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__monetary__numeral-members.html b/classstdex_1_1parser_1_1basic__monetary__numeral-members.html index 8d1b4585a..9104b3895 100644 --- a/classstdex_1_1parser_1_1basic__monetary__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__monetary__numeral-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__monetary__numeral.html b/classstdex_1_1parser_1_1basic__monetary__numeral.html index e9292ec03..8df78f525 100644 --- a/classstdex_1_1parser_1_1basic__monetary__numeral.html +++ b/classstdex_1_1parser_1_1basic__monetary__numeral.html @@ -251,7 +251,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__noop-members.html b/classstdex_1_1parser_1_1basic__noop-members.html index f850b3718..7369ec102 100644 --- a/classstdex_1_1parser_1_1basic__noop-members.html +++ b/classstdex_1_1parser_1_1basic__noop-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__noop.html b/classstdex_1_1parser_1_1basic__noop.html index 38fe19579..0572c2acc 100644 --- a/classstdex_1_1parser_1_1basic__noop.html +++ b/classstdex_1_1parser_1_1basic__noop.html @@ -188,7 +188,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__parser-members.html b/classstdex_1_1parser_1_1basic__parser-members.html index 4d4cea04c..3c1335d90 100644 --- a/classstdex_1_1parser_1_1basic__parser-members.html +++ b/classstdex_1_1parser_1_1basic__parser-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__parser.html b/classstdex_1_1parser_1_1basic__parser.html index d80dfcff7..ae743adb3 100644 --- a/classstdex_1_1parser_1_1basic__parser.html +++ b/classstdex_1_1parser_1_1basic__parser.html @@ -188,7 +188,7 @@ class stdex::parser::basic_parser< T >

Base template for all parse

diff --git a/classstdex_1_1parser_1_1basic__permutation-members.html b/classstdex_1_1parser_1_1basic__permutation-members.html index c0f0bdcb6..7fbd84460 100644 --- a/classstdex_1_1parser_1_1basic__permutation-members.html +++ b/classstdex_1_1parser_1_1basic__permutation-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__permutation.html b/classstdex_1_1parser_1_1basic__permutation.html index 0b267be96..0d64e44cc 100644 --- a/classstdex_1_1parser_1_1basic__permutation.html +++ b/classstdex_1_1parser_1_1basic__permutation.html @@ -216,7 +216,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__phone__number-members.html b/classstdex_1_1parser_1_1basic__phone__number-members.html index 044d17fb1..47c34a200 100644 --- a/classstdex_1_1parser_1_1basic__phone__number-members.html +++ b/classstdex_1_1parser_1_1basic__phone__number-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__phone__number.html b/classstdex_1_1parser_1_1basic__phone__number.html index a5730270a..d90b58797 100644 --- a/classstdex_1_1parser_1_1basic__phone__number.html +++ b/classstdex_1_1parser_1_1basic__phone__number.html @@ -246,7 +246,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__punct__cu-members.html b/classstdex_1_1parser_1_1basic__punct__cu-members.html index de8719713..0b808c68e 100644 --- a/classstdex_1_1parser_1_1basic__punct__cu-members.html +++ b/classstdex_1_1parser_1_1basic__punct__cu-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__punct__cu.html b/classstdex_1_1parser_1_1basic__punct__cu.html index e25ff542a..cc829901b 100644 --- a/classstdex_1_1parser_1_1basic__punct__cu.html +++ b/classstdex_1_1parser_1_1basic__punct__cu.html @@ -198,7 +198,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__roman__numeral-members.html b/classstdex_1_1parser_1_1basic__roman__numeral-members.html index 428ee8640..2fdb229a1 100644 --- a/classstdex_1_1parser_1_1basic__roman__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__roman__numeral-members.html @@ -103,7 +103,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__roman__numeral.html b/classstdex_1_1parser_1_1basic__roman__numeral.html index edc134c86..df75a06c2 100644 --- a/classstdex_1_1parser_1_1basic__roman__numeral.html +++ b/classstdex_1_1parser_1_1basic__roman__numeral.html @@ -231,7 +231,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__scientific__numeral-members.html b/classstdex_1_1parser_1_1basic__scientific__numeral-members.html index a6e90b77d..d0c48333d 100644 --- a/classstdex_1_1parser_1_1basic__scientific__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__scientific__numeral-members.html @@ -103,7 +103,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__scientific__numeral.html b/classstdex_1_1parser_1_1basic__scientific__numeral.html index 55721a158..cc5c71f75 100644 --- a/classstdex_1_1parser_1_1basic__scientific__numeral.html +++ b/classstdex_1_1parser_1_1basic__scientific__numeral.html @@ -267,7 +267,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__score-members.html b/classstdex_1_1parser_1_1basic__score-members.html index 34ab4e50b..5f996cad0 100644 --- a/classstdex_1_1parser_1_1basic__score-members.html +++ b/classstdex_1_1parser_1_1basic__score-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__score.html b/classstdex_1_1parser_1_1basic__score.html index d97780a7a..a081aa189 100644 --- a/classstdex_1_1parser_1_1basic__score.html +++ b/classstdex_1_1parser_1_1basic__score.html @@ -236,7 +236,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__sequence-members.html b/classstdex_1_1parser_1_1basic__sequence-members.html index 5ed9ca941..1239e6242 100644 --- a/classstdex_1_1parser_1_1basic__sequence-members.html +++ b/classstdex_1_1parser_1_1basic__sequence-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__sequence.html b/classstdex_1_1parser_1_1basic__sequence.html index 679e56f33..be3801074 100644 --- a/classstdex_1_1parser_1_1basic__sequence.html +++ b/classstdex_1_1parser_1_1basic__sequence.html @@ -209,7 +209,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__set-members.html b/classstdex_1_1parser_1_1basic__set-members.html index 732078f1c..c205d591b 100644 --- a/classstdex_1_1parser_1_1basic__set-members.html +++ b/classstdex_1_1parser_1_1basic__set-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__set.html b/classstdex_1_1parser_1_1basic__set.html index 401213f2c..8caf19e2d 100644 --- a/classstdex_1_1parser_1_1basic__set.html +++ b/classstdex_1_1parser_1_1basic__set.html @@ -223,7 +223,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__si__reference-members.html b/classstdex_1_1parser_1_1basic__si__reference-members.html index a57ef0a02..11343b139 100644 --- a/classstdex_1_1parser_1_1basic__si__reference-members.html +++ b/classstdex_1_1parser_1_1basic__si__reference-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__si__reference.html b/classstdex_1_1parser_1_1basic__si__reference.html index 05f62bfb4..7bf98cc5a 100644 --- a/classstdex_1_1parser_1_1basic__si__reference.html +++ b/classstdex_1_1parser_1_1basic__si__reference.html @@ -265,7 +265,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__si__reference__delimiter-members.html b/classstdex_1_1parser_1_1basic__si__reference__delimiter-members.html index a8f225fec..af8771f1f 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__delimiter-members.html +++ b/classstdex_1_1parser_1_1basic__si__reference__delimiter-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__si__reference__delimiter.html b/classstdex_1_1parser_1_1basic__si__reference__delimiter.html index 896e9be88..16beb760f 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__delimiter.html +++ b/classstdex_1_1parser_1_1basic__si__reference__delimiter.html @@ -192,7 +192,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__si__reference__part-members.html b/classstdex_1_1parser_1_1basic__si__reference__part-members.html index 4fd18ea1f..8bb500ac9 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__part-members.html +++ b/classstdex_1_1parser_1_1basic__si__reference__part-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__si__reference__part.html b/classstdex_1_1parser_1_1basic__si__reference__part.html index f5b3bc48a..3661d4f87 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__part.html +++ b/classstdex_1_1parser_1_1basic__si__reference__part.html @@ -192,7 +192,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__signed__numeral-members.html b/classstdex_1_1parser_1_1basic__signed__numeral-members.html index a8e0b0c14..653d04a95 100644 --- a/classstdex_1_1parser_1_1basic__signed__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__signed__numeral-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__signed__numeral.html b/classstdex_1_1parser_1_1basic__signed__numeral.html index 127f47a5a..294c83fd2 100644 --- a/classstdex_1_1parser_1_1basic__signed__numeral.html +++ b/classstdex_1_1parser_1_1basic__signed__numeral.html @@ -239,7 +239,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__space__cu-members.html b/classstdex_1_1parser_1_1basic__space__cu-members.html index 27e5ec950..846d12c66 100644 --- a/classstdex_1_1parser_1_1basic__space__cu-members.html +++ b/classstdex_1_1parser_1_1basic__space__cu-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__space__cu.html b/classstdex_1_1parser_1_1basic__space__cu.html index 001bd0909..eae5a1587 100644 --- a/classstdex_1_1parser_1_1basic__space__cu.html +++ b/classstdex_1_1parser_1_1basic__space__cu.html @@ -198,7 +198,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__space__or__punct__cu-members.html b/classstdex_1_1parser_1_1basic__space__or__punct__cu-members.html index ad51c68dd..a8617a592 100644 --- a/classstdex_1_1parser_1_1basic__space__or__punct__cu-members.html +++ b/classstdex_1_1parser_1_1basic__space__or__punct__cu-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__space__or__punct__cu.html b/classstdex_1_1parser_1_1basic__space__or__punct__cu.html index 8a4e08104..465d9f393 100644 --- a/classstdex_1_1parser_1_1basic__space__or__punct__cu.html +++ b/classstdex_1_1parser_1_1basic__space__or__punct__cu.html @@ -198,7 +198,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__string-members.html b/classstdex_1_1parser_1_1basic__string-members.html index d7649392c..ff8bb99da 100644 --- a/classstdex_1_1parser_1_1basic__string-members.html +++ b/classstdex_1_1parser_1_1basic__string-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__string.html b/classstdex_1_1parser_1_1basic__string.html index 717177212..b33595ef7 100644 --- a/classstdex_1_1parser_1_1basic__string.html +++ b/classstdex_1_1parser_1_1basic__string.html @@ -198,7 +198,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__string__branch-members.html b/classstdex_1_1parser_1_1basic__string__branch-members.html index 4447b5b10..12d9b1730 100644 --- a/classstdex_1_1parser_1_1basic__string__branch-members.html +++ b/classstdex_1_1parser_1_1basic__string__branch-members.html @@ -104,7 +104,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__string__branch.html b/classstdex_1_1parser_1_1basic__string__branch.html index 114448fbd..7f5339c0e 100644 --- a/classstdex_1_1parser_1_1basic__string__branch.html +++ b/classstdex_1_1parser_1_1basic__string__branch.html @@ -185,7 +185,7 @@ class stdex::parser::basic_string_branch< T, T_parser >

Test for a

diff --git a/classstdex_1_1parser_1_1basic__time-members.html b/classstdex_1_1parser_1_1basic__time-members.html index 2bdb6448f..7dbada0ac 100644 --- a/classstdex_1_1parser_1_1basic__time-members.html +++ b/classstdex_1_1parser_1_1basic__time-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__time.html b/classstdex_1_1parser_1_1basic__time.html index 3cb922a3d..9f573c350 100644 --- a/classstdex_1_1parser_1_1basic__time.html +++ b/classstdex_1_1parser_1_1basic__time.html @@ -242,7 +242,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__url-members.html b/classstdex_1_1parser_1_1basic__url-members.html index 8fc11d236..658798790 100644 --- a/classstdex_1_1parser_1_1basic__url-members.html +++ b/classstdex_1_1parser_1_1basic__url-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url.html b/classstdex_1_1parser_1_1basic__url.html index 5cfa63e57..3595b9a2d 100644 --- a/classstdex_1_1parser_1_1basic__url.html +++ b/classstdex_1_1parser_1_1basic__url.html @@ -272,7 +272,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__url__password__char-members.html b/classstdex_1_1parser_1_1basic__url__password__char-members.html index 00ccc103f..ebb82bd00 100644 --- a/classstdex_1_1parser_1_1basic__url__password__char-members.html +++ b/classstdex_1_1parser_1_1basic__url__password__char-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url__password__char.html b/classstdex_1_1parser_1_1basic__url__password__char.html index 85142c0fb..b7f7e85a7 100644 --- a/classstdex_1_1parser_1_1basic__url__password__char.html +++ b/classstdex_1_1parser_1_1basic__url__password__char.html @@ -191,7 +191,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__url__path-members.html b/classstdex_1_1parser_1_1basic__url__path-members.html index 8e7689dbd..c6db9135d 100644 --- a/classstdex_1_1parser_1_1basic__url__path-members.html +++ b/classstdex_1_1parser_1_1basic__url__path-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url__path.html b/classstdex_1_1parser_1_1basic__url__path.html index 3aca37134..039ad6c90 100644 --- a/classstdex_1_1parser_1_1basic__url__path.html +++ b/classstdex_1_1parser_1_1basic__url__path.html @@ -242,7 +242,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__url__path__char-members.html b/classstdex_1_1parser_1_1basic__url__path__char-members.html index 736e12ba1..c6914a887 100644 --- a/classstdex_1_1parser_1_1basic__url__path__char-members.html +++ b/classstdex_1_1parser_1_1basic__url__path__char-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url__path__char.html b/classstdex_1_1parser_1_1basic__url__path__char.html index 584f80f23..3573d0d01 100644 --- a/classstdex_1_1parser_1_1basic__url__path__char.html +++ b/classstdex_1_1parser_1_1basic__url__path__char.html @@ -191,7 +191,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__url__username__char-members.html b/classstdex_1_1parser_1_1basic__url__username__char-members.html index 23fcf6ebb..55a6cc846 100644 --- a/classstdex_1_1parser_1_1basic__url__username__char-members.html +++ b/classstdex_1_1parser_1_1basic__url__username__char-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url__username__char.html b/classstdex_1_1parser_1_1basic__url__username__char.html index 6d9de2246..f775b07e2 100644 --- a/classstdex_1_1parser_1_1basic__url__username__char.html +++ b/classstdex_1_1parser_1_1basic__url__username__char.html @@ -191,7 +191,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1http__agent-members.html b/classstdex_1_1parser_1_1http__agent-members.html index 9eb1222d5..025942dfe 100644 --- a/classstdex_1_1parser_1_1http__agent-members.html +++ b/classstdex_1_1parser_1_1http__agent-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__agent.html b/classstdex_1_1parser_1_1http__agent.html index d65e18596..130a9a1c2 100644 --- a/classstdex_1_1parser_1_1http__agent.html +++ b/classstdex_1_1parser_1_1http__agent.html @@ -220,7 +220,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__any__type-members.html b/classstdex_1_1parser_1_1http__any__type-members.html index ab5bcb132..bcf1ff587 100644 --- a/classstdex_1_1parser_1_1http__any__type-members.html +++ b/classstdex_1_1parser_1_1http__any__type-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__any__type.html b/classstdex_1_1parser_1_1http__any__type.html index 13974b3ba..df67ab0c4 100644 --- a/classstdex_1_1parser_1_1http__any__type.html +++ b/classstdex_1_1parser_1_1http__any__type.html @@ -184,7 +184,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__asterisk-members.html b/classstdex_1_1parser_1_1http__asterisk-members.html index 9976083ed..4bfc7edf9 100644 --- a/classstdex_1_1parser_1_1http__asterisk-members.html +++ b/classstdex_1_1parser_1_1http__asterisk-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__asterisk.html b/classstdex_1_1parser_1_1http__asterisk.html index b0cdd4a50..6315c4729 100644 --- a/classstdex_1_1parser_1_1http__asterisk.html +++ b/classstdex_1_1parser_1_1http__asterisk.html @@ -184,7 +184,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__cookie-members.html b/classstdex_1_1parser_1_1http__cookie-members.html index dbbdc49a5..fe69208a3 100644 --- a/classstdex_1_1parser_1_1http__cookie-members.html +++ b/classstdex_1_1parser_1_1http__cookie-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__cookie.html b/classstdex_1_1parser_1_1http__cookie.html index 250b0fb5b..089c96970 100644 --- a/classstdex_1_1parser_1_1http__cookie.html +++ b/classstdex_1_1parser_1_1http__cookie.html @@ -230,7 +230,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__cookie__parameter-members.html b/classstdex_1_1parser_1_1http__cookie__parameter-members.html index 082c4e0dc..fdd5e64d2 100644 --- a/classstdex_1_1parser_1_1http__cookie__parameter-members.html +++ b/classstdex_1_1parser_1_1http__cookie__parameter-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__cookie__parameter.html b/classstdex_1_1parser_1_1http__cookie__parameter.html index 946096880..2a3388ded 100644 --- a/classstdex_1_1parser_1_1http__cookie__parameter.html +++ b/classstdex_1_1parser_1_1http__cookie__parameter.html @@ -224,7 +224,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__header-members.html b/classstdex_1_1parser_1_1http__header-members.html index 62ac2fe2a..cdf1f15d1 100644 --- a/classstdex_1_1parser_1_1http__header-members.html +++ b/classstdex_1_1parser_1_1http__header-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__header.html b/classstdex_1_1parser_1_1http__header.html index 7e4fd0368..6c6852c80 100644 --- a/classstdex_1_1parser_1_1http__header.html +++ b/classstdex_1_1parser_1_1http__header.html @@ -224,7 +224,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__language-members.html b/classstdex_1_1parser_1_1http__language-members.html index fe4531fb3..56ab959cf 100644 --- a/classstdex_1_1parser_1_1http__language-members.html +++ b/classstdex_1_1parser_1_1http__language-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__language.html b/classstdex_1_1parser_1_1http__language.html index 8fc92f761..6706ef659 100644 --- a/classstdex_1_1parser_1_1http__language.html +++ b/classstdex_1_1parser_1_1http__language.html @@ -217,7 +217,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__line__break-members.html b/classstdex_1_1parser_1_1http__line__break-members.html index 692cc1577..2c69370d2 100644 --- a/classstdex_1_1parser_1_1http__line__break-members.html +++ b/classstdex_1_1parser_1_1http__line__break-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__line__break.html b/classstdex_1_1parser_1_1http__line__break.html index e61608c72..ec30e55ed 100644 --- a/classstdex_1_1parser_1_1http__line__break.html +++ b/classstdex_1_1parser_1_1http__line__break.html @@ -184,7 +184,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__media__range-members.html b/classstdex_1_1parser_1_1http__media__range-members.html index 8627357b3..bf34443b2 100644 --- a/classstdex_1_1parser_1_1http__media__range-members.html +++ b/classstdex_1_1parser_1_1http__media__range-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__media__range.html b/classstdex_1_1parser_1_1http__media__range.html index b9a131779..c7e727c75 100644 --- a/classstdex_1_1parser_1_1http__media__range.html +++ b/classstdex_1_1parser_1_1http__media__range.html @@ -225,7 +225,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__media__type-members.html b/classstdex_1_1parser_1_1http__media__type-members.html index 1e969212e..3fc20509e 100644 --- a/classstdex_1_1parser_1_1http__media__type-members.html +++ b/classstdex_1_1parser_1_1http__media__type-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__media__type.html b/classstdex_1_1parser_1_1http__media__type.html index aab3fb23c..fc5cfb8cd 100644 --- a/classstdex_1_1parser_1_1http__media__type.html +++ b/classstdex_1_1parser_1_1http__media__type.html @@ -229,7 +229,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__parameter-members.html b/classstdex_1_1parser_1_1http__parameter-members.html index 4d9ec5362..5ba9c0424 100644 --- a/classstdex_1_1parser_1_1http__parameter-members.html +++ b/classstdex_1_1parser_1_1http__parameter-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__parameter.html b/classstdex_1_1parser_1_1http__parameter.html index 49e81f6f2..62fc2dd54 100644 --- a/classstdex_1_1parser_1_1http__parameter.html +++ b/classstdex_1_1parser_1_1http__parameter.html @@ -226,7 +226,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__protocol-members.html b/classstdex_1_1parser_1_1http__protocol-members.html index ece1b1103..b334383f7 100644 --- a/classstdex_1_1parser_1_1http__protocol-members.html +++ b/classstdex_1_1parser_1_1http__protocol-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__protocol.html b/classstdex_1_1parser_1_1http__protocol.html index 5c3a8e15c..15631c187 100644 --- a/classstdex_1_1parser_1_1http__protocol.html +++ b/classstdex_1_1parser_1_1http__protocol.html @@ -230,7 +230,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__quoted__string-members.html b/classstdex_1_1parser_1_1http__quoted__string-members.html index a9932e6b3..e1e2dedc7 100644 --- a/classstdex_1_1parser_1_1http__quoted__string-members.html +++ b/classstdex_1_1parser_1_1http__quoted__string-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__quoted__string.html b/classstdex_1_1parser_1_1http__quoted__string.html index 2925ac227..1bafd78d6 100644 --- a/classstdex_1_1parser_1_1http__quoted__string.html +++ b/classstdex_1_1parser_1_1http__quoted__string.html @@ -222,7 +222,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__request-members.html b/classstdex_1_1parser_1_1http__request-members.html index 90fcff5ec..ae5557a3f 100644 --- a/classstdex_1_1parser_1_1http__request-members.html +++ b/classstdex_1_1parser_1_1http__request-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__request.html b/classstdex_1_1parser_1_1http__request.html index a5f662690..68419fe47 100644 --- a/classstdex_1_1parser_1_1http__request.html +++ b/classstdex_1_1parser_1_1http__request.html @@ -230,7 +230,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__space-members.html b/classstdex_1_1parser_1_1http__space-members.html index d53d19f48..c1e42c570 100644 --- a/classstdex_1_1parser_1_1http__space-members.html +++ b/classstdex_1_1parser_1_1http__space-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__space.html b/classstdex_1_1parser_1_1http__space.html index f2ed7ef4d..189c9b921 100644 --- a/classstdex_1_1parser_1_1http__space.html +++ b/classstdex_1_1parser_1_1http__space.html @@ -191,7 +191,7 @@ Additional Inherited Members diff --git a/classstdex_1_1parser_1_1http__text__char-members.html b/classstdex_1_1parser_1_1http__text__char-members.html index 39f778c90..807216695 100644 --- a/classstdex_1_1parser_1_1http__text__char-members.html +++ b/classstdex_1_1parser_1_1http__text__char-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__text__char.html b/classstdex_1_1parser_1_1http__text__char.html index 838770381..8cffb24ce 100644 --- a/classstdex_1_1parser_1_1http__text__char.html +++ b/classstdex_1_1parser_1_1http__text__char.html @@ -191,7 +191,7 @@ Additional Inherited Members diff --git a/classstdex_1_1parser_1_1http__token-members.html b/classstdex_1_1parser_1_1http__token-members.html index b624fc87a..77decfd43 100644 --- a/classstdex_1_1parser_1_1http__token-members.html +++ b/classstdex_1_1parser_1_1http__token-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__token.html b/classstdex_1_1parser_1_1http__token.html index afb41dee8..cf272f145 100644 --- a/classstdex_1_1parser_1_1http__token.html +++ b/classstdex_1_1parser_1_1http__token.html @@ -184,7 +184,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__url-members.html b/classstdex_1_1parser_1_1http__url-members.html index 8b3889a4b..41279054c 100644 --- a/classstdex_1_1parser_1_1http__url-members.html +++ b/classstdex_1_1parser_1_1http__url-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url.html b/classstdex_1_1parser_1_1http__url.html index a07fca2bb..4904a4f82 100644 --- a/classstdex_1_1parser_1_1http__url.html +++ b/classstdex_1_1parser_1_1http__url.html @@ -229,7 +229,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__url__parameter-members.html b/classstdex_1_1parser_1_1http__url__parameter-members.html index ec75042dd..d5d11729c 100644 --- a/classstdex_1_1parser_1_1http__url__parameter-members.html +++ b/classstdex_1_1parser_1_1http__url__parameter-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__parameter.html b/classstdex_1_1parser_1_1http__url__parameter.html index 48c9969b6..eb13898ea 100644 --- a/classstdex_1_1parser_1_1http__url__parameter.html +++ b/classstdex_1_1parser_1_1http__url__parameter.html @@ -220,7 +220,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__url__path-members.html b/classstdex_1_1parser_1_1http__url__path-members.html index 56953ef44..76c45edbf 100644 --- a/classstdex_1_1parser_1_1http__url__path-members.html +++ b/classstdex_1_1parser_1_1http__url__path-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__path.html b/classstdex_1_1parser_1_1http__url__path.html index 66e0d4a17..81233b0a6 100644 --- a/classstdex_1_1parser_1_1http__url__path.html +++ b/classstdex_1_1parser_1_1http__url__path.html @@ -218,7 +218,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__url__path__segment-members.html b/classstdex_1_1parser_1_1http__url__path__segment-members.html index 72e078360..3c8a760dc 100644 --- a/classstdex_1_1parser_1_1http__url__path__segment-members.html +++ b/classstdex_1_1parser_1_1http__url__path__segment-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__path__segment.html b/classstdex_1_1parser_1_1http__url__path__segment.html index ec5fdcb1a..91fd74feb 100644 --- a/classstdex_1_1parser_1_1http__url__path__segment.html +++ b/classstdex_1_1parser_1_1http__url__path__segment.html @@ -184,7 +184,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__url__port-members.html b/classstdex_1_1parser_1_1http__url__port-members.html index 4e811768d..b29f28cc5 100644 --- a/classstdex_1_1parser_1_1http__url__port-members.html +++ b/classstdex_1_1parser_1_1http__url__port-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__port.html b/classstdex_1_1parser_1_1http__url__port.html index 82262ea77..ca49ca5e8 100644 --- a/classstdex_1_1parser_1_1http__url__port.html +++ b/classstdex_1_1parser_1_1http__url__port.html @@ -220,7 +220,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__url__server-members.html b/classstdex_1_1parser_1_1http__url__server-members.html index 374be1dcd..19aaa5415 100644 --- a/classstdex_1_1parser_1_1http__url__server-members.html +++ b/classstdex_1_1parser_1_1http__url__server-members.html @@ -85,7 +85,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__server.html b/classstdex_1_1parser_1_1http__url__server.html index 2108ecf55..9ab6fb7ed 100644 --- a/classstdex_1_1parser_1_1http__url__server.html +++ b/classstdex_1_1parser_1_1http__url__server.html @@ -184,7 +184,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__value-members.html b/classstdex_1_1parser_1_1http__value-members.html index e4c7be808..e2db3ad3c 100644 --- a/classstdex_1_1parser_1_1http__value-members.html +++ b/classstdex_1_1parser_1_1http__value-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__value.html b/classstdex_1_1parser_1_1http__value.html index 298e6394e..6b42ff62b 100644 --- a/classstdex_1_1parser_1_1http__value.html +++ b/classstdex_1_1parser_1_1http__value.html @@ -222,7 +222,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__value__collection-members.html b/classstdex_1_1parser_1_1http__value__collection-members.html index ddb339e7d..d0ef9c786 100644 --- a/classstdex_1_1parser_1_1http__value__collection-members.html +++ b/classstdex_1_1parser_1_1http__value__collection-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__value__collection.html b/classstdex_1_1parser_1_1http__value__collection.html index 1e5cdc4bc..cb21d54db 100644 --- a/classstdex_1_1parser_1_1http__value__collection.html +++ b/classstdex_1_1parser_1_1http__value__collection.html @@ -107,7 +107,7 @@ class stdex::parser::http_value_collection< _Key, T >

Collection o

diff --git a/classstdex_1_1parser_1_1http__weight-members.html b/classstdex_1_1parser_1_1http__weight-members.html index 9b64cf823..f340dc73e 100644 --- a/classstdex_1_1parser_1_1http__weight-members.html +++ b/classstdex_1_1parser_1_1http__weight-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__weight.html b/classstdex_1_1parser_1_1http__weight.html index ddf49209c..7f01f115f 100644 --- a/classstdex_1_1parser_1_1http__weight.html +++ b/classstdex_1_1parser_1_1http__weight.html @@ -221,7 +221,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1http__weighted__value-members.html b/classstdex_1_1parser_1_1http__weighted__value-members.html index e25bf177a..e0582d359 100644 --- a/classstdex_1_1parser_1_1http__weighted__value-members.html +++ b/classstdex_1_1parser_1_1http__weighted__value-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__weighted__value.html b/classstdex_1_1parser_1_1http__weighted__value.html index 013701f3e..ff944f443 100644 --- a/classstdex_1_1parser_1_1http__weighted__value.html +++ b/classstdex_1_1parser_1_1http__weighted__value.html @@ -231,7 +231,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1parser__collection-members.html b/classstdex_1_1parser_1_1parser__collection-members.html index 1a8bead52..f6448667d 100644 --- a/classstdex_1_1parser_1_1parser__collection-members.html +++ b/classstdex_1_1parser_1_1parser__collection-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1parser__collection.html b/classstdex_1_1parser_1_1parser__collection.html index cebff2656..6e9ebe891 100644 --- a/classstdex_1_1parser_1_1parser__collection.html +++ b/classstdex_1_1parser_1_1parser__collection.html @@ -189,7 +189,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1sgml__any__cp-members.html b/classstdex_1_1parser_1_1sgml__any__cp-members.html index 174ea921f..7f160530b 100644 --- a/classstdex_1_1parser_1_1sgml__any__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__any__cp-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__any__cp.html b/classstdex_1_1parser_1_1sgml__any__cp.html index 1e5f0e2f4..8f71d1788 100644 --- a/classstdex_1_1parser_1_1sgml__any__cp.html +++ b/classstdex_1_1parser_1_1sgml__any__cp.html @@ -196,7 +196,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__cp-members.html b/classstdex_1_1parser_1_1sgml__cp-members.html index 96e0ba8c3..5639620cd 100644 --- a/classstdex_1_1parser_1_1sgml__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__cp-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__cp.html b/classstdex_1_1parser_1_1sgml__cp.html index 9b8ac9304..9673cc776 100644 --- a/classstdex_1_1parser_1_1sgml__cp.html +++ b/classstdex_1_1parser_1_1sgml__cp.html @@ -197,7 +197,7 @@ Additional Inherited Members diff --git a/classstdex_1_1parser_1_1sgml__cp__set-members.html b/classstdex_1_1parser_1_1sgml__cp__set-members.html index 909cb225b..38892f3c2 100644 --- a/classstdex_1_1parser_1_1sgml__cp__set-members.html +++ b/classstdex_1_1parser_1_1sgml__cp__set-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__cp__set.html b/classstdex_1_1parser_1_1sgml__cp__set.html index 1bfb4b867..94585e5a0 100644 --- a/classstdex_1_1parser_1_1sgml__cp__set.html +++ b/classstdex_1_1parser_1_1sgml__cp__set.html @@ -210,7 +210,7 @@ Additional Inherited Members diff --git a/classstdex_1_1parser_1_1sgml__dns__domain__char-members.html b/classstdex_1_1parser_1_1sgml__dns__domain__char-members.html index ba3d1bfe1..1f69e7291 100644 --- a/classstdex_1_1parser_1_1sgml__dns__domain__char-members.html +++ b/classstdex_1_1parser_1_1sgml__dns__domain__char-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__dns__domain__char.html b/classstdex_1_1parser_1_1sgml__dns__domain__char.html index 3a26993ed..2526cd4b8 100644 --- a/classstdex_1_1parser_1_1sgml__dns__domain__char.html +++ b/classstdex_1_1parser_1_1sgml__dns__domain__char.html @@ -205,7 +205,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char-members.html b/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char-members.html index ba42e2ef0..35312faaf 100644 --- a/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char-members.html +++ b/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char.html b/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char.html index 2ebea33b7..a0c2f15f6 100644 --- a/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char.html +++ b/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char.html @@ -187,7 +187,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__punct__cp-members.html b/classstdex_1_1parser_1_1sgml__punct__cp-members.html index ed9a59bb8..0ecdb7aed 100644 --- a/classstdex_1_1parser_1_1sgml__punct__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__punct__cp-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__punct__cp.html b/classstdex_1_1parser_1_1sgml__punct__cp.html index 2ddf4c9a0..984484c03 100644 --- a/classstdex_1_1parser_1_1sgml__punct__cp.html +++ b/classstdex_1_1parser_1_1sgml__punct__cp.html @@ -200,7 +200,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__space__cp-members.html b/classstdex_1_1parser_1_1sgml__space__cp-members.html index a677c1a19..02a700d6c 100644 --- a/classstdex_1_1parser_1_1sgml__space__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__space__cp-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__space__cp.html b/classstdex_1_1parser_1_1sgml__space__cp.html index 33bc74337..71a8a7775 100644 --- a/classstdex_1_1parser_1_1sgml__space__cp.html +++ b/classstdex_1_1parser_1_1sgml__space__cp.html @@ -200,7 +200,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__space__or__punct__cp-members.html b/classstdex_1_1parser_1_1sgml__space__or__punct__cp-members.html index 385d6c084..bf9071b50 100644 --- a/classstdex_1_1parser_1_1sgml__space__or__punct__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__space__or__punct__cp-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__space__or__punct__cp.html b/classstdex_1_1parser_1_1sgml__space__or__punct__cp.html index ac0a640c7..46b50c351 100644 --- a/classstdex_1_1parser_1_1sgml__space__or__punct__cp.html +++ b/classstdex_1_1parser_1_1sgml__space__or__punct__cp.html @@ -200,7 +200,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__string-members.html b/classstdex_1_1parser_1_1sgml__string-members.html index d1787f3b5..cf9202290 100644 --- a/classstdex_1_1parser_1_1sgml__string-members.html +++ b/classstdex_1_1parser_1_1sgml__string-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__string.html b/classstdex_1_1parser_1_1sgml__string.html index ca14f63f5..1fdd07f3c 100644 --- a/classstdex_1_1parser_1_1sgml__string.html +++ b/classstdex_1_1parser_1_1sgml__string.html @@ -194,7 +194,7 @@ Additional Inherited Members diff --git a/classstdex_1_1parser_1_1sgml__url__password__char-members.html b/classstdex_1_1parser_1_1sgml__url__password__char-members.html index 189b86b43..9dd874e2c 100644 --- a/classstdex_1_1parser_1_1sgml__url__password__char-members.html +++ b/classstdex_1_1parser_1_1sgml__url__password__char-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__url__password__char.html b/classstdex_1_1parser_1_1sgml__url__password__char.html index 7fbc04877..25dce941f 100644 --- a/classstdex_1_1parser_1_1sgml__url__password__char.html +++ b/classstdex_1_1parser_1_1sgml__url__password__char.html @@ -196,7 +196,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__url__path__char-members.html b/classstdex_1_1parser_1_1sgml__url__path__char-members.html index e868eaa17..f005223b3 100644 --- a/classstdex_1_1parser_1_1sgml__url__path__char-members.html +++ b/classstdex_1_1parser_1_1sgml__url__path__char-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__url__path__char.html b/classstdex_1_1parser_1_1sgml__url__path__char.html index 1b9fa465d..c38ab48ea 100644 --- a/classstdex_1_1parser_1_1sgml__url__path__char.html +++ b/classstdex_1_1parser_1_1sgml__url__path__char.html @@ -196,7 +196,7 @@ std::locale m_locale diff --git a/classstdex_1_1parser_1_1sgml__url__username__char-members.html b/classstdex_1_1parser_1_1sgml__url__username__char-members.html index 15fe2a777..f5f758ba3 100644 --- a/classstdex_1_1parser_1_1sgml__url__username__char-members.html +++ b/classstdex_1_1parser_1_1sgml__url__username__char-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__url__username__char.html b/classstdex_1_1parser_1_1sgml__url__username__char.html index a51b4465d..e072c130d 100644 --- a/classstdex_1_1parser_1_1sgml__url__username__char.html +++ b/classstdex_1_1parser_1_1sgml__url__username__char.html @@ -196,7 +196,7 @@ std::locale m_locale diff --git a/classstdex_1_1progress-members.html b/classstdex_1_1progress-members.html index 0fb3a12e0..db58e942f 100644 --- a/classstdex_1_1progress-members.html +++ b/classstdex_1_1progress-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1progress.html b/classstdex_1_1progress.html index 8a943d586..cf5c9da19 100644 --- a/classstdex_1_1progress.html +++ b/classstdex_1_1progress.html @@ -319,7 +319,7 @@ template<class T > diff --git a/classstdex_1_1progress__switcher-members.html b/classstdex_1_1progress__switcher-members.html index fac60da46..0c589711d 100644 --- a/classstdex_1_1progress__switcher-members.html +++ b/classstdex_1_1progress__switcher-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1progress__switcher.html b/classstdex_1_1progress__switcher.html index e9c536952..9d69f6b87 100644 --- a/classstdex_1_1progress__switcher.html +++ b/classstdex_1_1progress__switcher.html @@ -163,7 +163,7 @@ class stdex::progress_switcher< T >

Progress indicator switcher. <

diff --git a/classstdex_1_1ring-members.html b/classstdex_1_1ring-members.html index cb0d454c2..58d64aa54 100644 --- a/classstdex_1_1ring-members.html +++ b/classstdex_1_1ring-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1ring.html b/classstdex_1_1ring.html index 47120a216..ed34c2f6a 100644 --- a/classstdex_1_1ring.html +++ b/classstdex_1_1ring.html @@ -296,7 +296,7 @@ template<class T , size_t CAPACITY> diff --git a/classstdex_1_1stream_1_1async__reader-members.html b/classstdex_1_1stream_1_1async__reader-members.html index 2090b76be..3bad7b316 100644 --- a/classstdex_1_1stream_1_1async__reader-members.html +++ b/classstdex_1_1stream_1_1async__reader-members.html @@ -146,10 +146,11 @@ $(function() { write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline ~async_reader() (defined in stdex::stream::async_reader< CAPACITY >)stdex::stream::async_reader< CAPACITY >inlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1async__reader.html b/classstdex_1_1stream_1_1async__reader.html index a7a3e986d..e95fd7ba5 100644 --- a/classstdex_1_1stream_1_1async__reader.html +++ b/classstdex_1_1stream_1_1async__reader.html @@ -390,7 +390,7 @@ template<size_t CAPACITY = default_async_limit> diff --git a/classstdex_1_1stream_1_1async__writer-members.html b/classstdex_1_1stream_1_1async__writer-members.html index 5cf0bab6c..c7e5bc620 100644 --- a/classstdex_1_1stream_1_1async__writer-members.html +++ b/classstdex_1_1stream_1_1async__writer-members.html @@ -146,10 +146,11 @@ $(function() { write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline ~async_writer() (defined in stdex::stream::async_writer< CAPACITY >)stdex::stream::async_writer< CAPACITY >inlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1async__writer.html b/classstdex_1_1stream_1_1async__writer.html index b6893cb64..7cba2f47c 100644 --- a/classstdex_1_1stream_1_1async__writer.html +++ b/classstdex_1_1stream_1_1async__writer.html @@ -421,7 +421,7 @@ template<size_t CAPACITY = default_async_limit> diff --git a/classstdex_1_1stream_1_1basic-members.html b/classstdex_1_1stream_1_1basic-members.html index 73855cc47..8a1c6ae8f 100644 --- a/classstdex_1_1stream_1_1basic-members.html +++ b/classstdex_1_1stream_1_1basic-members.html @@ -136,10 +136,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1basic.html b/classstdex_1_1stream_1_1basic.html index d34fdcb86..c406e8f45 100644 --- a/classstdex_1_1stream_1_1basic.html +++ b/classstdex_1_1stream_1_1basic.html @@ -1320,7 +1320,7 @@ template<class T > diff --git a/classstdex_1_1stream_1_1basic__file-members.html b/classstdex_1_1stream_1_1basic__file-members.html index f9cd7d423..fffe10a45 100644 --- a/classstdex_1_1stream_1_1basic__file-members.html +++ b/classstdex_1_1stream_1_1basic__file-members.html @@ -152,10 +152,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1basic__file.html b/classstdex_1_1stream_1_1basic__file.html index 8b0f067d4..d0a4d4827 100644 --- a/classstdex_1_1stream_1_1basic__file.html +++ b/classstdex_1_1stream_1_1basic__file.html @@ -927,7 +927,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1basic__sys-members.html b/classstdex_1_1stream_1_1basic__sys-members.html index 49d3e22a7..319edb658 100644 --- a/classstdex_1_1stream_1_1basic__sys-members.html +++ b/classstdex_1_1stream_1_1basic__sys-members.html @@ -147,11 +147,12 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~sys_object() (defined in stdex::sys_object)stdex::sys_objectinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~sys_object() noexcept(false) (defined in stdex::sys_object)stdex::sys_objectinlinevirtual diff --git a/classstdex_1_1stream_1_1basic__sys.html b/classstdex_1_1stream_1_1basic__sys.html index da23340f5..f20325ec3 100644 --- a/classstdex_1_1stream_1_1basic__sys.html +++ b/classstdex_1_1stream_1_1basic__sys.html @@ -493,7 +493,7 @@ sys_handle m_h diff --git a/classstdex_1_1stream_1_1buffer-members.html b/classstdex_1_1stream_1_1buffer-members.html index 81e9c61a5..5a54a2f04 100644 --- a/classstdex_1_1stream_1_1buffer-members.html +++ b/classstdex_1_1stream_1_1buffer-members.html @@ -146,11 +146,12 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~buffer() (defined in stdex::stream::buffer)stdex::stream::bufferinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~buffer() (defined in stdex::stream::buffer)stdex::stream::bufferinlinevirtual diff --git a/classstdex_1_1stream_1_1buffer.html b/classstdex_1_1stream_1_1buffer.html index 0d95ab4a4..0beee3442 100644 --- a/classstdex_1_1stream_1_1buffer.html +++ b/classstdex_1_1stream_1_1buffer.html @@ -468,7 +468,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1buffered__sys-members.html b/classstdex_1_1stream_1_1buffered__sys-members.html index d850a061f..290b11241 100644 --- a/classstdex_1_1stream_1_1buffered__sys-members.html +++ b/classstdex_1_1stream_1_1buffered__sys-members.html @@ -147,12 +147,13 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~buffer() (defined in stdex::stream::buffer)stdex::stream::bufferinlinevirtual - ~buffered_sys() (defined in stdex::stream::buffered_sys)stdex::stream::buffered_sysinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~buffer() (defined in stdex::stream::buffer)stdex::stream::bufferinlinevirtual + ~buffered_sys() (defined in stdex::stream::buffered_sys)stdex::stream::buffered_sysinlinevirtual diff --git a/classstdex_1_1stream_1_1buffered__sys.html b/classstdex_1_1stream_1_1buffered__sys.html index 1d4222bb9..d5ffe0f39 100644 --- a/classstdex_1_1stream_1_1buffered__sys.html +++ b/classstdex_1_1stream_1_1buffered__sys.html @@ -344,7 +344,7 @@ void done () diff --git a/classstdex_1_1stream_1_1cache-members.html b/classstdex_1_1stream_1_1cache-members.html index 8c32af460..82e743b83 100644 --- a/classstdex_1_1stream_1_1cache-members.html +++ b/classstdex_1_1stream_1_1cache-members.html @@ -163,11 +163,12 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~cache() noexcept(false) (defined in stdex::stream::cache)stdex::stream::cacheinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~cache() noexcept(false) (defined in stdex::stream::cache)stdex::stream::cacheinlinevirtual diff --git a/classstdex_1_1stream_1_1cache.html b/classstdex_1_1stream_1_1cache.html index 94e94d533..3347e26e2 100644 --- a/classstdex_1_1stream_1_1cache.html +++ b/classstdex_1_1stream_1_1cache.html @@ -933,7 +933,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1cached__file-members.html b/classstdex_1_1stream_1_1cached__file-members.html index e4dcf6f6f..18e352887 100644 --- a/classstdex_1_1stream_1_1cached__file-members.html +++ b/classstdex_1_1stream_1_1cached__file-members.html @@ -166,12 +166,13 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~cache() noexcept(false) (defined in stdex::stream::cache)stdex::stream::cacheinlinevirtual - ~cached_file() (defined in stdex::stream::cached_file)stdex::stream::cached_fileinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~cache() noexcept(false) (defined in stdex::stream::cache)stdex::stream::cacheinlinevirtual + ~cached_file() (defined in stdex::stream::cached_file)stdex::stream::cached_fileinlinevirtual diff --git a/classstdex_1_1stream_1_1cached__file.html b/classstdex_1_1stream_1_1cached__file.html index 519aa92ce..b96d20bbd 100644 --- a/classstdex_1_1stream_1_1cached__file.html +++ b/classstdex_1_1stream_1_1cached__file.html @@ -499,7 +499,7 @@ void write_cache () diff --git a/classstdex_1_1stream_1_1converter-members.html b/classstdex_1_1stream_1_1converter-members.html index 8c1946906..0051de3e1 100644 --- a/classstdex_1_1stream_1_1converter-members.html +++ b/classstdex_1_1stream_1_1converter-members.html @@ -141,10 +141,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1converter.html b/classstdex_1_1stream_1_1converter.html index 9249acf58..daee4f8f1 100644 --- a/classstdex_1_1stream_1_1converter.html +++ b/classstdex_1_1stream_1_1converter.html @@ -480,7 +480,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1diag__file-members.html b/classstdex_1_1stream_1_1diag__file-members.html index dd5da4978..00b5a8cbe 100644 --- a/classstdex_1_1stream_1_1diag__file-members.html +++ b/classstdex_1_1stream_1_1diag__file-members.html @@ -155,10 +155,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1diag__file.html b/classstdex_1_1stream_1_1diag__file.html index 431396772..07db6275e 100644 --- a/classstdex_1_1stream_1_1diag__file.html +++ b/classstdex_1_1stream_1_1diag__file.html @@ -720,7 +720,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1fifo-members.html b/classstdex_1_1stream_1_1fifo-members.html index 9de7d9568..7a696b9f8 100644 --- a/classstdex_1_1stream_1_1fifo-members.html +++ b/classstdex_1_1stream_1_1fifo-members.html @@ -142,11 +142,12 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~fifo() (defined in stdex::stream::fifo)stdex::stream::fifoinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~fifo() (defined in stdex::stream::fifo)stdex::stream::fifoinlinevirtual diff --git a/classstdex_1_1stream_1_1fifo.html b/classstdex_1_1stream_1_1fifo.html index 46bcadbee..0bcfd7f60 100644 --- a/classstdex_1_1stream_1_1fifo.html +++ b/classstdex_1_1stream_1_1fifo.html @@ -445,7 +445,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1file-members.html b/classstdex_1_1stream_1_1file-members.html index f5e37d829..b0d80e042 100644 --- a/classstdex_1_1stream_1_1file-members.html +++ b/classstdex_1_1stream_1_1file-members.html @@ -170,11 +170,12 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~sys_object() (defined in stdex::sys_object)stdex::sys_objectinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~sys_object() noexcept(false) (defined in stdex::sys_object)stdex::sys_objectinlinevirtual diff --git a/classstdex_1_1stream_1_1file.html b/classstdex_1_1stream_1_1file.html index f03048023..72f63477c 100644 --- a/classstdex_1_1stream_1_1file.html +++ b/classstdex_1_1stream_1_1file.html @@ -877,7 +877,7 @@ sys_handle m_h diff --git a/classstdex_1_1stream_1_1file__window-members.html b/classstdex_1_1stream_1_1file__window-members.html index a7b8e4ea2..d5d86e99b 100644 --- a/classstdex_1_1stream_1_1file__window-members.html +++ b/classstdex_1_1stream_1_1file__window-members.html @@ -156,10 +156,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1file__window.html b/classstdex_1_1stream_1_1file__window.html index 3c9296206..df813ec5d 100644 --- a/classstdex_1_1stream_1_1file__window.html +++ b/classstdex_1_1stream_1_1file__window.html @@ -753,7 +753,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1limiter-members.html b/classstdex_1_1stream_1_1limiter-members.html index 914ba7ddf..714a203b8 100644 --- a/classstdex_1_1stream_1_1limiter-members.html +++ b/classstdex_1_1stream_1_1limiter-members.html @@ -144,10 +144,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1limiter.html b/classstdex_1_1stream_1_1limiter.html index 0ced6c63a..abefcff61 100644 --- a/classstdex_1_1stream_1_1limiter.html +++ b/classstdex_1_1stream_1_1limiter.html @@ -429,7 +429,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1memory__file-members.html b/classstdex_1_1stream_1_1memory__file-members.html index 16a2638b1..637fce8b9 100644 --- a/classstdex_1_1stream_1_1memory__file-members.html +++ b/classstdex_1_1stream_1_1memory__file-members.html @@ -192,11 +192,12 @@ $(function() { stdex::stream::basic_file::write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~memory_file() (defined in stdex::stream::memory_file)stdex::stream::memory_fileinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~memory_file() (defined in stdex::stream::memory_file)stdex::stream::memory_fileinlinevirtual diff --git a/classstdex_1_1stream_1_1memory__file.html b/classstdex_1_1stream_1_1memory__file.html index 189b0c2b6..18fedefc8 100644 --- a/classstdex_1_1stream_1_1memory__file.html +++ b/classstdex_1_1stream_1_1memory__file.html @@ -1465,7 +1465,7 @@ template<class T > diff --git a/classstdex_1_1stream_1_1replicator-members.html b/classstdex_1_1stream_1_1replicator-members.html index 44b467832..a03520ae1 100644 --- a/classstdex_1_1stream_1_1replicator-members.html +++ b/classstdex_1_1stream_1_1replicator-members.html @@ -140,11 +140,12 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline - ~replicator() (defined in stdex::stream::replicator)stdex::stream::replicatorinlinevirtual + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual + ~replicator() (defined in stdex::stream::replicator)stdex::stream::replicatorinlinevirtual diff --git a/classstdex_1_1stream_1_1replicator.html b/classstdex_1_1stream_1_1replicator.html index 79633d258..d05dc4c8b 100644 --- a/classstdex_1_1stream_1_1replicator.html +++ b/classstdex_1_1stream_1_1replicator.html @@ -428,7 +428,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1replicator_1_1worker-members.html b/classstdex_1_1stream_1_1replicator_1_1worker-members.html index 0c99b2058..291733731 100644 --- a/classstdex_1_1stream_1_1replicator_1_1worker-members.html +++ b/classstdex_1_1stream_1_1replicator_1_1worker-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1replicator_1_1worker.html b/classstdex_1_1stream_1_1replicator_1_1worker.html index 695bf01f8..4a54a9198 100644 --- a/classstdex_1_1stream_1_1replicator_1_1worker.html +++ b/classstdex_1_1stream_1_1replicator_1_1worker.html @@ -146,7 +146,7 @@ static void process_op diff --git a/classstdex_1_1stream_1_1window-members.html b/classstdex_1_1stream_1_1window-members.html index 0c929845c..24d143ec8 100644 --- a/classstdex_1_1stream_1_1window-members.html +++ b/classstdex_1_1stream_1_1window-members.html @@ -147,10 +147,11 @@ $(function() { write_stream(basic &stream, fsize_t amount=fsize_max)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)stdex::stream::basicinline write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)stdex::stream::basicinline + ~basic() noexcept(false) (defined in stdex::stream::basic)stdex::stream::basicinlinevirtual diff --git a/classstdex_1_1stream_1_1window.html b/classstdex_1_1stream_1_1window.html index 9cc82a615..3d5d0c666 100644 --- a/classstdex_1_1stream_1_1window.html +++ b/classstdex_1_1stream_1_1window.html @@ -438,7 +438,7 @@ state_t m_state diff --git a/classstdex_1_1sys__object-members.html b/classstdex_1_1sys__object-members.html index ea0b372bb..3cab1f3fa 100644 --- a/classstdex_1_1sys__object-members.html +++ b/classstdex_1_1sys__object-members.html @@ -91,11 +91,11 @@ $(function() { sys_object(sys_handle h=invalid_handle) (defined in stdex::sys_object)stdex::sys_objectinline sys_object(const sys_object &other) (defined in stdex::sys_object)stdex::sys_objectinline sys_object(sys_object &&other) noexcept (defined in stdex::sys_object)stdex::sys_objectinline - ~sys_object() (defined in stdex::sys_object)stdex::sys_objectinlinevirtual + ~sys_object() noexcept(false) (defined in stdex::sys_object)stdex::sys_objectinlinevirtual diff --git a/classstdex_1_1sys__object.html b/classstdex_1_1sys__object.html index 2e0c98dd9..dbdb94c91 100644 --- a/classstdex_1_1sys__object.html +++ b/classstdex_1_1sys__object.html @@ -182,7 +182,7 @@ sys_handle m_h diff --git a/classstdex_1_1user__cancelled-members.html b/classstdex_1_1user__cancelled-members.html index cb9373bc6..4c17df50d 100644 --- a/classstdex_1_1user__cancelled-members.html +++ b/classstdex_1_1user__cancelled-members.html @@ -84,7 +84,7 @@ $(function() { diff --git a/classstdex_1_1user__cancelled.html b/classstdex_1_1user__cancelled.html index 2b4e62d17..287a1b794 100644 --- a/classstdex_1_1user__cancelled.html +++ b/classstdex_1_1user__cancelled.html @@ -141,7 +141,7 @@ Public Member Functions diff --git a/classstdex_1_1vector__queue-members.html b/classstdex_1_1vector__queue-members.html index 5c801323b..ba8699ec7 100644 --- a/classstdex_1_1vector__queue-members.html +++ b/classstdex_1_1vector__queue-members.html @@ -122,7 +122,7 @@ $(function() { diff --git a/classstdex_1_1vector__queue.html b/classstdex_1_1vector__queue.html index f3dea4338..e8352dd2c 100644 --- a/classstdex_1_1vector__queue.html +++ b/classstdex_1_1vector__queue.html @@ -795,7 +795,7 @@ template<class T > diff --git a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html index bb668af2e..127bb5bc1 100644 --- a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html +++ b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html @@ -100,7 +100,7 @@ Files diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html index fd882a43c..93f571d8e 100644 --- a/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -86,7 +86,7 @@ Directories diff --git a/dir_fca3c47b2ea228727bd6729832f89576.html b/dir_fca3c47b2ea228727bd6729832f89576.html index 1883b8568..0bb14ec85 100644 --- a/dir_fca3c47b2ea228727bd6729832f89576.html +++ b/dir_fca3c47b2ea228727bd6729832f89576.html @@ -128,7 +128,7 @@ Files diff --git a/endian_8hpp_source.html b/endian_8hpp_source.html index a49af37b9..c2b79fced 100644 --- a/endian_8hpp_source.html +++ b/endian_8hpp_source.html @@ -226,7 +226,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/errno_8hpp_source.html b/errno_8hpp_source.html index 7d7aaf8a2..1907dd21c 100644 --- a/errno_8hpp_source.html +++ b/errno_8hpp_source.html @@ -153,7 +153,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/exception_8hpp_source.html b/exception_8hpp_source.html index 62cd3e9d0..bf501449e 100644 --- a/exception_8hpp_source.html +++ b/exception_8hpp_source.html @@ -110,7 +110,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/files.html b/files.html index e6949fb96..2bea67d28 100644 --- a/files.html +++ b/files.html @@ -113,7 +113,7 @@ $(function() { diff --git a/functions.html b/functions.html index 08227d0a0..637b891cb 100644 --- a/functions.html +++ b/functions.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_b.html b/functions_b.html index 59dba96d7..224c7d1c2 100644 --- a/functions_b.html +++ b/functions_b.html @@ -82,7 +82,7 @@ $(function() { diff --git a/functions_c.html b/functions_c.html index d12177f50..76830c1f4 100644 --- a/functions_c.html +++ b/functions_c.html @@ -92,7 +92,7 @@ $(function() { diff --git a/functions_d.html b/functions_d.html index 4a0fdf2fc..04fcb39e6 100644 --- a/functions_d.html +++ b/functions_d.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_e.html b/functions_e.html index f1f72622a..d80b7ccac 100644 --- a/functions_e.html +++ b/functions_e.html @@ -86,7 +86,7 @@ $(function() { diff --git a/functions_f.html b/functions_f.html index 58683eb47..ee2254875 100644 --- a/functions_f.html +++ b/functions_f.html @@ -86,7 +86,7 @@ $(function() { diff --git a/functions_func.html b/functions_func.html index 401293576..ed4d5ebb1 100644 --- a/functions_func.html +++ b/functions_func.html @@ -82,7 +82,7 @@ $(function() { diff --git a/functions_func_b.html b/functions_func_b.html index bb90a9ae9..68ad38472 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_c.html b/functions_func_c.html index dca8614fc..c9610e4c8 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_func_d.html b/functions_func_d.html index 9cff37a13..02f8391fa 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_func_e.html b/functions_func_e.html index 676bbaaab..8230797d1 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_func_f.html b/functions_func_f.html index 0baa6ec6b..abcaba02b 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_func_g.html b/functions_func_g.html index becb64195..8376f1e27 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_h.html b/functions_func_h.html index c0ec47de7..76693f78a 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_i.html b/functions_func_i.html index cf897ec67..b3b7bd9c4 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_l.html b/functions_func_l.html index 1873d9328..749880f99 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_m.html b/functions_func_m.html index 5da4d5549..29c51a8ef 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_n.html b/functions_func_n.html index 1372c1e5b..57fe168fa 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_o.html b/functions_func_o.html index 79895617e..7a3b0446e 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_func_p.html b/functions_func_p.html index fbf51997d..8d92ab63a 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_q.html b/functions_func_q.html index 5b17dcfa8..e1b131cad 100644 --- a/functions_func_q.html +++ b/functions_func_q.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_func_r.html b/functions_func_r.html index dab63fe19..cdc2d050c 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_func_s.html b/functions_func_s.html index 993f9c936..9c1b504fd 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -97,7 +97,7 @@ $(function() { diff --git a/functions_func_t.html b/functions_func_t.html index 5bef5ebf0..445a21ed6 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_u.html b/functions_func_u.html index 679f8157d..17df26294 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_func_v.html b/functions_func_v.html index 9413a628e..7e82bfa08 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_func_w.html b/functions_func_w.html index 24c28ff97..ad24dcc5e 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -86,7 +86,7 @@ $(function() { diff --git a/functions_func_~.html b/functions_func_~.html index f84a62903..ab63af77e 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_g.html b/functions_g.html index 9bd5f32ef..8ced6cedb 100644 --- a/functions_g.html +++ b/functions_g.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_h.html b/functions_h.html index 8f49f427f..04770af85 100644 --- a/functions_h.html +++ b/functions_h.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_i.html b/functions_i.html index 7edfc9ef1..775707bb6 100644 --- a/functions_i.html +++ b/functions_i.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_l.html b/functions_l.html index dfa51e81a..8b2a370bc 100644 --- a/functions_l.html +++ b/functions_l.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_m.html b/functions_m.html index 650732d64..8ef49f145 100644 --- a/functions_m.html +++ b/functions_m.html @@ -96,7 +96,7 @@ $(function() { diff --git a/functions_n.html b/functions_n.html index f093a5eac..ea20d6937 100644 --- a/functions_n.html +++ b/functions_n.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_o.html b/functions_o.html index 59ce9d237..e4dc3b1ce 100644 --- a/functions_o.html +++ b/functions_o.html @@ -86,7 +86,7 @@ $(function() { diff --git a/functions_p.html b/functions_p.html index ca9db4dd2..c6420686b 100644 --- a/functions_p.html +++ b/functions_p.html @@ -90,7 +90,7 @@ $(function() { diff --git a/functions_q.html b/functions_q.html index 63fcf2110..f5c8d635b 100644 --- a/functions_q.html +++ b/functions_q.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_r.html b/functions_r.html index 9a7041271..c2483d0ce 100644 --- a/functions_r.html +++ b/functions_r.html @@ -93,7 +93,7 @@ $(function() { diff --git a/functions_s.html b/functions_s.html index 528c8f2f8..32882368e 100644 --- a/functions_s.html +++ b/functions_s.html @@ -103,7 +103,7 @@ $(function() { diff --git a/functions_t.html b/functions_t.html index 0c1abcefa..872a8765d 100644 --- a/functions_t.html +++ b/functions_t.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_type.html b/functions_type.html index ce82edbce..671a46c44 100644 --- a/functions_type.html +++ b/functions_type.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_u.html b/functions_u.html index 03348695b..3366b3199 100644 --- a/functions_u.html +++ b/functions_u.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_v.html b/functions_v.html index 05fd0a41f..8b413d6bc 100644 --- a/functions_v.html +++ b/functions_v.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_vars.html b/functions_vars.html index 6b228f75e..1ae61696e 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -213,7 +213,7 @@ $(function() { diff --git a/functions_w.html b/functions_w.html index 78667a67e..f2fcb3574 100644 --- a/functions_w.html +++ b/functions_w.html @@ -88,7 +88,7 @@ $(function() { diff --git a/functions_~.html b/functions_~.html index 399aa8c14..1a6220785 100644 --- a/functions_~.html +++ b/functions_~.html @@ -78,7 +78,7 @@ $(function() { diff --git a/hex_8hpp_source.html b/hex_8hpp_source.html index 6f0235d96..aa6284b22 100644 --- a/hex_8hpp_source.html +++ b/hex_8hpp_source.html @@ -232,7 +232,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/hierarchy.html b/hierarchy.html index 65acda06e..24abe5931 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -236,7 +236,7 @@ $(function() { diff --git a/idrec_8hpp_source.html b/idrec_8hpp_source.html index eeac06136..8a1fc9462 100644 --- a/idrec_8hpp_source.html +++ b/idrec_8hpp_source.html @@ -416,12 +416,12 @@ $(document).ready(function() { init_codefold(0); });
static bool find(stdex::stream::basic_file &stream, stdex::stream::foff_t end=stdex::stream::foff_max)
Finds record data.
Definition idrec.hpp:392
record(const T &d)
Constructs the class.
Definition idrec.hpp:294
static std::streamoff close(std::ostream &stream, std::streamoff start)
Updates record header.
Definition idrec.hpp:349
-
Basic seekable stream operations.
Definition stream.hpp:696
-
Limits reading from/writing to stream to a predefined number of bytes.
Definition stream.hpp:1415
+
Basic seekable stream operations.
Definition stream.hpp:698
+
Limits reading from/writing to stream to a predefined number of bytes.
Definition stream.hpp:1417
diff --git a/include_2stdex_2compat_8hpp_source.html b/include_2stdex_2compat_8hpp_source.html index ae7a60122..28cf516cc 100644 --- a/include_2stdex_2compat_8hpp_source.html +++ b/include_2stdex_2compat_8hpp_source.html @@ -282,7 +282,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/index.html b/index.html index ad41e9aac..fb71e9a02 100644 --- a/index.html +++ b/index.html @@ -76,7 +76,7 @@ $(function() { diff --git a/interval_8hpp_source.html b/interval_8hpp_source.html index 61ff09ae0..5c8cd4191 100644 --- a/interval_8hpp_source.html +++ b/interval_8hpp_source.html @@ -202,7 +202,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/mapping_8hpp_source.html b/mapping_8hpp_source.html index e21d75e8c..04b0ef181 100644 --- a/mapping_8hpp_source.html +++ b/mapping_8hpp_source.html @@ -124,7 +124,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/math_8cpp_source.html b/math_8cpp_source.html index edbf28a20..b56bc4f60 100644 --- a/math_8cpp_source.html +++ b/math_8cpp_source.html @@ -129,7 +129,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/math_8hpp_source.html b/math_8hpp_source.html index 1c826ad73..592a1ea3d 100644 --- a/math_8hpp_source.html +++ b/math_8hpp_source.html @@ -134,7 +134,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/memory_8hpp_source.html b/memory_8hpp_source.html index c33805fa4..f2c146c71 100644 --- a/memory_8hpp_source.html +++ b/memory_8hpp_source.html @@ -128,7 +128,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/parser_8cpp_source.html b/parser_8cpp_source.html index 5ea6a0b12..0d7ffef61 100644 --- a/parser_8cpp_source.html +++ b/parser_8cpp_source.html @@ -271,283 +271,289 @@ $(document).ready(function() { init_codefold(0); });
187 }
188
189 {
-
190 wspace_cu space;
-
191 wiban p(make_shared_no_delete(&space));
-
192 Assert::IsTrue(p.match(L"SI56023120015226972", 0, SIZE_MAX));
-
193 Assert::IsTrue(p.is_valid);
-
194 Assert::AreEqual(L"SI", p.country);
-
195 Assert::AreEqual(L"56", p.check_digits);
-
196 Assert::AreEqual(L"023120015226972", p.bban);
-
197 Assert::IsTrue(p.match(L"SI56 0231 2001 5226 972", 0, SIZE_MAX));
-
198 Assert::IsTrue(p.is_valid);
-
199 Assert::AreEqual(L"SI", p.country);
-
200 Assert::AreEqual(L"56", p.check_digits);
-
201 Assert::AreEqual(L"023120015226972", p.bban);
-
202 Assert::IsFalse(p.match(L"si56 0231 2001 5226 972", 0, SIZE_MAX));
-
203 Assert::IsFalse(p.is_valid);
-
204 Assert::IsTrue(p.match(L"si56 0231 2001 5226 972", 0, SIZE_MAX, match_case_insensitive));
-
205 Assert::IsTrue(p.is_valid);
-
206 Assert::IsTrue(p.match(L"SI56 0231 2001 5226 9720", 0, SIZE_MAX));
-
207 Assert::IsFalse(p.is_valid);
-
208 Assert::IsTrue(p.match(L"...SI56 0231 2001 5226 972...", 3, SIZE_MAX));
-
209 Assert::IsTrue(p.is_valid);
-
210 Assert::IsTrue(p.match(L"SI56 0231 2001 5226 972", 0, SIZE_MAX)); // no-break space
-
211 Assert::IsTrue(p.is_valid);
-
212 }
-
213
-
214 {
-
215 wspace_cu space;
-
216 wcreditor_reference p(make_shared_no_delete(&space));
-
217 Assert::IsTrue(p.match(L"RF18539007547034", 0, SIZE_MAX));
-
218 Assert::IsTrue(p.is_valid);
-
219 Assert::AreEqual(L"18", p.check_digits);
-
220 Assert::AreEqual(L"000000000539007547034", p.reference);
-
221 Assert::IsTrue(p.match(L"RF18 5390 0754 7034", 0, SIZE_MAX));
-
222 Assert::IsTrue(p.is_valid);
-
223 Assert::AreEqual(L"18", p.check_digits);
-
224 Assert::AreEqual(L"000000000539007547034", p.reference);
-
225 Assert::IsFalse(p.match(L"rf18 5390 0754 7034", 0, SIZE_MAX));
-
226 Assert::IsFalse(p.is_valid);
-
227 Assert::IsTrue(p.match(L"rf18 5390 0754 7034", 0, SIZE_MAX, match_case_insensitive));
-
228 Assert::IsTrue(p.is_valid);
-
229 Assert::IsTrue(p.match(L"RF18 5390 0754 70340", 0, SIZE_MAX));
-
230 Assert::IsFalse(p.is_valid);
-
231 Assert::IsTrue(p.match(L"...RF18 5390 0754 7034...", 3, SIZE_MAX));
-
232 Assert::IsTrue(p.is_valid);
-
233 Assert::IsTrue(p.match(L"RF18 5390 0754 7034", 0, SIZE_MAX)); // no-break space
+
190 std::locale locale_slSI("sl_SI");
+
191 wspace_cu space(false, locale_slSI);
+
192 wiban p(make_shared_no_delete(&space), locale_slSI);
+
193 Assert::IsTrue(p.match(L"SI56023120015226972", 0, SIZE_MAX));
+
194 Assert::IsTrue(p.is_valid);
+
195 Assert::AreEqual(L"SI", p.country);
+
196 Assert::AreEqual(L"56", p.check_digits);
+
197 Assert::AreEqual(L"023120015226972", p.bban);
+
198 Assert::IsTrue(p.match(L"SI56 0231 2001 5226 972", 0, SIZE_MAX));
+
199 Assert::IsTrue(p.is_valid);
+
200 Assert::AreEqual(L"SI", p.country);
+
201 Assert::AreEqual(L"56", p.check_digits);
+
202 Assert::AreEqual(L"023120015226972", p.bban);
+
203 Assert::IsFalse(p.match(L"si56 0231 2001 5226 972", 0, SIZE_MAX));
+
204 Assert::IsFalse(p.is_valid);
+
205 Assert::IsTrue(p.match(L"si56 0231 2001 5226 972", 0, SIZE_MAX, match_case_insensitive));
+
206 Assert::IsTrue(p.is_valid);
+
207 Assert::IsTrue(p.match(L"SI56 0231 2001 5226 9720", 0, SIZE_MAX));
+
208 Assert::IsFalse(p.is_valid);
+
209 Assert::IsTrue(p.match(L"...SI56 0231 2001 5226 972...", 3, SIZE_MAX));
+
210 Assert::IsTrue(p.is_valid);
+
211 Assert::IsTrue(p.match(L"SI56 0231 2001 5226 972", 0, SIZE_MAX)); // no-break space
+
212 Assert::IsTrue(p.is_valid);
+
213 }
+
214
+
215 {
+
216 std::locale locale_slSI("sl_SI");
+
217 wspace_cu space(false, locale_slSI);
+
218 wcreditor_reference p(make_shared_no_delete(&space), locale_slSI);
+
219 Assert::IsTrue(p.match(L"RF18539007547034", 0, SIZE_MAX));
+
220 Assert::IsTrue(p.is_valid);
+
221 Assert::AreEqual(L"18", p.check_digits);
+
222 Assert::AreEqual(L"000000000539007547034", p.reference);
+
223 Assert::IsTrue(p.match(L"RF18 5390 0754 7034", 0, SIZE_MAX));
+
224 Assert::IsTrue(p.is_valid);
+
225 Assert::AreEqual(L"18", p.check_digits);
+
226 Assert::AreEqual(L"000000000539007547034", p.reference);
+
227 Assert::IsFalse(p.match(L"rf18 5390 0754 7034", 0, SIZE_MAX));
+
228 Assert::IsFalse(p.is_valid);
+
229 Assert::IsTrue(p.match(L"rf18 5390 0754 7034", 0, SIZE_MAX, match_case_insensitive));
+
230 Assert::IsTrue(p.is_valid);
+
231 Assert::IsTrue(p.match(L"RF18 5390 0754 70340", 0, SIZE_MAX));
+
232 Assert::IsFalse(p.is_valid);
+
233 Assert::IsTrue(p.match(L"...RF18 5390 0754 7034...", 3, SIZE_MAX));
234 Assert::IsTrue(p.is_valid);
-
235 }
-
236
-
237 {
-
238 wspace_cu space;
-
239 wsi_reference p(make_shared_no_delete(&space));
-
240 Assert::IsTrue(p.match(L"SI121234567890120", 0, SIZE_MAX));
-
241 Assert::IsTrue(p.is_valid);
-
242 Assert::AreEqual(L"12", p.model);
-
243 Assert::AreEqual(stdex::interval<size_t>(4, 17), p.part1.interval);
-
244 Assert::IsTrue(p.match(L"SI12 1234567890120", 0, SIZE_MAX));
-
245 Assert::IsTrue(p.is_valid);
-
246 Assert::AreEqual(L"12", p.model);
-
247 Assert::AreEqual(stdex::interval<size_t>(5, 18), p.part1.interval);
-
248 Assert::IsFalse(p.match(L"si12 1234567890120", 0, SIZE_MAX));
-
249 Assert::IsTrue(p.match(L"si12 1234567890120", 0, SIZE_MAX, match_case_insensitive));
-
250 Assert::IsTrue(p.match(L"...SI12 1234567890120...", 3, SIZE_MAX));
-
251 Assert::IsTrue(p.match(L"SI12 1234567890120", 0, SIZE_MAX)); // no-break space
-
252 }
-
253 }
-
254
-
255 TEST_METHOD(sgml_test)
-
256 {
-
257 std::locale locale_slSI("sl_SI");
-
258 static const char text[] = "V ko&zcaron;u&scaron;&ccaron;ku zlobnega mizarja stopiclja fant\nin kli&ccaron;e&nbsp;1234567890.";
-
259
-
260 {
-
261 sgml_noop p;
-
262 Assert::IsTrue(p.match(text));
-
263 Assert::AreEqual((size_t)0, p.interval.start);
-
264 Assert::AreEqual((size_t)0, p.interval.end);
-
265 }
-
266
-
267 {
-
268 sgml_cp p("v");
-
269 Assert::IsFalse(p.match(text));
-
270 Assert::IsTrue(p.match(text, 0, _countof(text), match_case_insensitive));
-
271 Assert::AreEqual((size_t)0, p.interval.start);
-
272 Assert::AreEqual((size_t)1, p.interval.end);
-
273 }
-
274
-
275 {
-
276 sgml_cp p("&Zcaron;", SIZE_MAX, false, locale_slSI);
-
277 Assert::IsFalse(p.match(text, 4));
-
278 Assert::IsTrue(p.match(text, 4, _countof(text), match_case_insensitive));
-
279 Assert::AreEqual((size_t)4, p.interval.start);
-
280 Assert::AreEqual((size_t)12, p.interval.end);
-
281 }
-
282
-
283 {
-
284 sgml_space_cp p(false, locale_slSI);
-
285 Assert::IsFalse(p.match(text));
-
286 Assert::IsTrue(p.match(text, 1));
-
287 Assert::AreEqual((size_t)1, p.interval.start);
-
288 Assert::AreEqual((size_t)2, p.interval.end);
-
289 Assert::IsTrue(p.match(text, 79));
-
290 Assert::AreEqual((size_t)79, p.interval.start);
-
291 Assert::AreEqual((size_t)85, p.interval.end);
-
292 }
-
293
-
294 {
-
295 sgml_string_branch p(locale_slSI, "apple", "orange", "Ko&Zcaron;u&Scaron;&ccaron;Ku", nullptr);
-
296 Assert::IsFalse(p.match(text, 2));
-
297 Assert::IsTrue(p.match(text, 2, _countof(text), match_case_insensitive));
-
298 Assert::AreEqual((size_t)2, p.hit_offset);
-
299 Assert::AreEqual((size_t)2, p.interval.start);
-
300 Assert::AreEqual((size_t)31, p.interval.end);
-
301 }
-
302
-
303 {
-
304 sgml_space_cp space;
-
305 sgml_iban p(make_shared_no_delete(&space));
-
306 Assert::IsTrue(p.match("SI56023120015226972", 0, SIZE_MAX));
-
307 Assert::IsTrue(p.is_valid);
-
308 Assert::AreEqual("SI", p.country);
-
309 Assert::AreEqual("56", p.check_digits);
-
310 Assert::AreEqual("023120015226972", p.bban);
-
311 Assert::IsTrue(p.match("SI56 0231 2001 5226 972", 0, SIZE_MAX));
-
312 Assert::IsTrue(p.is_valid);
-
313 Assert::AreEqual("SI", p.country);
-
314 Assert::AreEqual("56", p.check_digits);
-
315 Assert::AreEqual("023120015226972", p.bban);
-
316 Assert::IsFalse(p.match("si56 0231 2001 5226 972", 0, SIZE_MAX));
-
317 Assert::IsFalse(p.is_valid);
-
318 Assert::IsTrue(p.match("si56 0231 2001 5226 972", 0, SIZE_MAX, match_case_insensitive));
-
319 Assert::IsTrue(p.is_valid);
-
320 Assert::IsTrue(p.match("SI56 0231 2001 5226 9720", 0, SIZE_MAX));
+
235 Assert::IsTrue(p.match(L"RF18 5390 0754 7034", 0, SIZE_MAX)); // no-break space
+
236 Assert::IsTrue(p.is_valid);
+
237 }
+
238
+
239 {
+
240 std::locale locale_slSI("sl_SI");
+
241 wspace_cu space(false, locale_slSI);
+
242 wsi_reference p(make_shared_no_delete(&space), locale_slSI);
+
243 Assert::IsTrue(p.match(L"SI121234567890120", 0, SIZE_MAX));
+
244 Assert::IsTrue(p.is_valid);
+
245 Assert::AreEqual(L"12", p.model);
+
246 Assert::AreEqual(stdex::interval<size_t>(4, 17), p.part1.interval);
+
247 Assert::IsTrue(p.match(L"SI12 1234567890120", 0, SIZE_MAX));
+
248 Assert::IsTrue(p.is_valid);
+
249 Assert::AreEqual(L"12", p.model);
+
250 Assert::AreEqual(stdex::interval<size_t>(5, 18), p.part1.interval);
+
251 Assert::IsFalse(p.match(L"si12 1234567890120", 0, SIZE_MAX));
+
252 Assert::IsTrue(p.match(L"si12 1234567890120", 0, SIZE_MAX, match_case_insensitive));
+
253 Assert::IsTrue(p.match(L"...SI12 1234567890120...", 3, SIZE_MAX));
+
254 Assert::IsTrue(p.match(L"SI12 1234567890120", 0, SIZE_MAX)); // no-break space
+
255 }
+
256 }
+
257
+
258 TEST_METHOD(sgml_test)
+
259 {
+
260 std::locale locale_slSI("sl_SI");
+
261 static const char text[] = "V ko&zcaron;u&scaron;&ccaron;ku zlobnega mizarja stopiclja fant\nin kli&ccaron;e&nbsp;1234567890.";
+
262
+
263 {
+
264 sgml_noop p;
+
265 Assert::IsTrue(p.match(text));
+
266 Assert::AreEqual((size_t)0, p.interval.start);
+
267 Assert::AreEqual((size_t)0, p.interval.end);
+
268 }
+
269
+
270 {
+
271 sgml_cp p("v");
+
272 Assert::IsFalse(p.match(text));
+
273 Assert::IsTrue(p.match(text, 0, _countof(text), match_case_insensitive));
+
274 Assert::AreEqual((size_t)0, p.interval.start);
+
275 Assert::AreEqual((size_t)1, p.interval.end);
+
276 }
+
277
+
278 {
+
279 sgml_cp p("&Zcaron;", SIZE_MAX, false, locale_slSI);
+
280 Assert::IsFalse(p.match(text, 4));
+
281 Assert::IsTrue(p.match(text, 4, _countof(text), match_case_insensitive));
+
282 Assert::AreEqual((size_t)4, p.interval.start);
+
283 Assert::AreEqual((size_t)12, p.interval.end);
+
284 }
+
285
+
286 {
+
287 sgml_space_cp p(false, locale_slSI);
+
288 Assert::IsFalse(p.match(text));
+
289 Assert::IsTrue(p.match(text, 1));
+
290 Assert::AreEqual((size_t)1, p.interval.start);
+
291 Assert::AreEqual((size_t)2, p.interval.end);
+
292 Assert::IsTrue(p.match(text, 79));
+
293 Assert::AreEqual((size_t)79, p.interval.start);
+
294 Assert::AreEqual((size_t)85, p.interval.end);
+
295 }
+
296
+
297 {
+
298 sgml_string_branch p(locale_slSI, "apple", "orange", "Ko&Zcaron;u&Scaron;&ccaron;Ku", nullptr);
+
299 Assert::IsFalse(p.match(text, 2));
+
300 Assert::IsTrue(p.match(text, 2, _countof(text), match_case_insensitive));
+
301 Assert::AreEqual((size_t)2, p.hit_offset);
+
302 Assert::AreEqual((size_t)2, p.interval.start);
+
303 Assert::AreEqual((size_t)31, p.interval.end);
+
304 }
+
305
+
306 {
+
307 std::locale locale_slSI("sl_SI");
+
308 sgml_space_cp space(false, locale_slSI);
+
309 sgml_iban p(make_shared_no_delete(&space), locale_slSI);
+
310 Assert::IsTrue(p.match("SI56023120015226972", 0, SIZE_MAX));
+
311 Assert::IsTrue(p.is_valid);
+
312 Assert::AreEqual("SI", p.country);
+
313 Assert::AreEqual("56", p.check_digits);
+
314 Assert::AreEqual("023120015226972", p.bban);
+
315 Assert::IsTrue(p.match("SI56 0231 2001 5226 972", 0, SIZE_MAX));
+
316 Assert::IsTrue(p.is_valid);
+
317 Assert::AreEqual("SI", p.country);
+
318 Assert::AreEqual("56", p.check_digits);
+
319 Assert::AreEqual("023120015226972", p.bban);
+
320 Assert::IsFalse(p.match("si56 0231 2001 5226 972", 0, SIZE_MAX));
321 Assert::IsFalse(p.is_valid);
-
322 Assert::IsTrue(p.match("...SI56 0231 2001 5226 972...", 3, SIZE_MAX));
+
322 Assert::IsTrue(p.match("si56 0231 2001 5226 972", 0, SIZE_MAX, match_case_insensitive));
323 Assert::IsTrue(p.is_valid);
-
324 Assert::IsTrue(p.match("SI56&nbsp;0231&nbsp;2001&nbsp;5226&nbsp;972", 0, SIZE_MAX));
-
325 Assert::IsTrue(p.is_valid);
-
326 }
-
327
-
328 {
-
329 sgml_space_cp space;
-
330 sgml_creditor_reference p(make_shared_no_delete(&space));
-
331 Assert::IsTrue(p.match("RF18539007547034", 0, SIZE_MAX));
-
332 Assert::IsTrue(p.is_valid);
-
333 Assert::AreEqual("18", p.check_digits);
-
334 Assert::AreEqual("000000000539007547034", p.reference);
-
335 Assert::IsTrue(p.match("RF18 5390 0754 7034", 0, SIZE_MAX));
-
336 Assert::IsTrue(p.is_valid);
-
337 Assert::AreEqual("18", p.check_digits);
-
338 Assert::AreEqual("000000000539007547034", p.reference);
-
339 Assert::IsFalse(p.match("rf18 5390 0754 7034", 0, SIZE_MAX));
-
340 Assert::IsFalse(p.is_valid);
-
341 Assert::IsTrue(p.match("rf18 5390 0754 7034", 0, SIZE_MAX, match_case_insensitive));
-
342 Assert::IsTrue(p.is_valid);
-
343 Assert::IsTrue(p.match("RF18 5390 0754 70340", 0, SIZE_MAX));
-
344 Assert::IsFalse(p.is_valid);
-
345 Assert::IsTrue(p.match("...RF18 5390 0754 7034...", 3, SIZE_MAX));
-
346 Assert::IsTrue(p.is_valid);
-
347 Assert::IsTrue(p.match("RF18&nbsp;5390&nbsp;0754&nbsp;7034", 0, SIZE_MAX));
-
348 Assert::IsTrue(p.is_valid);
-
349 }
-
350
-
351 {
-
352 sgml_space_cp space;
-
353 sgml_si_reference p(make_shared_no_delete(&space));
-
354 Assert::IsTrue(p.match("SI121234567890120", 0, SIZE_MAX));
-
355 Assert::IsTrue(p.is_valid);
-
356 Assert::AreEqual("12", p.model);
-
357 Assert::AreEqual(stdex::interval<size_t>(4, 17), p.part1.interval);
-
358 Assert::IsTrue(p.match("SI12 1234567890120", 0, SIZE_MAX));
-
359 Assert::IsTrue(p.is_valid);
-
360 Assert::AreEqual("12", p.model);
-
361 Assert::AreEqual(stdex::interval<size_t>(5, 18), p.part1.interval);
-
362 Assert::IsFalse(p.match("si12 1234567890120", 0, SIZE_MAX));
-
363 Assert::IsTrue(p.match("si12 1234567890120", 0, SIZE_MAX, match_case_insensitive));
-
364 Assert::IsTrue(p.match("...SI12 1234567890120...", 3, SIZE_MAX));
-
365 Assert::IsTrue(p.match("SI12&nbsp;1234567890120", 0, SIZE_MAX));
-
366 }
-
367 }
-
368
-
369 TEST_METHOD(http_test)
-
370 {
-
371 static const std::locale locale("en_US.UTF-8");
-
372 static const char request[] =
-
373 "GET / HTTP/2\r\n"
-
374 "Host: stackoverflow.com\r\n"
-
375 "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0\r\n"
-
376 "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\r\n"
-
377 "Accept-Language: sl,en-US;q=0.8,en;q=0.6,de-DE;q=0.4,de;q=0.2\r\n"
-
378 "Accept-Encoding: gzip, deflate, br\r\n"
-
379 "DNT: 1\r\n"
-
380 "Connection: keep-alive\r\n"
-
381 "Cookie: prov=00000000-0000-0000-0000-000000000000; acct=t=00000000000000000%2f%2f0000%2b0000%2b000&s=00000000000000000000000000000000; OptanonConsent=isGpcEnabled=0&datestamp=Fri+Feb+03+2023+11%3A11%3A08+GMT%2B0100+(Srednjeevropski+standardni+%C4%8Das)&version=6.37.0&isIABGlobal=false&hosts=&consentId=00000000-0000-0000-0000-000000000000&interactionCount=1&landingPath=NotLandingPage&groups=00000%3A0%2C00000%3A0%2C00000%3A0%2C00000%3A0; OptanonAlertBoxClosed=2023-02-03T10:11:08.683Z\r\n"
-
382 "Upgrade-Insecure-Requests: 1\r\n"
-
383 "Sec-Fetch-Dest: document\r\n"
-
384 "Sec-Fetch-Mode: navigate\r\n"
-
385 "Sec-Fetch-Site: none\r\n"
-
386 "Sec-Fetch-User: ?1\r\n"
-
387 "Pragma: no-cache\r\n"
-
388 "Cache-Control: no-cache\r\n"
-
389 "\r\n";
-
390
-
391 {
-
392 http_request p(locale);
-
393 Assert::IsTrue(p.match(request));
-
394 Assert::AreEqual((size_t)0, p.interval.start);
-
395 Assert::AreEqual((size_t)14, p.interval.end);
-
396 Assert::AreEqual((size_t)0, p.verb.start);
-
397 Assert::AreEqual((size_t)3, p.verb.end);
-
398 Assert::AreEqual((size_t)4, p.url.interval.start);
-
399 Assert::AreEqual((size_t)5, p.url.interval.end);
-
400 Assert::AreEqual((size_t)6, p.protocol.interval.start);
-
401 Assert::AreEqual((size_t)12, p.protocol.interval.end);
-
402 Assert::AreEqual((uint16_t)0x200, p.protocol.version);
-
403 }
-
404
-
405 {
-
406 std::list<http_header> hdrs;
-
407 size_t offset = 14;
-
408 for (;;) {
-
409 http_header h;
-
410 if (h.match(request, offset)) {
-
411 offset = h.interval.end;
-
412 hdrs.push_back(std::move(h));
-
413 }
-
414 else
-
415 break;
-
416 }
-
417 Assert::AreEqual((size_t)15, hdrs.size());
-
418 http_weighted_collection<http_weighted_value<http_language>> langs;
-
419 for (const auto& h : hdrs)
-
420 if (strnicmp(request + h.name.start, h.name.size(), "Accept-Language", (size_t)-1, locale) == 0)
-
421 langs.insert(request, h.value.start, h.value.end);
-
422 Assert::IsTrue(!langs.empty());
-
423 {
-
424 const vector<std::string> control = {
-
425 "sl", "en-US", "en", "de-DE", "de"
-
426 };
-
427 auto c = control.cbegin();
-
428 auto l = langs.cbegin();
-
429 for (; c != control.cend() && l != langs.cend(); ++c, ++l)
-
430 Assert::IsTrue(strnicmp(request + l->value.interval.start, l->value.interval.size(), c->c_str(), c->size(), locale) == 0);
-
431 Assert::IsTrue(c == control.cend());
-
432 Assert::IsTrue(l == langs.cend());
-
433 }
-
434 }
-
435
-
436 //static const char response[] =
-
437 // "HTTP/2 200 OK\r\n"
-
438 // "cache-control: private\r\n"
-
439 // "content-type: text/html; charset=utf-8\r\n"
-
440 // "content-encoding: gzip\r\n"
-
441 // "strict-transport-security: max-age=15552000\r\n"
-
442 // "x-frame-options: SAMEORIGIN\r\n"
-
443 // "set-cookie: acct=t=00000000000000000%2f%2f0000%2b0000%2b000&s=00000000000000000000000000000000; expires=Sat, 16 Sep 2023 10:23:00 GMT; domain=.stackoverflow.com; path=/; secure; samesite=none; httponly\r\n"
-
444 // "set-cookie: prov_tgt=; expires=Tue, 14 Mar 2023 10:23:00 GMT; domain=.stackoverflow.com; path=/; secure; samesite=none; httponly\r\n"
-
445 // "x-request-guid: a6536a49-b473-4c6f-b313-c1e7c0d8f600\r\n"
-
446 // "feature-policy: microphone 'none'; speaker 'none'\r\n"
-
447 // "content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com\r\n"
-
448 // "accept-ranges: bytes\r\n"
-
449 // "date: Thu, 16 Mar 2023 10:23:00 GMT\r\n"
-
450 // "via: 1.1 varnish\r\n"
-
451 // "x-served-by: cache-vie6354-VIE\r\n"
-
452 // "x-cache: MISS\r\n"
-
453 // "x-cache-hits: 0\r\n"
-
454 // "x-timer: S1678962181.533907,VS0,VE144\r\n"
-
455 // "vary: Accept-Encoding,Fastly-SSL\r\n"
-
456 // "x-dns-prefetch-control: off\r\n"
-
457 // "X-Firefox-Spdy: h2\r\n"
-
458 // "\r\n";
-
459 }
-
460 };
-
461}
+
324 Assert::IsTrue(p.match("SI56 0231 2001 5226 9720", 0, SIZE_MAX));
+
325 Assert::IsFalse(p.is_valid);
+
326 Assert::IsTrue(p.match("...SI56 0231 2001 5226 972...", 3, SIZE_MAX));
+
327 Assert::IsTrue(p.is_valid);
+
328 Assert::IsTrue(p.match("SI56&nbsp;0231&nbsp;2001&nbsp;5226&nbsp;972", 0, SIZE_MAX));
+
329 Assert::IsTrue(p.is_valid);
+
330 }
+
331
+
332 {
+
333 std::locale locale_slSI("sl_SI");
+
334 sgml_space_cp space(false, locale_slSI);
+
335 sgml_creditor_reference p(make_shared_no_delete(&space), locale_slSI);
+
336 Assert::IsTrue(p.match("RF18539007547034", 0, SIZE_MAX));
+
337 Assert::IsTrue(p.is_valid);
+
338 Assert::AreEqual("18", p.check_digits);
+
339 Assert::AreEqual("000000000539007547034", p.reference);
+
340 Assert::IsTrue(p.match("RF18 5390 0754 7034", 0, SIZE_MAX));
+
341 Assert::IsTrue(p.is_valid);
+
342 Assert::AreEqual("18", p.check_digits);
+
343 Assert::AreEqual("000000000539007547034", p.reference);
+
344 Assert::IsFalse(p.match("rf18 5390 0754 7034", 0, SIZE_MAX));
+
345 Assert::IsFalse(p.is_valid);
+
346 Assert::IsTrue(p.match("rf18 5390 0754 7034", 0, SIZE_MAX, match_case_insensitive));
+
347 Assert::IsTrue(p.is_valid);
+
348 Assert::IsTrue(p.match("RF18 5390 0754 70340", 0, SIZE_MAX));
+
349 Assert::IsFalse(p.is_valid);
+
350 Assert::IsTrue(p.match("...RF18 5390 0754 7034...", 3, SIZE_MAX));
+
351 Assert::IsTrue(p.is_valid);
+
352 Assert::IsTrue(p.match("RF18&nbsp;5390&nbsp;0754&nbsp;7034", 0, SIZE_MAX));
+
353 Assert::IsTrue(p.is_valid);
+
354 }
+
355
+
356 {
+
357 std::locale locale_slSI("sl_SI");
+
358 sgml_space_cp space(false, locale_slSI);
+
359 sgml_si_reference p(make_shared_no_delete(&space), locale_slSI);
+
360 Assert::IsTrue(p.match("SI121234567890120", 0, SIZE_MAX));
+
361 Assert::IsTrue(p.is_valid);
+
362 Assert::AreEqual("12", p.model);
+
363 Assert::AreEqual(stdex::interval<size_t>(4, 17), p.part1.interval);
+
364 Assert::IsTrue(p.match("SI12 1234567890120", 0, SIZE_MAX));
+
365 Assert::IsTrue(p.is_valid);
+
366 Assert::AreEqual("12", p.model);
+
367 Assert::AreEqual(stdex::interval<size_t>(5, 18), p.part1.interval);
+
368 Assert::IsFalse(p.match("si12 1234567890120", 0, SIZE_MAX));
+
369 Assert::IsTrue(p.match("si12 1234567890120", 0, SIZE_MAX, match_case_insensitive));
+
370 Assert::IsTrue(p.match("...SI12 1234567890120...", 3, SIZE_MAX));
+
371 Assert::IsTrue(p.match("SI12&nbsp;1234567890120", 0, SIZE_MAX));
+
372 }
+
373 }
+
374
+
375 TEST_METHOD(http_test)
+
376 {
+
377 static const std::locale locale("en_US.UTF-8");
+
378 static const char request[] =
+
379 "GET / HTTP/2\r\n"
+
380 "Host: stackoverflow.com\r\n"
+
381 "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0\r\n"
+
382 "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\r\n"
+
383 "Accept-Language: sl,en-US;q=0.8,en;q=0.6,de-DE;q=0.4,de;q=0.2\r\n"
+
384 "Accept-Encoding: gzip, deflate, br\r\n"
+
385 "DNT: 1\r\n"
+
386 "Connection: keep-alive\r\n"
+
387 "Cookie: prov=00000000-0000-0000-0000-000000000000; acct=t=00000000000000000%2f%2f0000%2b0000%2b000&s=00000000000000000000000000000000; OptanonConsent=isGpcEnabled=0&datestamp=Fri+Feb+03+2023+11%3A11%3A08+GMT%2B0100+(Srednjeevropski+standardni+%C4%8Das)&version=6.37.0&isIABGlobal=false&hosts=&consentId=00000000-0000-0000-0000-000000000000&interactionCount=1&landingPath=NotLandingPage&groups=00000%3A0%2C00000%3A0%2C00000%3A0%2C00000%3A0; OptanonAlertBoxClosed=2023-02-03T10:11:08.683Z\r\n"
+
388 "Upgrade-Insecure-Requests: 1\r\n"
+
389 "Sec-Fetch-Dest: document\r\n"
+
390 "Sec-Fetch-Mode: navigate\r\n"
+
391 "Sec-Fetch-Site: none\r\n"
+
392 "Sec-Fetch-User: ?1\r\n"
+
393 "Pragma: no-cache\r\n"
+
394 "Cache-Control: no-cache\r\n"
+
395 "\r\n";
+
396
+
397 {
+
398 http_request p(locale);
+
399 Assert::IsTrue(p.match(request));
+
400 Assert::AreEqual((size_t)0, p.interval.start);
+
401 Assert::AreEqual((size_t)14, p.interval.end);
+
402 Assert::AreEqual((size_t)0, p.verb.start);
+
403 Assert::AreEqual((size_t)3, p.verb.end);
+
404 Assert::AreEqual((size_t)4, p.url.interval.start);
+
405 Assert::AreEqual((size_t)5, p.url.interval.end);
+
406 Assert::AreEqual((size_t)6, p.protocol.interval.start);
+
407 Assert::AreEqual((size_t)12, p.protocol.interval.end);
+
408 Assert::AreEqual((uint16_t)0x200, p.protocol.version);
+
409 }
+
410
+
411 {
+
412 std::list<http_header> hdrs;
+
413 size_t offset = 14;
+
414 for (;;) {
+
415 http_header h;
+
416 if (h.match(request, offset)) {
+
417 offset = h.interval.end;
+
418 hdrs.push_back(std::move(h));
+
419 }
+
420 else
+
421 break;
+
422 }
+
423 Assert::AreEqual((size_t)15, hdrs.size());
+
424 http_weighted_collection<http_weighted_value<http_language>> langs;
+
425 for (const auto& h : hdrs)
+
426 if (strnicmp(request + h.name.start, h.name.size(), "Accept-Language", (size_t)-1, locale) == 0)
+
427 langs.insert(request, h.value.start, h.value.end);
+
428 Assert::IsTrue(!langs.empty());
+
429 {
+
430 const vector<std::string> control = {
+
431 "sl", "en-US", "en", "de-DE", "de"
+
432 };
+
433 auto c = control.cbegin();
+
434 auto l = langs.cbegin();
+
435 for (; c != control.cend() && l != langs.cend(); ++c, ++l)
+
436 Assert::IsTrue(strnicmp(request + l->value.interval.start, l->value.interval.size(), c->c_str(), c->size(), locale) == 0);
+
437 Assert::IsTrue(c == control.cend());
+
438 Assert::IsTrue(l == langs.cend());
+
439 }
+
440 }
+
441
+
442 //static const char response[] =
+
443 // "HTTP/2 200 OK\r\n"
+
444 // "cache-control: private\r\n"
+
445 // "content-type: text/html; charset=utf-8\r\n"
+
446 // "content-encoding: gzip\r\n"
+
447 // "strict-transport-security: max-age=15552000\r\n"
+
448 // "x-frame-options: SAMEORIGIN\r\n"
+
449 // "set-cookie: acct=t=00000000000000000%2f%2f0000%2b0000%2b000&s=00000000000000000000000000000000; expires=Sat, 16 Sep 2023 10:23:00 GMT; domain=.stackoverflow.com; path=/; secure; samesite=none; httponly\r\n"
+
450 // "set-cookie: prov_tgt=; expires=Tue, 14 Mar 2023 10:23:00 GMT; domain=.stackoverflow.com; path=/; secure; samesite=none; httponly\r\n"
+
451 // "x-request-guid: a6536a49-b473-4c6f-b313-c1e7c0d8f600\r\n"
+
452 // "feature-policy: microphone 'none'; speaker 'none'\r\n"
+
453 // "content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com\r\n"
+
454 // "accept-ranges: bytes\r\n"
+
455 // "date: Thu, 16 Mar 2023 10:23:00 GMT\r\n"
+
456 // "via: 1.1 varnish\r\n"
+
457 // "x-served-by: cache-vie6354-VIE\r\n"
+
458 // "x-cache: MISS\r\n"
+
459 // "x-cache-hits: 0\r\n"
+
460 // "x-timer: S1678962181.533907,VS0,VE144\r\n"
+
461 // "vary: Accept-Encoding,Fastly-SSL\r\n"
+
462 // "x-dns-prefetch-control: off\r\n"
+
463 // "X-Firefox-Spdy: h2\r\n"
+
464 // "\r\n";
+
465 }
+
466 };
+
467}
interval< size_t > interval
Region of the last match.
Definition parser.hpp:170
Test for given string.
Definition parser.hpp:816
-
Test for HTTP header.
Definition parser.hpp:7157
-
Test for HTTP request.
Definition parser.hpp:7019
+
Test for HTTP header.
Definition parser.hpp:7156
+
Test for HTTP request.
Definition parser.hpp:7018
Test for specific SGML code point.
Definition parser.hpp:341
Test for any SGML space code point.
Definition parser.hpp:428
Numerical interval.
Definition interval.hpp:18
@@ -557,7 +563,7 @@ $(document).ready(function() { init_codefold(0); }); diff --git a/parser_8hpp_source.html b/parser_8hpp_source.html index 89849f45f..ec18ce4d8 100644 --- a/parser_8hpp_source.html +++ b/parser_8hpp_source.html @@ -486,7 +486,7 @@ $(document).ready(function() { init_codefold(0); });
415
416 using space_cu = basic_space_cu<char>;
-
417 using wspace_cu = basic_space_cu<wchar_t>;
+
417 using wspace_cu = basic_space_cu<wchar_t>;
418#ifdef _UNICODE
419 using tspace_cu = wspace_cu;
420#else
@@ -4710,146 +4710,146 @@ $(document).ready(function() { init_codefold(0); });
4692 assert(text || start >= end);
4693 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4694 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
4695
-
4696 this->interval.end = start;
-
4697 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
4698 if (this->interval.end >= end || !text[this->interval.end])
-
4699 goto error; // incomplete country code
-
4700 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
-
4701 if (chr < 'A' || 'Z' < chr)
-
4702 goto error; // invalid country code
-
4703 this->country[i] = chr;
-
4704 }
-
4705 this->country[2] = 0;
-
4706
-
4707 struct country_t {
-
4708 T country[2];
-
4709 T check_digits[2];
-
4710 size_t length;
-
4711 };
-
4712 static const country_t s_countries[] = {
-
4713 { { 'A', 'D' }, {}, 24 }, // Andorra
-
4714 { { 'A', 'E' }, {}, 23 }, // United Arab Emirates
-
4715 { { 'A', 'L' }, {}, 28 }, // Albania
-
4716 { { 'A', 'O' }, {}, 25 }, // Angola
-
4717 { { 'A', 'T' }, {}, 20 }, // Austria
-
4718 { { 'A', 'Z' }, {}, 28 }, // Azerbaijan
-
4719 { { 'B', 'A' }, { '3', '9' }, 20}, // Bosnia and Herzegovina
-
4720 { { 'B', 'E' }, {}, 16 }, // Belgium
-
4721 { { 'B', 'F' }, {}, 28 }, // Burkina Faso
-
4722 { { 'B', 'G' }, {}, 22 }, // Bulgaria
-
4723 { { 'B', 'H' }, {}, 22 }, // Bahrain
-
4724 { { 'B', 'I' }, {}, 27 }, // Burundi
-
4725 { { 'B', 'J' }, {}, 28 }, // Benin
-
4726 { { 'B', 'R' }, {}, 29 }, // Brazil
-
4727 { { 'B', 'Y' }, {}, 28 }, // Belarus
-
4728 { { 'C', 'F' }, {}, 27 }, // Central African Republic
-
4729 { { 'C', 'G' }, {}, 27 }, // Congo, Republic of the
-
4730 { { 'C', 'H' }, {}, 21 }, // Switzerland
-
4731 { { 'C', 'I' }, {}, 28 }, // Côte d'Ivoire
-
4732 { { 'C', 'M' }, {}, 27 }, // Cameroon
-
4733 { { 'C', 'R' }, {}, 22 }, // Costa Rica
-
4734 { { 'C', 'V' }, {}, 25 }, // Cabo Verde
-
4735 { { 'C', 'Y' }, {}, 28 }, // Cyprus
-
4736 { { 'C', 'Z' }, {}, 24 }, // Czech Republic
-
4737 { { 'D', 'E' }, {}, 22 }, // Germany
-
4738 { { 'D', 'J' }, {}, 27 }, // Djibouti
-
4739 { { 'D', 'K' }, {}, 18 }, // Denmark
-
4740 { { 'D', 'O' }, {}, 28 }, // Dominican Republic
-
4741 { { 'D', 'Z' }, {}, 26 }, // Algeria
-
4742 { { 'E', 'E' }, {}, 20 }, // Estonia
-
4743 { { 'E', 'G' }, {}, 29 }, // Egypt
-
4744 { { 'E', 'S' }, {}, 24 }, // Spain
-
4745 { { 'F', 'I' }, {}, 18 }, // Finland
-
4746 { { 'F', 'O' }, {}, 18 }, // Faroe Islands
-
4747 { { 'F', 'R' }, {}, 27 }, // France
-
4748 { { 'G', 'A' }, {}, 27 }, // Gabon
-
4749 { { 'G', 'B' }, {}, 22 }, // United Kingdom
-
4750 { { 'G', 'E' }, {}, 22 }, // Georgia
-
4751 { { 'G', 'I' }, {}, 23 }, // Gibraltar
-
4752 { { 'G', 'L' }, {}, 18 }, // Greenland
-
4753 { { 'G', 'Q' }, {}, 27 }, // Equatorial Guinea
-
4754 { { 'G', 'R' }, {}, 27 }, // Greece
-
4755 { { 'G', 'T' }, {}, 28 }, // Guatemala
-
4756 { { 'G', 'W' }, {}, 25 }, // Guinea-Bissau
-
4757 { { 'H', 'N' }, {}, 28 }, // Honduras
-
4758 { { 'H', 'R' }, {}, 21 }, // Croatia
-
4759 { { 'H', 'U' }, {}, 28 }, // Hungary
-
4760 { { 'I', 'E' }, {}, 22 }, // Ireland
-
4761 { { 'I', 'L' }, {}, 23 }, // Israel
-
4762 { { 'I', 'Q' }, {}, 23 }, // Iraq
-
4763 { { 'I', 'R' }, {}, 26 }, // Iran
-
4764 { { 'I', 'S' }, {}, 26 }, // Iceland
-
4765 { { 'I', 'T' }, {}, 27 }, // Italy
-
4766 { { 'J', 'O' }, {}, 30 }, // Jordan
-
4767 { { 'K', 'M' }, {}, 27 }, // Comoros
-
4768 { { 'K', 'W' }, {}, 30 }, // Kuwait
-
4769 { { 'K', 'Z' }, {}, 20 }, // Kazakhstan
-
4770 { { 'L', 'B' }, {}, 28 }, // Lebanon
-
4771 { { 'L', 'C' }, {}, 32 }, // Saint Lucia
-
4772 { { 'L', 'I' }, {}, 21 }, // Liechtenstein
-
4773 { { 'L', 'T' }, {}, 20 }, // Lithuania
-
4774 { { 'L', 'U' }, {}, 20 }, // Luxembourg
-
4775 { { 'L', 'V' }, {}, 21 }, // Latvia
-
4776 { { 'L', 'Y' }, {}, 25 }, // Libya
-
4777 { { 'M', 'A' }, {}, 28 }, // Morocco
-
4778 { { 'M', 'C' }, {}, 27 }, // Monaco
-
4779 { { 'M', 'D' }, {}, 24 }, // Moldova
-
4780 { { 'M', 'E' }, { '2', '5' }, 22 }, // Montenegro
-
4781 { { 'M', 'G' }, {}, 27 }, // Madagascar
-
4782 { { 'M', 'K' }, { '0', '7' }, 19 }, // North Macedonia
-
4783 { { 'M', 'L' }, {}, 28 }, // Mali
-
4784 { { 'M', 'R' }, { '1', '3' }, 27}, // Mauritania
-
4785 { { 'M', 'T' }, {}, 31 }, // Malta
-
4786 { { 'M', 'U' }, {}, 30 }, // Mauritius
-
4787 { { 'M', 'Z' }, {}, 25 }, // Mozambique
-
4788 { { 'N', 'E' }, {}, 28 }, // Niger
-
4789 { { 'N', 'I' }, {}, 32 }, // Nicaragua
-
4790 { { 'N', 'L' }, {}, 18 }, // Netherlands
-
4791 { { 'N', 'O' }, {}, 15 }, // Norway
-
4792 { { 'P', 'K' }, {}, 24 }, // Pakistan
-
4793 { { 'P', 'L' }, {}, 28 }, // Poland
-
4794 { { 'P', 'S' }, {}, 29 }, // Palestinian territories
-
4795 { { 'P', 'T' }, { '5', '0' }, 25 }, // Portugal
-
4796 { { 'Q', 'A' }, {}, 29 }, // Qatar
-
4797 { { 'R', 'O' }, {}, 24 }, // Romania
-
4798 { { 'R', 'S' }, { '3', '5' }, 22 }, // Serbia
-
4799 { { 'R', 'U' }, {}, 33 }, // Russia
-
4800 { { 'S', 'A' }, {}, 24 }, // Saudi Arabia
-
4801 { { 'S', 'C' }, {}, 31 }, // Seychelles
-
4802 { { 'S', 'D' }, {}, 18 }, // Sudan
-
4803 { { 'S', 'E' }, {}, 24 }, // Sweden
-
4804 { { 'S', 'I' }, { '5', '6' }, 19 }, // Slovenia
-
4805 { { 'S', 'K' }, {}, 24 }, // Slovakia
-
4806 { { 'S', 'M' }, {}, 27 }, // San Marino
-
4807 { { 'S', 'N' }, {}, 28 }, // Senegal
-
4808 { { 'S', 'T' }, {}, 25 }, // São Tomé and Príncipe
-
4809 { { 'S', 'V' }, {}, 28 }, // El Salvador
-
4810 { { 'T', 'D' }, {}, 27 }, // Chad
-
4811 { { 'T', 'G' }, {}, 28 }, // Togo
-
4812 { { 'T', 'L' }, { '3', '8' }, 23}, // East Timor
-
4813 { { 'T', 'N' }, { '5', '9' }, 24 }, // Tunisia
-
4814 { { 'T', 'R' }, {}, 26 }, // Turkey
-
4815 { { 'U', 'A' }, {}, 29 }, // Ukraine
-
4816 { { 'V', 'A' }, {}, 22 }, // Vatican City
-
4817 { { 'V', 'G' }, {}, 24 }, // Virgin Islands, British
-
4818 { { 'X', 'K' }, {}, 20 }, // Kosovo
-
4819 };
-
4820 const country_t* country_desc = nullptr;
-
4821 for (size_t l = 0, r = _countof(s_countries);;) {
-
4822 if (l >= r)
-
4823 goto error; // unknown country
-
4824 size_t m = (l + r) / 2;
-
4825 const country_t& c = s_countries[m];
-
4826 if (c.country[0] < this->country[0] || (c.country[0] == this->country[0] && c.country[1] < this->country[1]))
-
4827 l = m + 1;
-
4828 else if (this->country[0] < c.country[0] || (this->country[0] == c.country[0] && this->country[1] < c.country[1]))
-
4829 r = m;
-
4830 else {
-
4831 country_desc = &c;
-
4832 break;
-
4833 }
-
4834 }
+
4695 struct country_t {
+
4696 T country[2];
+
4697 T check_digits[2];
+
4698 size_t length;
+
4699 };
+
4700 static const country_t s_countries[] = {
+
4701 { { 'A', 'D' }, {}, 24 }, // Andorra
+
4702 { { 'A', 'E' }, {}, 23 }, // United Arab Emirates
+
4703 { { 'A', 'L' }, {}, 28 }, // Albania
+
4704 { { 'A', 'O' }, {}, 25 }, // Angola
+
4705 { { 'A', 'T' }, {}, 20 }, // Austria
+
4706 { { 'A', 'Z' }, {}, 28 }, // Azerbaijan
+
4707 { { 'B', 'A' }, { '3', '9' }, 20}, // Bosnia and Herzegovina
+
4708 { { 'B', 'E' }, {}, 16 }, // Belgium
+
4709 { { 'B', 'F' }, {}, 28 }, // Burkina Faso
+
4710 { { 'B', 'G' }, {}, 22 }, // Bulgaria
+
4711 { { 'B', 'H' }, {}, 22 }, // Bahrain
+
4712 { { 'B', 'I' }, {}, 27 }, // Burundi
+
4713 { { 'B', 'J' }, {}, 28 }, // Benin
+
4714 { { 'B', 'R' }, {}, 29 }, // Brazil
+
4715 { { 'B', 'Y' }, {}, 28 }, // Belarus
+
4716 { { 'C', 'F' }, {}, 27 }, // Central African Republic
+
4717 { { 'C', 'G' }, {}, 27 }, // Congo, Republic of the
+
4718 { { 'C', 'H' }, {}, 21 }, // Switzerland
+
4719 { { 'C', 'I' }, {}, 28 }, // Côte d'Ivoire
+
4720 { { 'C', 'M' }, {}, 27 }, // Cameroon
+
4721 { { 'C', 'R' }, {}, 22 }, // Costa Rica
+
4722 { { 'C', 'V' }, {}, 25 }, // Cabo Verde
+
4723 { { 'C', 'Y' }, {}, 28 }, // Cyprus
+
4724 { { 'C', 'Z' }, {}, 24 }, // Czech Republic
+
4725 { { 'D', 'E' }, {}, 22 }, // Germany
+
4726 { { 'D', 'J' }, {}, 27 }, // Djibouti
+
4727 { { 'D', 'K' }, {}, 18 }, // Denmark
+
4728 { { 'D', 'O' }, {}, 28 }, // Dominican Republic
+
4729 { { 'D', 'Z' }, {}, 26 }, // Algeria
+
4730 { { 'E', 'E' }, {}, 20 }, // Estonia
+
4731 { { 'E', 'G' }, {}, 29 }, // Egypt
+
4732 { { 'E', 'S' }, {}, 24 }, // Spain
+
4733 { { 'F', 'I' }, {}, 18 }, // Finland
+
4734 { { 'F', 'O' }, {}, 18 }, // Faroe Islands
+
4735 { { 'F', 'R' }, {}, 27 }, // France
+
4736 { { 'G', 'A' }, {}, 27 }, // Gabon
+
4737 { { 'G', 'B' }, {}, 22 }, // United Kingdom
+
4738 { { 'G', 'E' }, {}, 22 }, // Georgia
+
4739 { { 'G', 'I' }, {}, 23 }, // Gibraltar
+
4740 { { 'G', 'L' }, {}, 18 }, // Greenland
+
4741 { { 'G', 'Q' }, {}, 27 }, // Equatorial Guinea
+
4742 { { 'G', 'R' }, {}, 27 }, // Greece
+
4743 { { 'G', 'T' }, {}, 28 }, // Guatemala
+
4744 { { 'G', 'W' }, {}, 25 }, // Guinea-Bissau
+
4745 { { 'H', 'N' }, {}, 28 }, // Honduras
+
4746 { { 'H', 'R' }, {}, 21 }, // Croatia
+
4747 { { 'H', 'U' }, {}, 28 }, // Hungary
+
4748 { { 'I', 'E' }, {}, 22 }, // Ireland
+
4749 { { 'I', 'L' }, {}, 23 }, // Israel
+
4750 { { 'I', 'Q' }, {}, 23 }, // Iraq
+
4751 { { 'I', 'R' }, {}, 26 }, // Iran
+
4752 { { 'I', 'S' }, {}, 26 }, // Iceland
+
4753 { { 'I', 'T' }, {}, 27 }, // Italy
+
4754 { { 'J', 'O' }, {}, 30 }, // Jordan
+
4755 { { 'K', 'M' }, {}, 27 }, // Comoros
+
4756 { { 'K', 'W' }, {}, 30 }, // Kuwait
+
4757 { { 'K', 'Z' }, {}, 20 }, // Kazakhstan
+
4758 { { 'L', 'B' }, {}, 28 }, // Lebanon
+
4759 { { 'L', 'C' }, {}, 32 }, // Saint Lucia
+
4760 { { 'L', 'I' }, {}, 21 }, // Liechtenstein
+
4761 { { 'L', 'T' }, {}, 20 }, // Lithuania
+
4762 { { 'L', 'U' }, {}, 20 }, // Luxembourg
+
4763 { { 'L', 'V' }, {}, 21 }, // Latvia
+
4764 { { 'L', 'Y' }, {}, 25 }, // Libya
+
4765 { { 'M', 'A' }, {}, 28 }, // Morocco
+
4766 { { 'M', 'C' }, {}, 27 }, // Monaco
+
4767 { { 'M', 'D' }, {}, 24 }, // Moldova
+
4768 { { 'M', 'E' }, { '2', '5' }, 22 }, // Montenegro
+
4769 { { 'M', 'G' }, {}, 27 }, // Madagascar
+
4770 { { 'M', 'K' }, { '0', '7' }, 19 }, // North Macedonia
+
4771 { { 'M', 'L' }, {}, 28 }, // Mali
+
4772 { { 'M', 'R' }, { '1', '3' }, 27}, // Mauritania
+
4773 { { 'M', 'T' }, {}, 31 }, // Malta
+
4774 { { 'M', 'U' }, {}, 30 }, // Mauritius
+
4775 { { 'M', 'Z' }, {}, 25 }, // Mozambique
+
4776 { { 'N', 'E' }, {}, 28 }, // Niger
+
4777 { { 'N', 'I' }, {}, 32 }, // Nicaragua
+
4778 { { 'N', 'L' }, {}, 18 }, // Netherlands
+
4779 { { 'N', 'O' }, {}, 15 }, // Norway
+
4780 { { 'P', 'K' }, {}, 24 }, // Pakistan
+
4781 { { 'P', 'L' }, {}, 28 }, // Poland
+
4782 { { 'P', 'S' }, {}, 29 }, // Palestinian territories
+
4783 { { 'P', 'T' }, { '5', '0' }, 25 }, // Portugal
+
4784 { { 'Q', 'A' }, {}, 29 }, // Qatar
+
4785 { { 'R', 'O' }, {}, 24 }, // Romania
+
4786 { { 'R', 'S' }, { '3', '5' }, 22 }, // Serbia
+
4787 { { 'R', 'U' }, {}, 33 }, // Russia
+
4788 { { 'S', 'A' }, {}, 24 }, // Saudi Arabia
+
4789 { { 'S', 'C' }, {}, 31 }, // Seychelles
+
4790 { { 'S', 'D' }, {}, 18 }, // Sudan
+
4791 { { 'S', 'E' }, {}, 24 }, // Sweden
+
4792 { { 'S', 'I' }, { '5', '6' }, 19 }, // Slovenia
+
4793 { { 'S', 'K' }, {}, 24 }, // Slovakia
+
4794 { { 'S', 'M' }, {}, 27 }, // San Marino
+
4795 { { 'S', 'N' }, {}, 28 }, // Senegal
+
4796 { { 'S', 'T' }, {}, 25 }, // São Tomé and Príncipe
+
4797 { { 'S', 'V' }, {}, 28 }, // El Salvador
+
4798 { { 'T', 'D' }, {}, 27 }, // Chad
+
4799 { { 'T', 'G' }, {}, 28 }, // Togo
+
4800 { { 'T', 'L' }, { '3', '8' }, 23}, // East Timor
+
4801 { { 'T', 'N' }, { '5', '9' }, 24 }, // Tunisia
+
4802 { { 'T', 'R' }, {}, 26 }, // Turkey
+
4803 { { 'U', 'A' }, {}, 29 }, // Ukraine
+
4804 { { 'V', 'A' }, {}, 22 }, // Vatican City
+
4805 { { 'V', 'G' }, {}, 24 }, // Virgin Islands, British
+
4806 { { 'X', 'K' }, {}, 20 }, // Kosovo
+
4807 };
+
4808 const country_t* country_desc = nullptr;
+
4809 size_t n;
+
4810
+
4811 this->interval.end = start;
+
4812 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
+
4813 if (this->interval.end >= end || !text[this->interval.end])
+
4814 goto error; // incomplete country code
+
4815 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
+
4816 if (chr < 'A' || 'Z' < chr)
+
4817 goto error; // invalid country code
+
4818 this->country[i] = chr;
+
4819 }
+
4820 for (size_t l = 0, r = _countof(s_countries);;) {
+
4821 if (l >= r)
+
4822 goto error; // unknown country
+
4823 size_t m = (l + r) / 2;
+
4824 const country_t& c = s_countries[m];
+
4825 if (c.country[0] < this->country[0] || (c.country[0] == this->country[0] && c.country[1] < this->country[1]))
+
4826 l = m + 1;
+
4827 else if (this->country[0] < c.country[0] || (this->country[0] == c.country[0] && this->country[1] < c.country[1]))
+
4828 r = m;
+
4829 else {
+
4830 country_desc = &c;
+
4831 break;
+
4832 }
+
4833 }
+
4834 this->country[2] = 0;
4835
4836 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
4837 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
@@ -4862,170 +4862,170 @@ $(document).ready(function() { init_codefold(0); });
4844 (country_desc->check_digits[1] && this->check_digits[1] != country_desc->check_digits[1]))
4845 goto error; // unexpected check digits
4846
-
4847 size_t n = 0;
-
4848 for (; ;) {
-
4849 if (m_space && m_space->match(text, this->interval.end, end, flags))
-
4850 this->interval.end = m_space->interval.end;
-
4851 for (size_t j = 0; j < 4; ++j) {
-
4852 if (this->interval.end >= end || !text[this->interval.end])
-
4853 goto out;
-
4854 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
-
4855 if (('0' <= chr && chr <= '9') || ('A' <= chr && chr <= 'Z')) {
-
4856 if (n >= _countof(this->bban) - 1)
-
4857 goto error; // bban overflow
-
4858 this->bban[n++] = chr;
-
4859 this->interval.end++;
-
4860 }
-
4861 else
-
4862 goto out;
-
4863 }
-
4864 }
-
4865 out:
-
4866 if (n < 11)
-
4867 goto error; // bban too short (shorter than Norwegian)
-
4868 this->bban[n] = 0;
-
4869
-
4870 if (n + 4 == country_desc->length) {
-
4871 // Normalize IBAN.
-
4872 T normalized[69];
-
4873 size_t available = 0;
-
4874 for (size_t i = 0; ; ++i) {
-
4875 if (!this->bban[i]) {
-
4876 for (i = 0; i < 2; ++i) {
-
4877 if ('A' <= this->country[i] && this->country[i] <= 'J') {
-
4878 normalized[available++] = '1';
-
4879 normalized[available++] = '0' + this->country[i] - 'A';
-
4880 }
-
4881 else if ('K' <= this->country[i] && this->country[i] <= 'T') {
-
4882 normalized[available++] = '2';
-
4883 normalized[available++] = '0' + this->country[i] - 'K';
-
4884 }
-
4885 else if ('U' <= this->country[i] && this->country[i] <= 'Z') {
-
4886 normalized[available++] = '3';
-
4887 normalized[available++] = '0' + this->country[i] - 'U';
-
4888 }
-
4889 }
-
4890 normalized[available++] = this->check_digits[0];
-
4891 normalized[available++] = this->check_digits[1];
-
4892 normalized[available] = 0;
-
4893 break;
-
4894 }
-
4895 if ('0' <= this->bban[i] && this->bban[i] <= '9')
-
4896 normalized[available++] = this->bban[i];
-
4897 else if ('A' <= this->bban[i] && this->bban[i] <= 'J') {
-
4898 normalized[available++] = '1';
-
4899 normalized[available++] = '0' + this->bban[i] - 'A';
-
4900 }
-
4901 else if ('K' <= this->bban[i] && this->bban[i] <= 'T') {
-
4902 normalized[available++] = '2';
-
4903 normalized[available++] = '0' + this->bban[i] - 'K';
-
4904 }
-
4905 else if ('U' <= this->bban[i] && this->bban[i] <= 'Z') {
-
4906 normalized[available++] = '3';
-
4907 normalized[available++] = '0' + this->bban[i] - 'U';
-
4908 }
-
4909 }
-
4910
-
4911 // Calculate modulo 97.
-
4912 size_t next;
-
4913 uint32_t nominator = stdex::strtou32(normalized, 9, &next, 10);
-
4914 for (;;) {
-
4915 nominator %= 97;
-
4916 if (!normalized[next]) {
-
4917 this->is_valid = nominator == 1;
-
4918 break;
-
4919 }
-
4920 size_t digit_count = nominator < 10 ? 1 : 2;
-
4921 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
-
4922 nominator = nominator * 10 + (normalized[next] - '0');
-
4923 }
-
4924 }
-
4925 else
-
4926 this->is_valid = false;
-
4927
-
4928 this->interval.start = start;
-
4929 return true;
-
4930
-
4931 error:
-
4932 this->country[0] = 0;
-
4933 this->check_digits[0] = 0;
-
4934 this->bban[0] = 0;
-
4935 this->is_valid = false;
-
4936 this->interval.start = (this->interval.end = start) + 1;
-
4937 return false;
-
4938 }
-
4939
-
4940 virtual void invalidate()
-
4941 {
-
4942 this->country[0] = 0;
-
4943 this->check_digits[0] = 0;
-
4944 this->bban[0] = 0;
-
4945 this->is_valid = false;
-
4946 basic_parser<T>::invalidate();
-
4947 }
-
4948
-
4949 public:
-
4950 T country[3];
-
4951 T check_digits[3];
-
4952 T bban[31];
-
4953 bool is_valid;
-
4954
-
4955 protected:
-
4956 std::shared_ptr<basic_parser<T>> m_space;
-
4957 };
+
4847 for (n = 0; ;) {
+
4848 if (m_space && m_space->match(text, this->interval.end, end, flags))
+
4849 this->interval.end = m_space->interval.end;
+
4850 for (size_t j = 0; j < 4; ++j) {
+
4851 if (this->interval.end >= end || !text[this->interval.end])
+
4852 goto out;
+
4853 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
+
4854 if (('0' <= chr && chr <= '9') || ('A' <= chr && chr <= 'Z')) {
+
4855 if (n >= _countof(this->bban) - 1)
+
4856 goto error; // bban overflow
+
4857 this->bban[n++] = chr;
+
4858 this->interval.end++;
+
4859 }
+
4860 else
+
4861 goto out;
+
4862 }
+
4863 }
+
4864 out:
+
4865 if (n < 11)
+
4866 goto error; // bban too short (shorter than Norwegian)
+
4867 this->bban[n] = 0;
+
4868
+
4869 if (n + 4 == country_desc->length) {
+
4870 // Normalize IBAN.
+
4871 T normalized[69];
+
4872 size_t available = 0;
+
4873 for (size_t i = 0; ; ++i) {
+
4874 if (!this->bban[i]) {
+
4875 for (i = 0; i < 2; ++i) {
+
4876 if ('A' <= this->country[i] && this->country[i] <= 'J') {
+
4877 normalized[available++] = '1';
+
4878 normalized[available++] = '0' + this->country[i] - 'A';
+
4879 }
+
4880 else if ('K' <= this->country[i] && this->country[i] <= 'T') {
+
4881 normalized[available++] = '2';
+
4882 normalized[available++] = '0' + this->country[i] - 'K';
+
4883 }
+
4884 else if ('U' <= this->country[i] && this->country[i] <= 'Z') {
+
4885 normalized[available++] = '3';
+
4886 normalized[available++] = '0' + this->country[i] - 'U';
+
4887 }
+
4888 }
+
4889 normalized[available++] = this->check_digits[0];
+
4890 normalized[available++] = this->check_digits[1];
+
4891 normalized[available] = 0;
+
4892 break;
+
4893 }
+
4894 if ('0' <= this->bban[i] && this->bban[i] <= '9')
+
4895 normalized[available++] = this->bban[i];
+
4896 else if ('A' <= this->bban[i] && this->bban[i] <= 'J') {
+
4897 normalized[available++] = '1';
+
4898 normalized[available++] = '0' + this->bban[i] - 'A';
+
4899 }
+
4900 else if ('K' <= this->bban[i] && this->bban[i] <= 'T') {
+
4901 normalized[available++] = '2';
+
4902 normalized[available++] = '0' + this->bban[i] - 'K';
+
4903 }
+
4904 else if ('U' <= this->bban[i] && this->bban[i] <= 'Z') {
+
4905 normalized[available++] = '3';
+
4906 normalized[available++] = '0' + this->bban[i] - 'U';
+
4907 }
+
4908 }
+
4909
+
4910 // Calculate modulo 97.
+
4911 size_t next;
+
4912 uint32_t nominator = stdex::strtou32(normalized, 9, &next, 10);
+
4913 for (;;) {
+
4914 nominator %= 97;
+
4915 if (!normalized[next]) {
+
4916 this->is_valid = nominator == 1;
+
4917 break;
+
4918 }
+
4919 size_t digit_count = nominator < 10 ? 1 : 2;
+
4920 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
+
4921 nominator = nominator * 10 + (normalized[next] - '0');
+
4922 }
+
4923 }
+
4924 else
+
4925 this->is_valid = false;
+
4926
+
4927 this->interval.start = start;
+
4928 return true;
+
4929
+
4930 error:
+
4931 this->country[0] = 0;
+
4932 this->check_digits[0] = 0;
+
4933 this->bban[0] = 0;
+
4934 this->is_valid = false;
+
4935 this->interval.start = (this->interval.end = start) + 1;
+
4936 return false;
+
4937 }
+
4938
+
4939 virtual void invalidate()
+
4940 {
+
4941 this->country[0] = 0;
+
4942 this->check_digits[0] = 0;
+
4943 this->bban[0] = 0;
+
4944 this->is_valid = false;
+
4945 basic_parser<T>::invalidate();
+
4946 }
+
4947
+
4948 public:
+
4949 T country[3];
+
4950 T check_digits[3];
+
4951 T bban[31];
+
4952 bool is_valid;
+
4953
+
4954 protected:
+
4955 std::shared_ptr<basic_parser<T>> m_space;
+
4956 };
-
4958
-
4959 using iban = basic_iban<char>;
-
4960 using wiban = basic_iban<wchar_t>;
-
4961#ifdef _UNICODE
-
4962 using tiban = wiban;
-
4963#else
-
4964 using tiban = iban;
-
4965#endif
-
4966 using sgml_iban = basic_iban<char>;
-
4967
-
4973 template <class T>
-
- -
4975 {
-
4976 public:
- -
4978 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
4979 _In_ const std::locale& locale = std::locale()) :
-
4980 basic_parser<T>(locale),
-
4981 m_space(space)
-
4982 {
-
4983 this->check_digits[0] = 0;
-
4984 this->reference[0] = 0;
-
4985 this->is_valid = false;
-
4986 }
-
4987
-
4988 virtual bool match(
-
4989 _In_reads_or_z_(end) const T* text,
-
4990 _In_ size_t start = 0,
-
4991 _In_ size_t end = (size_t)-1,
-
4992 _In_ int flags = match_default)
-
4993 {
-
4994 assert(text || start >= end);
-
4995 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
4996 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
4997
-
4998 this->interval.end = start;
-
4999 if (this->interval.end + 1 >= end ||
-
5000 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'R' ||
-
5001 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'F')
-
5002 goto error; // incomplete or wrong reference ID
-
5003 this->interval.end += 2;
-
5004
-
5005 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
5006 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
-
5007 goto error; // incomplete or invalid check digits
-
5008 this->check_digits[i] = text[this->interval.end];
-
5009 }
-
5010 this->check_digits[2] = 0;
-
5011
-
5012 size_t n = 0;
-
5013 for (;;) {
+
4957
+
4958 using iban = basic_iban<char>;
+
4959 using wiban = basic_iban<wchar_t>;
+
4960#ifdef _UNICODE
+
4961 using tiban = wiban;
+
4962#else
+
4963 using tiban = iban;
+
4964#endif
+ +
4966
+
4972 template <class T>
+
+ +
4974 {
+
4975 public:
+ +
4977 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
4978 _In_ const std::locale& locale = std::locale()) :
+
4979 basic_parser<T>(locale),
+
4980 m_space(space)
+
4981 {
+
4982 this->check_digits[0] = 0;
+
4983 this->reference[0] = 0;
+
4984 this->is_valid = false;
+
4985 }
+
4986
+
4987 virtual bool match(
+
4988 _In_reads_or_z_(end) const T* text,
+
4989 _In_ size_t start = 0,
+
4990 _In_ size_t end = (size_t)-1,
+
4991 _In_ int flags = match_default)
+
4992 {
+
4993 assert(text || start >= end);
+
4994 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
4995 const bool case_insensitive = flags & match_case_insensitive ? true : false;
+
4996 size_t n, available, next;
+ +
4998
+
4999 this->interval.end = start;
+
5000 if (this->interval.end + 1 >= end ||
+
5001 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'R' ||
+
5002 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'F')
+
5003 goto error; // incomplete or wrong reference ID
+
5004 this->interval.end += 2;
+
5005
+
5006 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
+
5007 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
+
5008 goto error; // incomplete or invalid check digits
+
5009 this->check_digits[i] = text[this->interval.end];
+
5010 }
+
5011 this->check_digits[2] = 0;
+
5012
+
5013 for (n = 0;;) {
5014 if (m_space && m_space->match(text, this->interval.end, end, flags))
5015 this->interval.end = m_space->interval.end;
5016 for (size_t j = 0; j < 4; ++j) {
@@ -5053,7 +5053,7 @@ $(document).ready(function() { init_codefold(0); });
5038
5039 // Normalize creditor reference.
5040 T normalized[47];
-
5041 size_t available = 0;
+
5041 available = 0;
5042 for (size_t i = 0; ; ++i) {
5043 if (!this->reference[i]) {
5044 normalized[available++] = '2'; // R
@@ -5082,2372 +5082,2371 @@ $(document).ready(function() { init_codefold(0); });
5067 }
5068
5069 // Calculate modulo 97.
-
5070 size_t next;
-
5071 uint32_t nominator = stdex::strtou32(normalized, 9, &next, 10);
-
5072 for (;;) {
-
5073 nominator %= 97;
-
5074 if (!normalized[next]) {
-
5075 this->is_valid = nominator == 1;
-
5076 break;
-
5077 }
-
5078 size_t digit_count = nominator < 10 ? 1 : 2;
-
5079 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
-
5080 nominator = nominator * 10 + (normalized[next] - '0');
-
5081 }
-
5082
-
5083 this->interval.start = start;
-
5084 return true;
-
5085
-
5086 error:
-
5087 this->check_digits[0] = 0;
-
5088 this->reference[0] = 0;
-
5089 this->is_valid = false;
-
5090 this->interval.start = (this->interval.end = start) + 1;
-
5091 return false;
-
5092 }
-
5093
-
5094 virtual void invalidate()
-
5095 {
-
5096 this->check_digits[0] = 0;
-
5097 this->reference[0] = 0;
-
5098 this->is_valid = false;
- -
5100 }
-
5101
-
5102 public:
- - - -
5106
-
5107 protected:
-
5108 std::shared_ptr<basic_parser<T>> m_space;
-
5109 };
+
5070 nominator = stdex::strtou32(normalized, 9, &next, 10);
+
5071 for (;;) {
+
5072 nominator %= 97;
+
5073 if (!normalized[next]) {
+
5074 this->is_valid = nominator == 1;
+
5075 break;
+
5076 }
+
5077 size_t digit_count = nominator < 10 ? 1 : 2;
+
5078 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
+
5079 nominator = nominator * 10 + (normalized[next] - '0');
+
5080 }
+
5081
+
5082 this->interval.start = start;
+
5083 return true;
+
5084
+
5085 error:
+
5086 this->check_digits[0] = 0;
+
5087 this->reference[0] = 0;
+
5088 this->is_valid = false;
+
5089 this->interval.start = (this->interval.end = start) + 1;
+
5090 return false;
+
5091 }
+
5092
+
5093 virtual void invalidate()
+
5094 {
+
5095 this->check_digits[0] = 0;
+
5096 this->reference[0] = 0;
+
5097 this->is_valid = false;
+ +
5099 }
+
5100
+
5101 public:
+ + + +
5105
+
5106 protected:
+
5107 std::shared_ptr<basic_parser<T>> m_space;
+
5108 };
-
5110
- - -
5113#ifdef _UNICODE
- -
5115#else
- -
5117#endif
- -
5119
-
5125 template <class T>
-
- -
5127 {
-
5128 public:
-
5129 basic_si_reference_part(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
5130
-
5131 virtual bool match(
-
5132 _In_reads_or_z_(end) const T* text,
-
5133 _In_ size_t start = 0,
-
5134 _In_ size_t end = (size_t)-1,
-
5135 _In_ int flags = match_default)
-
5136 {
-
5137 assert(text || start >= end);
-
5138 this->interval.end = start;
-
5139 for (;;) {
-
5140 if (this->interval.end >= end || !text[this->interval.end])
-
5141 break;
-
5142 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9')
-
5143 this->interval.end++;
-
5144 else
-
5145 break;
-
5146 }
- -
5148 this->interval.start = start;
-
5149 return true;
-
5150 }
-
5151 this->interval.start = (this->interval.end = start) + 1;
-
5152 return false;
-
5153 }
-
5154 };
+
5109
+ + +
5112#ifdef _UNICODE
+ +
5114#else
+ +
5116#endif
+ +
5118
+
5124 template <class T>
+
+ +
5126 {
+
5127 public:
+
5128 basic_si_reference_part(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
5129
+
5130 virtual bool match(
+
5131 _In_reads_or_z_(end) const T* text,
+
5132 _In_ size_t start = 0,
+
5133 _In_ size_t end = (size_t)-1,
+
5134 _In_ int flags = match_default)
+
5135 {
+
5136 assert(text || start >= end);
+
5137 this->interval.end = start;
+
5138 for (;;) {
+
5139 if (this->interval.end >= end || !text[this->interval.end])
+
5140 break;
+
5141 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9')
+
5142 this->interval.end++;
+
5143 else
+
5144 break;
+
5145 }
+ +
5147 this->interval.start = start;
+
5148 return true;
+
5149 }
+
5150 this->interval.start = (this->interval.end = start) + 1;
+
5151 return false;
+
5152 }
+
5153 };
-
5155
- - -
5158#ifdef _UNICODE
- -
5160#else
- -
5162#endif
- -
5164
-
5170 template <class T>
-
- -
5172 {
-
5173 public:
-
5174 basic_si_reference_delimiter(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
5175
-
5176 virtual bool match(
-
5177 _In_reads_or_z_(end) const T* text,
-
5178 _In_ size_t start = 0,
-
5179 _In_ size_t end = (size_t)-1,
-
5180 _In_ int flags = match_default)
-
5181 {
-
5182 assert(text || start >= end);
-
5183 if (start < end && text[start] == '-') {
-
5184 this->interval.end = (this->interval.start = start) + 1;
-
5185 return true;
-
5186 }
-
5187 this->interval.start = (this->interval.end = start) + 1;
-
5188 return false;
-
5189 }
-
5190 };
+
5154
+ + +
5157#ifdef _UNICODE
+ +
5159#else
+ +
5161#endif
+ +
5163
+
5169 template <class T>
+
+ +
5171 {
+
5172 public:
+
5173 basic_si_reference_delimiter(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
5174
+
5175 virtual bool match(
+
5176 _In_reads_or_z_(end) const T* text,
+
5177 _In_ size_t start = 0,
+
5178 _In_ size_t end = (size_t)-1,
+
5179 _In_ int flags = match_default)
+
5180 {
+
5181 assert(text || start >= end);
+
5182 if (start < end && text[start] == '-') {
+
5183 this->interval.end = (this->interval.start = start) + 1;
+
5184 return true;
+
5185 }
+
5186 this->interval.start = (this->interval.end = start) + 1;
+
5187 return false;
+
5188 }
+
5189 };
-
5191
- - -
5194#ifdef _UNICODE
- -
5196#else
- -
5198#endif
- -
5200
-
5208 template <class T>
-
- -
5210 {
-
5211 public:
- -
5213 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
5214 _In_ const std::locale& locale = std::locale()) :
-
5215 basic_parser<T>(locale),
-
5216 part1(locale),
-
5217 part2(locale),
-
5218 part3(locale),
-
5219 is_valid(false),
-
5220 m_space(space),
-
5221 m_delimiter(locale)
-
5222 {
-
5223 this->model[0] = 0;
-
5224 }
-
5225
-
5226 virtual bool match(
-
5227 _In_reads_or_z_(end) const T* text,
-
5228 _In_ size_t start = 0,
-
5229 _In_ size_t end = (size_t)-1,
-
5230 _In_ int flags = match_default)
-
5231 {
-
5232 assert(text || start >= end);
-
5233 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
5234 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
5235
-
5236 this->interval.end = start;
-
5237 if (this->interval.end + 1 >= end ||
-
5238 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'S' ||
-
5239 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'I')
-
5240 goto error; // incomplete or wrong reference ID
-
5241 this->interval.end += 2;
-
5242
-
5243 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
5244 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
-
5245 goto error; // incomplete or invalid model
-
5246 this->model[i] = text[this->interval.end];
-
5247 }
-
5248 this->model[2] = 0;
-
5249
-
5250 this->part1.invalidate();
-
5251 this->part2.invalidate();
-
5252 this->part3.invalidate();
-
5253 if (this->model[0] == '9' && this->model[1] == '9') {
-
5254 is_valid = true;
-
5255 this->interval.start = start;
-
5256 return true;
-
5257 }
-
5258
-
5259 if (m_space && m_space->match(text, this->interval.end, end, flags))
-
5260 this->interval.end = m_space->interval.end;
-
5261
-
5262 this->part1.match(text, this->interval.end, end, flags) &&
-
5263 this->m_delimiter.match(text, this->part1.interval.end, end, flags) &&
-
5264 this->part2.match(text, this->m_delimiter.interval.end, end, flags) &&
-
5265 this->m_delimiter.match(text, this->part2.interval.end, end, flags) &&
-
5266 this->part3.match(text, this->m_delimiter.interval.end, end, flags);
-
5267
-
5268 this->interval.start = start;
-
5269 if (this->part3.interval)
-
5270 this->interval.end = this->part3.interval.end;
-
5271 else if (this->part2.interval)
-
5272 this->interval.end = this->part2.interval.end;
-
5273 else if (this->part1.interval)
-
5274 this->interval.end = this->part1.interval.end;
-
5275 else
-
5276 this->interval.end = start + 4;
-
5277
-
5278 if (this->model[0] == '0' && this->model[1] == '0')
-
5279 is_valid =
-
5280 this->part3.interval ?
-
5281 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5282 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 :
-
5283 this->part2.interval ?
-
5284 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5285 this->part1.interval.size() + this->part2.interval.size() <= 20 :
-
5286 this->part1.interval ?
-
5287 this->part1.interval.size() <= 12 :
-
5288 false;
-
5289 else if (this->model[0] == '0' && this->model[1] == '1')
-
5290 is_valid =
-
5291 this->part3.interval ?
-
5292 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5293 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5294 check11(
-
5295 text + this->part1.interval.start, this->part1.interval.size(),
-
5296 text + this->part2.interval.start, this->part2.interval.size(),
-
5297 text + this->part3.interval.start, this->part3.interval.size()) :
-
5298 this->part2.interval ?
-
5299 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5300 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5301 check11(
-
5302 text + this->part1.interval.start, this->part1.interval.size(),
-
5303 text + this->part2.interval.start, this->part2.interval.size()) :
-
5304 this->part1.interval ?
-
5305 this->part1.interval.size() <= 12 &&
-
5306 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5307 false;
-
5308 else if (this->model[0] == '0' && this->model[1] == '2')
-
5309 is_valid =
-
5310 this->part3.interval ?
-
5311 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5312 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5313 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
-
5314 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5315 false;
-
5316 else if (this->model[0] == '0' && this->model[1] == '3')
-
5317 is_valid =
-
5318 this->part3.interval ?
-
5319 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5320 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5321 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5322 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
-
5323 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5324 false;
-
5325 else if (this->model[0] == '0' && this->model[1] == '4')
-
5326 is_valid =
-
5327 this->part3.interval ?
-
5328 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5329 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5330 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5331 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5332 false;
-
5333 else if ((this->model[0] == '0' || this->model[0] == '5') && this->model[1] == '5')
-
5334 is_valid =
-
5335 this->part3.interval ?
-
5336 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5337 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5338 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5339 this->part2.interval ?
-
5340 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5341 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5342 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5343 this->part1.interval ?
-
5344 this->part1.interval.size() <= 12 &&
-
5345 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5346 false;
-
5347 else if (this->model[0] == '0' && this->model[1] == '6')
-
5348 is_valid =
-
5349 this->part3.interval ?
-
5350 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5351 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5352 check11(
-
5353 text + this->part2.interval.start, this->part2.interval.size(),
-
5354 text + this->part3.interval.start, this->part3.interval.size()) :
-
5355 this->part2.interval ?
-
5356 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5357 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5358 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5359 false;
-
5360 else if (this->model[0] == '0' && this->model[1] == '7')
-
5361 is_valid =
-
5362 this->part3.interval ?
-
5363 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5364 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5365 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5366 this->part2.interval ?
-
5367 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5368 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5369 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5370 false;
-
5371 else if (this->model[0] == '0' && this->model[1] == '8')
-
5372 is_valid =
-
5373 this->part3.interval ?
-
5374 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5375 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5376 check11(
-
5377 text + this->part1.interval.start, this->part1.interval.size(),
-
5378 text + this->part2.interval.start, this->part2.interval.size()) &&
-
5379 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5380 false;
-
5381 else if (this->model[0] == '0' && this->model[1] == '9')
-
5382 is_valid =
-
5383 this->part3.interval ?
-
5384 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5385 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5386 check11(
-
5387 text + this->part1.interval.start, this->part1.interval.size(),
-
5388 text + this->part2.interval.start, this->part2.interval.size()) :
-
5389 this->part2.interval ?
-
5390 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5391 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5392 check11(
-
5393 text + this->part1.interval.start, this->part1.interval.size(),
-
5394 text + this->part2.interval.start, this->part2.interval.size()) :
-
5395 this->part1.interval ?
-
5396 this->part1.interval.size() <= 12 &&
-
5397 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5398 false;
-
5399 else if (this->model[0] == '1' && this->model[1] == '0')
-
5400 is_valid =
-
5401 this->part3.interval ?
-
5402 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5403 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5404 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5405 check11(
-
5406 text + this->part2.interval.start, this->part2.interval.size(),
-
5407 text + this->part3.interval.start, this->part3.interval.size()) :
-
5408 this->part2.interval ?
-
5409 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5410 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5411 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5412 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5413 false;
-
5414 else if (
-
5415 (this->model[0] == '1' && (this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
-
5416 ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '8') ||
-
5417 (this->model[0] == '4' && (this->model[1] == '0' || this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
-
5418 (this->model[0] == '5' && (this->model[1] == '1' || this->model[1] == '8')))
-
5419 is_valid =
-
5420 this->part3.interval ?
-
5421 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5422 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5423 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5424 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5425 this->part2.interval ?
-
5426 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5427 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5428 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5429 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5430 false;
-
5431 else if (this->model[0] == '1' && this->model[1] == '2')
-
5432 is_valid =
-
5433 this->part3.interval ? false :
-
5434 this->part2.interval ? false :
-
5435 this->part1.interval ?
-
5436 this->part1.interval.size() <= 13 &&
-
5437 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5438 false;
-
5439 else if ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '1')
-
5440 is_valid =
-
5441 this->part3.interval ? false :
-
5442 this->part2.interval ?
-
5443 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5444 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5445 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5446 false;
-
5447 else
-
5448 is_valid = true; // Assume models we don't handle as valid
-
5449 return true;
-
5450
-
5451 error:
-
5452 this->model[0] = 0;
-
5453 this->part1.interval.start = (this->part1.interval.end = start) + 1;
-
5454 this->part2.interval.start = (this->part2.interval.end = start) + 1;
-
5455 this->part3.interval.start = (this->part3.interval.end = start) + 1;
-
5456 this->is_valid = false;
-
5457 this->interval.start = (this->interval.end = start) + 1;
-
5458 return false;
-
5459 }
-
5460
-
5461 virtual void invalidate()
-
5462 {
-
5463 this->model[0] = 0;
-
5464 this->part1.invalidate();
-
5465 this->part2.invalidate();
-
5466 this->part3.invalidate();
-
5467 this->is_valid = false;
- -
5469 }
-
5470
-
5471 protected:
-
5472 static bool check11(
-
5473 _In_count_(num_part1) const T* part1, _In_ size_t num_part1)
-
5474 {
-
5475 assert(part1 && num_part1 >= 1);
-
5476 uint32_t nominator = 0, ponder = 2;
-
5477 for (size_t i = num_part1 - 1; i--; ++ponder)
-
5478 nominator += (part1[i] - '0') * ponder;
-
5479 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
-
5480 if (control >= 10)
-
5481 control = 0;
-
5482 return control == part1[num_part1 - 1] - '0';
-
5483 }
-
5484
-
5485 static bool check11(
-
5486 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
-
5487 _In_count_(num_part2) const T* part2, _In_ size_t num_part2)
-
5488 {
-
5489 assert(part1 || !num_part1);
-
5490 assert(part2 && num_part2 >= 1);
-
5491 uint32_t nominator = 0, ponder = 2;
-
5492 for (size_t i = num_part2 - 1; i--; ++ponder)
-
5493 nominator += (part2[i] - '0') * ponder;
-
5494 for (size_t i = num_part1; i--; ++ponder)
-
5495 nominator += (part1[i] - '0') * ponder;
-
5496 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
-
5497 if (control == 10)
-
5498 control = 0;
-
5499 return control == part2[num_part2 - 1] - '0';
-
5500 }
-
5501
-
5502 static bool check11(
-
5503 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
-
5504 _In_count_(num_part2) const T* part2, _In_ size_t num_part2,
-
5505 _In_count_(num_part3) const T* part3, _In_ size_t num_part3)
-
5506 {
-
5507 assert(part1 || !num_part1);
-
5508 assert(part2 || !num_part2);
-
5509 assert(part3 && num_part3 >= 1);
-
5510 uint32_t nominator = 0, ponder = 2;
-
5511 for (size_t i = num_part3 - 1; i--; ++ponder)
-
5512 nominator += (part3[i] - '0') * ponder;
-
5513 for (size_t i = num_part2; i--; ++ponder)
-
5514 nominator += (part2[i] - '0') * ponder;
-
5515 for (size_t i = num_part1; i--; ++ponder)
-
5516 nominator += (part1[i] - '0') * ponder;
-
5517 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
-
5518 if (control == 10)
-
5519 control = 0;
-
5520 return control == part2[num_part3 - 1] - '0';
-
5521 }
-
5522
-
5523 public:
-
5524 T model[3];
- - - - -
5529
-
5530 protected:
-
5531 std::shared_ptr<basic_parser<T>> m_space;
- -
5533 };
+
5190
+ + +
5193#ifdef _UNICODE
+ +
5195#else
+ +
5197#endif
+ +
5199
+
5207 template <class T>
+
+ +
5209 {
+
5210 public:
+ +
5212 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
5213 _In_ const std::locale& locale = std::locale()) :
+
5214 basic_parser<T>(locale),
+
5215 part1(locale),
+
5216 part2(locale),
+
5217 part3(locale),
+
5218 is_valid(false),
+
5219 m_space(space),
+
5220 m_delimiter(locale)
+
5221 {
+
5222 this->model[0] = 0;
+
5223 }
+
5224
+
5225 virtual bool match(
+
5226 _In_reads_or_z_(end) const T* text,
+
5227 _In_ size_t start = 0,
+
5228 _In_ size_t end = (size_t)-1,
+
5229 _In_ int flags = match_default)
+
5230 {
+
5231 assert(text || start >= end);
+
5232 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
5233 const bool case_insensitive = flags & match_case_insensitive ? true : false;
+
5234
+
5235 this->interval.end = start;
+
5236 if (this->interval.end + 1 >= end ||
+
5237 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'S' ||
+
5238 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'I')
+
5239 goto error; // incomplete or wrong reference ID
+
5240 this->interval.end += 2;
+
5241
+
5242 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
+
5243 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
+
5244 goto error; // incomplete or invalid model
+
5245 this->model[i] = text[this->interval.end];
+
5246 }
+
5247 this->model[2] = 0;
+
5248
+
5249 this->part1.invalidate();
+
5250 this->part2.invalidate();
+
5251 this->part3.invalidate();
+
5252 if (this->model[0] == '9' && this->model[1] == '9') {
+
5253 is_valid = true;
+
5254 this->interval.start = start;
+
5255 return true;
+
5256 }
+
5257
+
5258 if (m_space && m_space->match(text, this->interval.end, end, flags))
+
5259 this->interval.end = m_space->interval.end;
+
5260
+
5261 this->part1.match(text, this->interval.end, end, flags) &&
+
5262 this->m_delimiter.match(text, this->part1.interval.end, end, flags) &&
+
5263 this->part2.match(text, this->m_delimiter.interval.end, end, flags) &&
+
5264 this->m_delimiter.match(text, this->part2.interval.end, end, flags) &&
+
5265 this->part3.match(text, this->m_delimiter.interval.end, end, flags);
+
5266
+
5267 this->interval.start = start;
+
5268 if (this->part3.interval)
+
5269 this->interval.end = this->part3.interval.end;
+
5270 else if (this->part2.interval)
+
5271 this->interval.end = this->part2.interval.end;
+
5272 else if (this->part1.interval)
+
5273 this->interval.end = this->part1.interval.end;
+
5274 else
+
5275 this->interval.end = start + 4;
+
5276
+
5277 if (this->model[0] == '0' && this->model[1] == '0')
+
5278 is_valid =
+
5279 this->part3.interval ?
+
5280 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5281 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 :
+
5282 this->part2.interval ?
+
5283 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5284 this->part1.interval.size() + this->part2.interval.size() <= 20 :
+
5285 this->part1.interval ?
+
5286 this->part1.interval.size() <= 12 :
+
5287 false;
+
5288 else if (this->model[0] == '0' && this->model[1] == '1')
+
5289 is_valid =
+
5290 this->part3.interval ?
+
5291 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5292 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5293 check11(
+
5294 text + this->part1.interval.start, this->part1.interval.size(),
+
5295 text + this->part2.interval.start, this->part2.interval.size(),
+
5296 text + this->part3.interval.start, this->part3.interval.size()) :
+
5297 this->part2.interval ?
+
5298 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5299 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5300 check11(
+
5301 text + this->part1.interval.start, this->part1.interval.size(),
+
5302 text + this->part2.interval.start, this->part2.interval.size()) :
+
5303 this->part1.interval ?
+
5304 this->part1.interval.size() <= 12 &&
+
5305 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5306 false;
+
5307 else if (this->model[0] == '0' && this->model[1] == '2')
+
5308 is_valid =
+
5309 this->part3.interval ?
+
5310 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5311 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5312 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
+
5313 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5314 false;
+
5315 else if (this->model[0] == '0' && this->model[1] == '3')
+
5316 is_valid =
+
5317 this->part3.interval ?
+
5318 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5319 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5320 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5321 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
+
5322 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5323 false;
+
5324 else if (this->model[0] == '0' && this->model[1] == '4')
+
5325 is_valid =
+
5326 this->part3.interval ?
+
5327 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5328 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5329 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5330 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5331 false;
+
5332 else if ((this->model[0] == '0' || this->model[0] == '5') && this->model[1] == '5')
+
5333 is_valid =
+
5334 this->part3.interval ?
+
5335 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5336 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5337 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5338 this->part2.interval ?
+
5339 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5340 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5341 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5342 this->part1.interval ?
+
5343 this->part1.interval.size() <= 12 &&
+
5344 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5345 false;
+
5346 else if (this->model[0] == '0' && this->model[1] == '6')
+
5347 is_valid =
+
5348 this->part3.interval ?
+
5349 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5350 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5351 check11(
+
5352 text + this->part2.interval.start, this->part2.interval.size(),
+
5353 text + this->part3.interval.start, this->part3.interval.size()) :
+
5354 this->part2.interval ?
+
5355 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5356 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5357 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5358 false;
+
5359 else if (this->model[0] == '0' && this->model[1] == '7')
+
5360 is_valid =
+
5361 this->part3.interval ?
+
5362 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5363 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5364 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5365 this->part2.interval ?
+
5366 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5367 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5368 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5369 false;
+
5370 else if (this->model[0] == '0' && this->model[1] == '8')
+
5371 is_valid =
+
5372 this->part3.interval ?
+
5373 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5374 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5375 check11(
+
5376 text + this->part1.interval.start, this->part1.interval.size(),
+
5377 text + this->part2.interval.start, this->part2.interval.size()) &&
+
5378 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5379 false;
+
5380 else if (this->model[0] == '0' && this->model[1] == '9')
+
5381 is_valid =
+
5382 this->part3.interval ?
+
5383 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5384 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5385 check11(
+
5386 text + this->part1.interval.start, this->part1.interval.size(),
+
5387 text + this->part2.interval.start, this->part2.interval.size()) :
+
5388 this->part2.interval ?
+
5389 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5390 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5391 check11(
+
5392 text + this->part1.interval.start, this->part1.interval.size(),
+
5393 text + this->part2.interval.start, this->part2.interval.size()) :
+
5394 this->part1.interval ?
+
5395 this->part1.interval.size() <= 12 &&
+
5396 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5397 false;
+
5398 else if (this->model[0] == '1' && this->model[1] == '0')
+
5399 is_valid =
+
5400 this->part3.interval ?
+
5401 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5402 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5403 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5404 check11(
+
5405 text + this->part2.interval.start, this->part2.interval.size(),
+
5406 text + this->part3.interval.start, this->part3.interval.size()) :
+
5407 this->part2.interval ?
+
5408 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5409 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5410 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5411 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5412 false;
+
5413 else if (
+
5414 (this->model[0] == '1' && (this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
+
5415 ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '8') ||
+
5416 (this->model[0] == '4' && (this->model[1] == '0' || this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
+
5417 (this->model[0] == '5' && (this->model[1] == '1' || this->model[1] == '8')))
+
5418 is_valid =
+
5419 this->part3.interval ?
+
5420 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5421 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5422 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5423 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5424 this->part2.interval ?
+
5425 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5426 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5427 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5428 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5429 false;
+
5430 else if (this->model[0] == '1' && this->model[1] == '2')
+
5431 is_valid =
+
5432 this->part3.interval ? false :
+
5433 this->part2.interval ? false :
+
5434 this->part1.interval ?
+
5435 this->part1.interval.size() <= 13 &&
+
5436 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5437 false;
+
5438 else if ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '1')
+
5439 is_valid =
+
5440 this->part3.interval ? false :
+
5441 this->part2.interval ?
+
5442 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5443 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5444 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5445 false;
+
5446 else
+
5447 is_valid = true; // Assume models we don't handle as valid
+
5448 return true;
+
5449
+
5450 error:
+
5451 this->model[0] = 0;
+
5452 this->part1.interval.start = (this->part1.interval.end = start) + 1;
+
5453 this->part2.interval.start = (this->part2.interval.end = start) + 1;
+
5454 this->part3.interval.start = (this->part3.interval.end = start) + 1;
+
5455 this->is_valid = false;
+
5456 this->interval.start = (this->interval.end = start) + 1;
+
5457 return false;
+
5458 }
+
5459
+
5460 virtual void invalidate()
+
5461 {
+
5462 this->model[0] = 0;
+
5463 this->part1.invalidate();
+
5464 this->part2.invalidate();
+
5465 this->part3.invalidate();
+
5466 this->is_valid = false;
+ +
5468 }
+
5469
+
5470 protected:
+
5471 static bool check11(
+
5472 _In_count_(num_part1) const T* part1, _In_ size_t num_part1)
+
5473 {
+
5474 assert(part1 && num_part1 >= 1);
+
5475 uint32_t nominator = 0, ponder = 2;
+
5476 for (size_t i = num_part1 - 1; i--; ++ponder)
+
5477 nominator += (part1[i] - '0') * ponder;
+
5478 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
+
5479 if (control >= 10)
+
5480 control = 0;
+
5481 return control == part1[num_part1 - 1] - '0';
+
5482 }
+
5483
+
5484 static bool check11(
+
5485 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
+
5486 _In_count_(num_part2) const T* part2, _In_ size_t num_part2)
+
5487 {
+
5488 assert(part1 || !num_part1);
+
5489 assert(part2 && num_part2 >= 1);
+
5490 uint32_t nominator = 0, ponder = 2;
+
5491 for (size_t i = num_part2 - 1; i--; ++ponder)
+
5492 nominator += (part2[i] - '0') * ponder;
+
5493 for (size_t i = num_part1; i--; ++ponder)
+
5494 nominator += (part1[i] - '0') * ponder;
+
5495 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
+
5496 if (control == 10)
+
5497 control = 0;
+
5498 return control == part2[num_part2 - 1] - '0';
+
5499 }
+
5500
+
5501 static bool check11(
+
5502 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
+
5503 _In_count_(num_part2) const T* part2, _In_ size_t num_part2,
+
5504 _In_count_(num_part3) const T* part3, _In_ size_t num_part3)
+
5505 {
+
5506 assert(part1 || !num_part1);
+
5507 assert(part2 || !num_part2);
+
5508 assert(part3 && num_part3 >= 1);
+
5509 uint32_t nominator = 0, ponder = 2;
+
5510 for (size_t i = num_part3 - 1; i--; ++ponder)
+
5511 nominator += (part3[i] - '0') * ponder;
+
5512 for (size_t i = num_part2; i--; ++ponder)
+
5513 nominator += (part2[i] - '0') * ponder;
+
5514 for (size_t i = num_part1; i--; ++ponder)
+
5515 nominator += (part1[i] - '0') * ponder;
+
5516 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
+
5517 if (control == 10)
+
5518 control = 0;
+
5519 return control == part2[num_part3 - 1] - '0';
+
5520 }
+
5521
+
5522 public:
+
5523 T model[3];
+ + + + +
5528
+
5529 protected:
+
5530 std::shared_ptr<basic_parser<T>> m_space;
+ +
5532 };
-
5534
- - -
5537#ifdef _UNICODE
- -
5539#else
- -
5541#endif
- -
5543
-
5547 template <class T>
-
- -
5549 {
-
5550 public:
- -
5552 _In_ const std::shared_ptr<basic_parser<T>>& element,
-
5553 _In_ const std::shared_ptr<basic_parser<T>>& digit,
-
5554 _In_ const std::shared_ptr<basic_parser<T>>& sign,
-
5555 _In_ const std::locale& locale = std::locale()) :
-
5556 basic_parser<T>(locale),
-
5557 m_element(element),
-
5558 m_digit(digit),
-
5559 m_sign(sign),
-
5560 has_digits(false),
-
5561 has_charge(false)
-
5562 {}
-
5563
-
5564 virtual bool match(
-
5565 _In_reads_or_z_(end) const T* text,
-
5566 _In_ size_t start = 0,
-
5567 _In_ size_t end = (size_t)-1,
-
5568 _In_ int flags = match_default)
-
5569 {
-
5570 assert(text || start >= end);
-
5571
-
5572 has_digits = false;
-
5573 has_charge = false;
-
5574 this->interval.end = start;
-
5575
-
5576 const int element_match_flags = flags & ~match_case_insensitive; // Chemical elements are always case-sensitive.
-
5577 for (;;) {
-
5578 if (m_element->match(text, this->interval.end, end, element_match_flags)) {
-
5579 this->interval.end = m_element->interval.end;
-
5580 while (m_digit->match(text, this->interval.end, end, flags)) {
-
5581 this->interval.end = m_digit->interval.end;
-
5582 has_digits = true;
-
5583 }
-
5584 }
-
5585 else if (start < this->interval.end) {
-
5586 if (m_sign->match(text, this->interval.end, end, flags)) {
-
5587 this->interval.end = m_sign->interval.end;
-
5588 has_charge = true;
-
5589 }
-
5590 this->interval.start = start;
-
5591 return true;
-
5592 }
-
5593 else {
-
5594 this->interval.start = (this->interval.end = start) + 1;
-
5595 return false;
-
5596 }
-
5597 }
-
5598 }
-
5599
-
5600 virtual void invalidate()
-
5601 {
-
5602 has_digits = false;
-
5603 has_charge = false;
- -
5605 }
-
5606
-
5607 public:
-
5608 bool has_digits;
-
5609 bool has_charge;
-
5610
-
5611 protected:
-
5612 std::shared_ptr<basic_parser<T>> m_element;
-
5613 std::shared_ptr<basic_parser<T>> m_digit;
-
5614 std::shared_ptr<basic_parser<T>> m_sign;
-
5615 };
+
5533
+ + +
5536#ifdef _UNICODE
+ +
5538#else
+ +
5540#endif
+ +
5542
+
5546 template <class T>
+
+ +
5548 {
+
5549 public:
+ +
5551 _In_ const std::shared_ptr<basic_parser<T>>& element,
+
5552 _In_ const std::shared_ptr<basic_parser<T>>& digit,
+
5553 _In_ const std::shared_ptr<basic_parser<T>>& sign,
+
5554 _In_ const std::locale& locale = std::locale()) :
+
5555 basic_parser<T>(locale),
+
5556 m_element(element),
+
5557 m_digit(digit),
+
5558 m_sign(sign),
+
5559 has_digits(false),
+
5560 has_charge(false)
+
5561 {}
+
5562
+
5563 virtual bool match(
+
5564 _In_reads_or_z_(end) const T* text,
+
5565 _In_ size_t start = 0,
+
5566 _In_ size_t end = (size_t)-1,
+
5567 _In_ int flags = match_default)
+
5568 {
+
5569 assert(text || start >= end);
+
5570
+
5571 has_digits = false;
+
5572 has_charge = false;
+
5573 this->interval.end = start;
+
5574
+
5575 const int element_match_flags = flags & ~match_case_insensitive; // Chemical elements are always case-sensitive.
+
5576 for (;;) {
+
5577 if (m_element->match(text, this->interval.end, end, element_match_flags)) {
+
5578 this->interval.end = m_element->interval.end;
+
5579 while (m_digit->match(text, this->interval.end, end, flags)) {
+
5580 this->interval.end = m_digit->interval.end;
+
5581 has_digits = true;
+
5582 }
+
5583 }
+
5584 else if (start < this->interval.end) {
+
5585 if (m_sign->match(text, this->interval.end, end, flags)) {
+
5586 this->interval.end = m_sign->interval.end;
+
5587 has_charge = true;
+
5588 }
+
5589 this->interval.start = start;
+
5590 return true;
+
5591 }
+
5592 else {
+
5593 this->interval.start = (this->interval.end = start) + 1;
+
5594 return false;
+
5595 }
+
5596 }
+
5597 }
+
5598
+
5599 virtual void invalidate()
+
5600 {
+
5601 has_digits = false;
+
5602 has_charge = false;
+ +
5604 }
+
5605
+
5606 public:
+
5607 bool has_digits;
+
5608 bool has_charge;
+
5609
+
5610 protected:
+
5611 std::shared_ptr<basic_parser<T>> m_element;
+
5612 std::shared_ptr<basic_parser<T>> m_digit;
+
5613 std::shared_ptr<basic_parser<T>> m_sign;
+
5614 };
-
5616
- - -
5619#ifdef _UNICODE
- -
5621#else
- -
5623#endif
- -
5625
-
- -
5630 {
-
5631 public:
-
5632 virtual bool match(
-
5633 _In_reads_or_z_(end) const char* text,
-
5634 _In_ size_t start = 0,
-
5635 _In_ size_t end = (size_t)-1,
-
5636 _In_ int flags = match_default)
-
5637 {
-
5638 assert(text || start >= end);
-
5639 this->interval.end = start;
-
5640
-
5641 assert(text || this->interval.end >= end);
-
5642 if (this->interval.end < end && text[this->interval.end]) {
-
5643 if (text[this->interval.end] == '\r') {
-
5644 this->interval.end++;
-
5645 if (this->interval.end < end && text[this->interval.end] == '\n') {
-
5646 this->interval.start = start;
-
5647 this->interval.end++;
-
5648 return true;
-
5649 }
-
5650 }
-
5651 else if (text[this->interval.end] == '\n') {
-
5652 this->interval.start = start;
-
5653 this->interval.end++;
-
5654 return true;
-
5655 }
-
5656 }
-
5657 this->interval.start = (this->interval.end = start) + 1;
-
5658 return false;
-
5659 }
-
5660 };
+
5615
+ + +
5618#ifdef _UNICODE
+ +
5620#else
+ +
5622#endif
+ +
5624
+
+ +
5629 {
+
5630 public:
+
5631 virtual bool match(
+
5632 _In_reads_or_z_(end) const char* text,
+
5633 _In_ size_t start = 0,
+
5634 _In_ size_t end = (size_t)-1,
+
5635 _In_ int flags = match_default)
+
5636 {
+
5637 assert(text || start >= end);
+
5638 this->interval.end = start;
+
5639
+
5640 assert(text || this->interval.end >= end);
+
5641 if (this->interval.end < end && text[this->interval.end]) {
+
5642 if (text[this->interval.end] == '\r') {
+
5643 this->interval.end++;
+
5644 if (this->interval.end < end && text[this->interval.end] == '\n') {
+
5645 this->interval.start = start;
+
5646 this->interval.end++;
+
5647 return true;
+
5648 }
+
5649 }
+
5650 else if (text[this->interval.end] == '\n') {
+
5651 this->interval.start = start;
+
5652 this->interval.end++;
+
5653 return true;
+
5654 }
+
5655 }
+
5656 this->interval.start = (this->interval.end = start) + 1;
+
5657 return false;
+
5658 }
+
5659 };
-
5661
-
-
5665 class http_space : public parser
-
5666 {
-
5667 public:
-
5668 virtual bool match(
-
5669 _In_reads_or_z_(end) const char* text,
-
5670 _In_ size_t start = 0,
-
5671 _In_ size_t end = (size_t)-1,
-
5672 _In_ int flags = match_default)
-
5673 {
-
5674 assert(text || start >= end);
-
5675 this->interval.end = start;
-
5676 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
5677 this->interval.end = m_line_break.interval.end;
-
5678 if (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) {
-
5679 this->interval.start = start;
-
5680 this->interval.end++;
-
5681 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
-
5682 return true;
-
5683 }
-
5684 }
-
5685 else if (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) {
-
5686 this->interval.start = start;
-
5687 this->interval.end++;
-
5688 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
-
5689 return true;
-
5690 }
-
5691 this->interval.start = (this->interval.end = start) + 1;
-
5692 return false;
-
5693 }
-
5694
-
5695 protected:
-
5696 http_line_break m_line_break;
-
5697 };
+
5660
+
+
5664 class http_space : public parser
+
5665 {
+
5666 public:
+
5667 virtual bool match(
+
5668 _In_reads_or_z_(end) const char* text,
+
5669 _In_ size_t start = 0,
+
5670 _In_ size_t end = (size_t)-1,
+
5671 _In_ int flags = match_default)
+
5672 {
+
5673 assert(text || start >= end);
+
5674 this->interval.end = start;
+
5675 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
5676 this->interval.end = m_line_break.interval.end;
+
5677 if (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) {
+
5678 this->interval.start = start;
+
5679 this->interval.end++;
+
5680 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
+
5681 return true;
+
5682 }
+
5683 }
+
5684 else if (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) {
+
5685 this->interval.start = start;
+
5686 this->interval.end++;
+
5687 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
+
5688 return true;
+
5689 }
+
5690 this->interval.start = (this->interval.end = start) + 1;
+
5691 return false;
+
5692 }
+
5693
+
5694 protected:
+
5695 http_line_break m_line_break;
+
5696 };
-
5698
-
-
5702 class http_text_char : public parser
-
5703 {
-
5704 public:
-
5705 virtual bool match(
-
5706 _In_reads_or_z_(end) const char* text,
-
5707 _In_ size_t start = 0,
-
5708 _In_ size_t end = (size_t)-1,
-
5709 _In_ int flags = match_default)
-
5710 {
-
5711 assert(text || start >= end);
-
5712 this->interval.end = start;
-
5713
-
5714 assert(text || this->interval.end >= end);
-
5715 if (m_space.match(text, this->interval.end, end, flags)) {
-
5716 this->interval.start = start;
-
5717 this->interval.end = m_space.interval.end;
-
5718 return true;
-
5719 }
-
5720 else if (this->interval.end < end && text[this->interval.end] && text[this->interval.end] >= 0x20) {
-
5721 this->interval.start = start;
-
5722 this->interval.end++;
-
5723 return true;
-
5724 }
-
5725 this->interval.start = (this->interval.end = start) + 1;
-
5726 return false;
-
5727 }
-
5728
-
5729 protected:
-
5730 http_space m_space;
-
5731 };
+
5697
+
+
5701 class http_text_char : public parser
+
5702 {
+
5703 public:
+
5704 virtual bool match(
+
5705 _In_reads_or_z_(end) const char* text,
+
5706 _In_ size_t start = 0,
+
5707 _In_ size_t end = (size_t)-1,
+
5708 _In_ int flags = match_default)
+
5709 {
+
5710 assert(text || start >= end);
+
5711 this->interval.end = start;
+
5712
+
5713 assert(text || this->interval.end >= end);
+
5714 if (m_space.match(text, this->interval.end, end, flags)) {
+
5715 this->interval.start = start;
+
5716 this->interval.end = m_space.interval.end;
+
5717 return true;
+
5718 }
+
5719 else if (this->interval.end < end && text[this->interval.end] && text[this->interval.end] >= 0x20) {
+
5720 this->interval.start = start;
+
5721 this->interval.end++;
+
5722 return true;
+
5723 }
+
5724 this->interval.start = (this->interval.end = start) + 1;
+
5725 return false;
+
5726 }
+
5727
+
5728 protected:
+
5729 http_space m_space;
+
5730 };
-
5732
-
-
5736 class http_token : public parser
-
5737 {
-
5738 public:
-
5739 virtual bool match(
-
5740 _In_reads_or_z_(end) const char* text,
-
5741 _In_ size_t start = 0,
-
5742 _In_ size_t end = (size_t)-1,
-
5743 _In_ int flags = match_default)
-
5744 {
-
5745 assert(text || start >= end);
-
5746 this->interval.end = start;
-
5747 for (;;) {
-
5748 if (this->interval.end < end && text[this->interval.end]) {
-
5749 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
5750 (unsigned int)text[this->interval.end] == 0x7f ||
-
5751 text[this->interval.end] == '(' ||
-
5752 text[this->interval.end] == ')' ||
-
5753 text[this->interval.end] == '<' ||
-
5754 text[this->interval.end] == '>' ||
-
5755 text[this->interval.end] == '@' ||
-
5756 text[this->interval.end] == ',' ||
-
5757 text[this->interval.end] == ';' ||
-
5758 text[this->interval.end] == ':' ||
-
5759 text[this->interval.end] == '\\' ||
-
5760 text[this->interval.end] == '\"' ||
-
5761 text[this->interval.end] == '/' ||
-
5762 text[this->interval.end] == '[' ||
-
5763 text[this->interval.end] == ']' ||
-
5764 text[this->interval.end] == '?' ||
-
5765 text[this->interval.end] == '=' ||
-
5766 text[this->interval.end] == '{' ||
-
5767 text[this->interval.end] == '}' ||
-
5768 isspace(text[this->interval.end]))
-
5769 break;
-
5770 else
-
5771 this->interval.end++;
-
5772 }
-
5773 else
-
5774 break;
-
5775 }
- -
5777 this->interval.start = start;
-
5778 return true;
-
5779 }
-
5780 else {
-
5781 this->interval.start = (this->interval.end = start) + 1;
-
5782 return false;
-
5783 }
-
5784 }
-
5785 };
+
5731
+
+
5735 class http_token : public parser
+
5736 {
+
5737 public:
+
5738 virtual bool match(
+
5739 _In_reads_or_z_(end) const char* text,
+
5740 _In_ size_t start = 0,
+
5741 _In_ size_t end = (size_t)-1,
+
5742 _In_ int flags = match_default)
+
5743 {
+
5744 assert(text || start >= end);
+
5745 this->interval.end = start;
+
5746 for (;;) {
+
5747 if (this->interval.end < end && text[this->interval.end]) {
+
5748 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
5749 (unsigned int)text[this->interval.end] == 0x7f ||
+
5750 text[this->interval.end] == '(' ||
+
5751 text[this->interval.end] == ')' ||
+
5752 text[this->interval.end] == '<' ||
+
5753 text[this->interval.end] == '>' ||
+
5754 text[this->interval.end] == '@' ||
+
5755 text[this->interval.end] == ',' ||
+
5756 text[this->interval.end] == ';' ||
+
5757 text[this->interval.end] == ':' ||
+
5758 text[this->interval.end] == '\\' ||
+
5759 text[this->interval.end] == '\"' ||
+
5760 text[this->interval.end] == '/' ||
+
5761 text[this->interval.end] == '[' ||
+
5762 text[this->interval.end] == ']' ||
+
5763 text[this->interval.end] == '?' ||
+
5764 text[this->interval.end] == '=' ||
+
5765 text[this->interval.end] == '{' ||
+
5766 text[this->interval.end] == '}' ||
+
5767 isspace(text[this->interval.end]))
+
5768 break;
+
5769 else
+
5770 this->interval.end++;
+
5771 }
+
5772 else
+
5773 break;
+
5774 }
+ +
5776 this->interval.start = start;
+
5777 return true;
+
5778 }
+
5779 else {
+
5780 this->interval.start = (this->interval.end = start) + 1;
+
5781 return false;
+
5782 }
+
5783 }
+
5784 };
-
5786
-
- -
5791 {
-
5792 public:
-
5793 virtual bool match(
-
5794 _In_reads_or_z_(end) const char* text,
-
5795 _In_ size_t start = 0,
-
5796 _In_ size_t end = (size_t)-1,
-
5797 _In_ int flags = match_default)
-
5798 {
-
5799 assert(text || start >= end);
-
5800 this->interval.end = start;
-
5801 if (this->interval.end < end && text[this->interval.end] != '"')
-
5802 goto error;
-
5803 this->interval.end++;
-
5804 content.start = this->interval.end;
-
5805 for (;;) {
-
5806 assert(text || this->interval.end >= end);
-
5807 if (this->interval.end < end && text[this->interval.end]) {
-
5808 if (text[this->interval.end] == '"') {
-
5809 content.end = this->interval.end;
-
5810 this->interval.end++;
-
5811 break;
-
5812 }
-
5813 else if (text[this->interval.end] == '\\') {
-
5814 this->interval.end++;
-
5815 if (this->interval.end < end && text[this->interval.end]) {
-
5816 this->interval.end++;
-
5817 }
-
5818 else
-
5819 goto error;
-
5820 }
-
5821 else if (m_chr.match(text, this->interval.end, end, flags))
-
5822 this->interval.end++;
-
5823 else
-
5824 goto error;
-
5825 }
-
5826 else
-
5827 goto error;
-
5828 }
-
5829 this->interval.start = start;
-
5830 return true;
-
5831
-
5832 error:
-
5833 content.start = 1;
-
5834 content.end = 0;
-
5835 this->interval.start = (this->interval.end = start) + 1;
-
5836 return false;
-
5837 }
-
5838
-
5839 virtual void invalidate()
-
5840 {
-
5841 content.start = 1;
-
5842 content.end = 0;
-
5843 parser::invalidate();
-
5844 }
-
5845
-
5846 public:
- -
5848
-
5849 protected:
-
5850 http_text_char m_chr;
-
5851 };
+
5785
+
+ +
5790 {
+
5791 public:
+
5792 virtual bool match(
+
5793 _In_reads_or_z_(end) const char* text,
+
5794 _In_ size_t start = 0,
+
5795 _In_ size_t end = (size_t)-1,
+
5796 _In_ int flags = match_default)
+
5797 {
+
5798 assert(text || start >= end);
+
5799 this->interval.end = start;
+
5800 if (this->interval.end < end && text[this->interval.end] != '"')
+
5801 goto error;
+
5802 this->interval.end++;
+
5803 content.start = this->interval.end;
+
5804 for (;;) {
+
5805 assert(text || this->interval.end >= end);
+
5806 if (this->interval.end < end && text[this->interval.end]) {
+
5807 if (text[this->interval.end] == '"') {
+
5808 content.end = this->interval.end;
+
5809 this->interval.end++;
+
5810 break;
+
5811 }
+
5812 else if (text[this->interval.end] == '\\') {
+
5813 this->interval.end++;
+
5814 if (this->interval.end < end && text[this->interval.end]) {
+
5815 this->interval.end++;
+
5816 }
+
5817 else
+
5818 goto error;
+
5819 }
+
5820 else if (m_chr.match(text, this->interval.end, end, flags))
+
5821 this->interval.end++;
+
5822 else
+
5823 goto error;
+
5824 }
+
5825 else
+
5826 goto error;
+
5827 }
+
5828 this->interval.start = start;
+
5829 return true;
+
5830
+
5831 error:
+
5832 content.start = 1;
+
5833 content.end = 0;
+
5834 this->interval.start = (this->interval.end = start) + 1;
+
5835 return false;
+
5836 }
+
5837
+
5838 virtual void invalidate()
+
5839 {
+
5840 content.start = 1;
+
5841 content.end = 0;
+
5842 parser::invalidate();
+
5843 }
+
5844
+
5845 public:
+ +
5847
+
5848 protected:
+
5849 http_text_char m_chr;
+
5850 };
-
5852
-
-
5856 class http_value : public parser
-
5857 {
-
5858 public:
-
5859 virtual bool match(
-
5860 _In_reads_or_z_(end) const char* text,
-
5861 _In_ size_t start = 0,
-
5862 _In_ size_t end = (size_t)-1,
-
5863 _In_ int flags = match_default)
-
5864 {
-
5865 assert(text || start >= end);
-
5866 this->interval.end = start;
-
5867 if (string.match(text, this->interval.end, end, flags)) {
-
5868 token.invalidate();
-
5869 this->interval.end = string.interval.end;
-
5870 this->interval.start = start;
-
5871 return true;
-
5872 }
-
5873 else if (token.match(text, this->interval.end, end, flags)) {
-
5874 string.invalidate();
-
5875 this->interval.end = token.interval.end;
-
5876 this->interval.start = start;
-
5877 return true;
-
5878 }
-
5879 else {
-
5880 this->interval.start = (this->interval.end = start) + 1;
-
5881 return false;
-
5882 }
-
5883 }
-
5884
-
5885 virtual void invalidate()
-
5886 {
-
5887 string.invalidate();
-
5888 token.invalidate();
-
5889 parser::invalidate();
-
5890 }
-
5891
-
5892 public:
- - -
5895 };
+
5851
+
+
5855 class http_value : public parser
+
5856 {
+
5857 public:
+
5858 virtual bool match(
+
5859 _In_reads_or_z_(end) const char* text,
+
5860 _In_ size_t start = 0,
+
5861 _In_ size_t end = (size_t)-1,
+
5862 _In_ int flags = match_default)
+
5863 {
+
5864 assert(text || start >= end);
+
5865 this->interval.end = start;
+
5866 if (string.match(text, this->interval.end, end, flags)) {
+
5867 token.invalidate();
+
5868 this->interval.end = string.interval.end;
+
5869 this->interval.start = start;
+
5870 return true;
+
5871 }
+
5872 else if (token.match(text, this->interval.end, end, flags)) {
+
5873 string.invalidate();
+
5874 this->interval.end = token.interval.end;
+
5875 this->interval.start = start;
+
5876 return true;
+
5877 }
+
5878 else {
+
5879 this->interval.start = (this->interval.end = start) + 1;
+
5880 return false;
+
5881 }
+
5882 }
+
5883
+
5884 virtual void invalidate()
+
5885 {
+
5886 string.invalidate();
+
5887 token.invalidate();
+
5888 parser::invalidate();
+
5889 }
+
5890
+
5891 public:
+ + +
5894 };
-
5896
-
-
5900 class http_parameter : public parser
-
5901 {
-
5902 public:
-
5903 virtual bool match(
-
5904 _In_reads_or_z_(end) const char* text,
-
5905 _In_ size_t start = 0,
-
5906 _In_ size_t end = (size_t)-1,
-
5907 _In_ int flags = match_default)
-
5908 {
-
5909 assert(text || start >= end);
-
5910 this->interval.end = start;
-
5911 if (name.match(text, this->interval.end, end, flags))
-
5912 this->interval.end = name.interval.end;
-
5913 else
-
5914 goto error;
-
5915 while (m_space.match(text, this->interval.end, end, flags))
-
5916 this->interval.end = m_space.interval.end;
-
5917 assert(text || this->interval.end >= end);
-
5918 if (this->interval.end < end && text[this->interval.end] == '=')
-
5919 this->interval.end++;
-
5920 else
-
5921 while (m_space.match(text, this->interval.end, end, flags))
-
5922 this->interval.end = m_space.interval.end;
-
5923 if (value.match(text, this->interval.end, end, flags))
-
5924 this->interval.end = value.interval.end;
-
5925 else
-
5926 goto error;
-
5927 this->interval.start = start;
-
5928 return true;
-
5929
-
5930 error:
-
5931 name.invalidate();
-
5932 value.invalidate();
-
5933 this->interval.start = (this->interval.end = start) + 1;
-
5934 return false;
-
5935 }
-
5936
-
5937 virtual void invalidate()
-
5938 {
-
5939 name.invalidate();
-
5940 value.invalidate();
-
5941 parser::invalidate();
-
5942 }
-
5943
-
5944 public:
- - -
5947
-
5948 protected:
-
5949 http_space m_space;
-
5950 };
+
5895
+
+
5899 class http_parameter : public parser
+
5900 {
+
5901 public:
+
5902 virtual bool match(
+
5903 _In_reads_or_z_(end) const char* text,
+
5904 _In_ size_t start = 0,
+
5905 _In_ size_t end = (size_t)-1,
+
5906 _In_ int flags = match_default)
+
5907 {
+
5908 assert(text || start >= end);
+
5909 this->interval.end = start;
+
5910 if (name.match(text, this->interval.end, end, flags))
+
5911 this->interval.end = name.interval.end;
+
5912 else
+
5913 goto error;
+
5914 while (m_space.match(text, this->interval.end, end, flags))
+
5915 this->interval.end = m_space.interval.end;
+
5916 assert(text || this->interval.end >= end);
+
5917 if (this->interval.end < end && text[this->interval.end] == '=')
+
5918 this->interval.end++;
+
5919 else
+
5920 while (m_space.match(text, this->interval.end, end, flags))
+
5921 this->interval.end = m_space.interval.end;
+
5922 if (value.match(text, this->interval.end, end, flags))
+
5923 this->interval.end = value.interval.end;
+
5924 else
+
5925 goto error;
+
5926 this->interval.start = start;
+
5927 return true;
+
5928
+
5929 error:
+
5930 name.invalidate();
+
5931 value.invalidate();
+
5932 this->interval.start = (this->interval.end = start) + 1;
+
5933 return false;
+
5934 }
+
5935
+
5936 virtual void invalidate()
+
5937 {
+
5938 name.invalidate();
+
5939 value.invalidate();
+
5940 parser::invalidate();
+
5941 }
+
5942
+
5943 public:
+ + +
5946
+
5947 protected:
+
5948 http_space m_space;
+
5949 };
-
5951
-
-
5955 class http_any_type : public parser
-
5956 {
-
5957 public:
-
5958 virtual bool match(
-
5959 _In_reads_or_z_(end) const char* text,
-
5960 _In_ size_t start = 0,
-
5961 _In_ size_t end = (size_t)-1,
-
5962 _In_ int flags = match_default)
-
5963 {
-
5964 assert(text || start >= end);
-
5965 if (start + 2 < end &&
-
5966 text[start] == '*' &&
-
5967 text[start + 1] == '/' &&
-
5968 text[start + 2] == '*')
-
5969 {
-
5970 this->interval.end = (this->interval.start = start) + 3;
-
5971 return true;
-
5972 }
-
5973 else if (start < end && text[start] == '*') {
-
5974 this->interval.end = (this->interval.start = start) + 1;
-
5975 return true;
-
5976 }
-
5977 else {
-
5978 this->interval.start = (this->interval.end = start) + 1;
-
5979 return false;
-
5980 }
-
5981 }
-
5982 };
+
5950
+
+
5954 class http_any_type : public parser
+
5955 {
+
5956 public:
+
5957 virtual bool match(
+
5958 _In_reads_or_z_(end) const char* text,
+
5959 _In_ size_t start = 0,
+
5960 _In_ size_t end = (size_t)-1,
+
5961 _In_ int flags = match_default)
+
5962 {
+
5963 assert(text || start >= end);
+
5964 if (start + 2 < end &&
+
5965 text[start] == '*' &&
+
5966 text[start + 1] == '/' &&
+
5967 text[start + 2] == '*')
+
5968 {
+
5969 this->interval.end = (this->interval.start = start) + 3;
+
5970 return true;
+
5971 }
+
5972 else if (start < end && text[start] == '*') {
+
5973 this->interval.end = (this->interval.start = start) + 1;
+
5974 return true;
+
5975 }
+
5976 else {
+
5977 this->interval.start = (this->interval.end = start) + 1;
+
5978 return false;
+
5979 }
+
5980 }
+
5981 };
-
5983
-
- -
5988 {
-
5989 public:
-
5990 virtual bool match(
-
5991 _In_reads_or_z_(end) const char* text,
-
5992 _In_ size_t start = 0,
-
5993 _In_ size_t end = (size_t)-1,
-
5994 _In_ int flags = match_default)
-
5995 {
-
5996 assert(text || start >= end);
-
5997 this->interval.end = start;
-
5998 if (type.match(text, this->interval.end, end, flags))
-
5999 this->interval.end = type.interval.end;
-
6000 else
-
6001 goto error;
-
6002 while (m_space.match(text, this->interval.end, end, flags))
-
6003 this->interval.end = m_space.interval.end;
-
6004 if (this->interval.end < end && text[this->interval.end] == '/')
-
6005 this->interval.end++;
-
6006 else
-
6007 goto error;
-
6008 while (m_space.match(text, this->interval.end, end, flags))
-
6009 this->interval.end = m_space.interval.end;
-
6010 if (subtype.match(text, this->interval.end, end, flags))
-
6011 this->interval.end = subtype.interval.end;
-
6012 else
-
6013 goto error;
-
6014 this->interval.start = start;
-
6015 return true;
-
6016
-
6017 error:
-
6018 type.invalidate();
-
6019 subtype.invalidate();
-
6020 this->interval.start = (this->interval.end = start) + 1;
-
6021 return false;
-
6022 }
-
6023
-
6024 virtual void invalidate()
-
6025 {
-
6026 type.invalidate();
-
6027 subtype.invalidate();
-
6028 parser::invalidate();
-
6029 }
-
6030
-
6031 public:
-
6032 http_token type;
-
6033 http_token subtype;
-
6034
-
6035 protected:
-
6036 http_space m_space;
-
6037 };
+
5982
+
+ +
5987 {
+
5988 public:
+
5989 virtual bool match(
+
5990 _In_reads_or_z_(end) const char* text,
+
5991 _In_ size_t start = 0,
+
5992 _In_ size_t end = (size_t)-1,
+
5993 _In_ int flags = match_default)
+
5994 {
+
5995 assert(text || start >= end);
+
5996 this->interval.end = start;
+
5997 if (type.match(text, this->interval.end, end, flags))
+
5998 this->interval.end = type.interval.end;
+
5999 else
+
6000 goto error;
+
6001 while (m_space.match(text, this->interval.end, end, flags))
+
6002 this->interval.end = m_space.interval.end;
+
6003 if (this->interval.end < end && text[this->interval.end] == '/')
+
6004 this->interval.end++;
+
6005 else
+
6006 goto error;
+
6007 while (m_space.match(text, this->interval.end, end, flags))
+
6008 this->interval.end = m_space.interval.end;
+
6009 if (subtype.match(text, this->interval.end, end, flags))
+
6010 this->interval.end = subtype.interval.end;
+
6011 else
+
6012 goto error;
+
6013 this->interval.start = start;
+
6014 return true;
+
6015
+
6016 error:
+
6017 type.invalidate();
+
6018 subtype.invalidate();
+
6019 this->interval.start = (this->interval.end = start) + 1;
+
6020 return false;
+
6021 }
+
6022
+
6023 virtual void invalidate()
+
6024 {
+
6025 type.invalidate();
+
6026 subtype.invalidate();
+
6027 parser::invalidate();
+
6028 }
+
6029
+
6030 public:
+
6031 http_token type;
+
6032 http_token subtype;
+
6033
+
6034 protected:
+
6035 http_space m_space;
+
6036 };
-
6038
-
- -
6043 {
-
6044 public:
-
6045 virtual bool match(
-
6046 _In_reads_or_z_(end) const char* text,
-
6047 _In_ size_t start = 0,
-
6048 _In_ size_t end = (size_t)-1,
-
6049 _In_ int flags = match_default)
-
6050 {
-
6051 assert(text || start >= end);
-
6052 if (!http_media_range::match(text, start, end, flags))
-
6053 goto error;
-
6054 params.clear();
-
6055 for (;;) {
-
6056 if (this->interval.end < end && text[this->interval.end]) {
-
6057 if (m_space.match(text, this->interval.end, end, flags))
-
6058 this->interval.end = m_space.interval.end;
-
6059 else if (text[this->interval.end] == ';') {
-
6060 this->interval.end++;
-
6061 while (m_space.match(text, this->interval.end, end, flags))
-
6062 this->interval.end = m_space.interval.end;
- -
6064 if (param.match(text, this->interval.end, end, flags)) {
-
6065 this->interval.end = param.interval.end;
-
6066 params.push_back(std::move(param));
-
6067 }
-
6068 else
-
6069 break;
-
6070 }
-
6071 else
-
6072 break;
-
6073 }
-
6074 else
-
6075 break;
-
6076 }
-
6077 this->interval.end = params.empty() ? subtype.interval.end : params.back().interval.end;
-
6078 return true;
-
6079
-
6080 error:
-
6081 http_media_range::invalidate();
-
6082 params.clear();
-
6083 this->interval.start = (this->interval.end = start) + 1;
-
6084 return false;
-
6085 }
-
6086
-
6087 virtual void invalidate()
-
6088 {
-
6089 params.clear();
-
6090 http_media_range::invalidate();
-
6091 }
-
6092
-
6093 public:
-
6094 std::list<http_parameter> params;
-
6095 };
+
6037
+
+ +
6042 {
+
6043 public:
+
6044 virtual bool match(
+
6045 _In_reads_or_z_(end) const char* text,
+
6046 _In_ size_t start = 0,
+
6047 _In_ size_t end = (size_t)-1,
+
6048 _In_ int flags = match_default)
+
6049 {
+
6050 assert(text || start >= end);
+
6051 if (!http_media_range::match(text, start, end, flags))
+
6052 goto error;
+
6053 params.clear();
+
6054 for (;;) {
+
6055 if (this->interval.end < end && text[this->interval.end]) {
+
6056 if (m_space.match(text, this->interval.end, end, flags))
+
6057 this->interval.end = m_space.interval.end;
+
6058 else if (text[this->interval.end] == ';') {
+
6059 this->interval.end++;
+
6060 while (m_space.match(text, this->interval.end, end, flags))
+
6061 this->interval.end = m_space.interval.end;
+ +
6063 if (param.match(text, this->interval.end, end, flags)) {
+
6064 this->interval.end = param.interval.end;
+
6065 params.push_back(std::move(param));
+
6066 }
+
6067 else
+
6068 break;
+
6069 }
+
6070 else
+
6071 break;
+
6072 }
+
6073 else
+
6074 break;
+
6075 }
+
6076 this->interval.end = params.empty() ? subtype.interval.end : params.back().interval.end;
+
6077 return true;
+
6078
+
6079 error:
+
6080 http_media_range::invalidate();
+
6081 params.clear();
+
6082 this->interval.start = (this->interval.end = start) + 1;
+
6083 return false;
+
6084 }
+
6085
+
6086 virtual void invalidate()
+
6087 {
+
6088 params.clear();
+
6089 http_media_range::invalidate();
+
6090 }
+
6091
+
6092 public:
+
6093 std::list<http_parameter> params;
+
6094 };
-
6096
-
- -
6101 {
-
6102 public:
-
6103 virtual bool match(
-
6104 _In_reads_or_z_(end) const char* text,
-
6105 _In_ size_t start = 0,
-
6106 _In_ size_t end = (size_t)-1,
-
6107 _In_ int flags = match_default)
-
6108 {
-
6109 assert(text || start >= end);
-
6110 this->interval.end = start;
-
6111 for (;;) {
-
6112 if (this->interval.end < end && text[this->interval.end]) {
-
6113 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6114 (unsigned int)text[this->interval.end] == 0x7f ||
-
6115 text[this->interval.end] == ':' ||
-
6116 text[this->interval.end] == '/' ||
-
6117 isspace(text[this->interval.end]))
-
6118 break;
-
6119 else
-
6120 this->interval.end++;
-
6121 }
-
6122 else
-
6123 break;
-
6124 }
- -
6126 this->interval.start = start;
-
6127 return true;
-
6128 }
-
6129 this->interval.start = (this->interval.end = start) + 1;
-
6130 return false;
-
6131 }
-
6132 };
+
6095
+
+ +
6100 {
+
6101 public:
+
6102 virtual bool match(
+
6103 _In_reads_or_z_(end) const char* text,
+
6104 _In_ size_t start = 0,
+
6105 _In_ size_t end = (size_t)-1,
+
6106 _In_ int flags = match_default)
+
6107 {
+
6108 assert(text || start >= end);
+
6109 this->interval.end = start;
+
6110 for (;;) {
+
6111 if (this->interval.end < end && text[this->interval.end]) {
+
6112 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6113 (unsigned int)text[this->interval.end] == 0x7f ||
+
6114 text[this->interval.end] == ':' ||
+
6115 text[this->interval.end] == '/' ||
+
6116 isspace(text[this->interval.end]))
+
6117 break;
+
6118 else
+
6119 this->interval.end++;
+
6120 }
+
6121 else
+
6122 break;
+
6123 }
+ +
6125 this->interval.start = start;
+
6126 return true;
+
6127 }
+
6128 this->interval.start = (this->interval.end = start) + 1;
+
6129 return false;
+
6130 }
+
6131 };
-
6133
-
-
6137 class http_url_port : public parser
-
6138 {
-
6139 public:
-
6140 http_url_port(_In_ const std::locale& locale = std::locale()) :
-
6141 parser(locale),
-
6142 value(0)
-
6143 {}
-
6144
-
6145 virtual bool match(
-
6146 _In_reads_or_z_(end) const char* text,
-
6147 _In_ size_t start = 0,
-
6148 _In_ size_t end = (size_t)-1,
-
6149 _In_ int flags = match_default)
-
6150 {
-
6151 assert(text || start >= end);
-
6152 value = 0;
-
6153 this->interval.end = start;
-
6154 for (;;) {
-
6155 if (this->interval.end < end && text[this->interval.end]) {
-
6156 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
-
6157 size_t _value = (size_t)value * 10 + text[this->interval.end] - '0';
-
6158 if (_value > (uint16_t)-1) {
-
6159 value = 0;
-
6160 this->interval.start = (this->interval.end = start) + 1;
-
6161 return false;
-
6162 }
-
6163 value = (uint16_t)_value;
-
6164 this->interval.end++;
-
6165 }
-
6166 else
-
6167 break;
-
6168 }
-
6169 else
-
6170 break;
-
6171 }
- -
6173 this->interval.start = start;
-
6174 return true;
-
6175 }
-
6176 this->interval.start = (this->interval.end = start) + 1;
-
6177 return false;
-
6178 }
-
6179
-
6180 virtual void invalidate()
-
6181 {
-
6182 value = 0;
-
6183 parser::invalidate();
-
6184 }
-
6185
-
6186 public:
-
6187 uint16_t value;
-
6188 };
+
6132
+
+
6136 class http_url_port : public parser
+
6137 {
+
6138 public:
+
6139 http_url_port(_In_ const std::locale& locale = std::locale()) :
+
6140 parser(locale),
+
6141 value(0)
+
6142 {}
+
6143
+
6144 virtual bool match(
+
6145 _In_reads_or_z_(end) const char* text,
+
6146 _In_ size_t start = 0,
+
6147 _In_ size_t end = (size_t)-1,
+
6148 _In_ int flags = match_default)
+
6149 {
+
6150 assert(text || start >= end);
+
6151 value = 0;
+
6152 this->interval.end = start;
+
6153 for (;;) {
+
6154 if (this->interval.end < end && text[this->interval.end]) {
+
6155 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
+
6156 size_t _value = (size_t)value * 10 + text[this->interval.end] - '0';
+
6157 if (_value > (uint16_t)-1) {
+
6158 value = 0;
+
6159 this->interval.start = (this->interval.end = start) + 1;
+
6160 return false;
+
6161 }
+
6162 value = (uint16_t)_value;
+
6163 this->interval.end++;
+
6164 }
+
6165 else
+
6166 break;
+
6167 }
+
6168 else
+
6169 break;
+
6170 }
+ +
6172 this->interval.start = start;
+
6173 return true;
+
6174 }
+
6175 this->interval.start = (this->interval.end = start) + 1;
+
6176 return false;
+
6177 }
+
6178
+
6179 virtual void invalidate()
+
6180 {
+
6181 value = 0;
+
6182 parser::invalidate();
+
6183 }
+
6184
+
6185 public:
+
6186 uint16_t value;
+
6187 };
-
6189
-
- -
6194 {
-
6195 public:
-
6196 virtual bool match(
-
6197 _In_reads_or_z_(end) const char* text,
-
6198 _In_ size_t start = 0,
-
6199 _In_ size_t end = (size_t)-1,
-
6200 _In_ int flags = match_default)
-
6201 {
-
6202 assert(text || start >= end);
-
6203 this->interval.end = start;
-
6204 for (;;) {
-
6205 if (this->interval.end < end && text[this->interval.end]) {
-
6206 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6207 (unsigned int)text[this->interval.end] == 0x7f ||
-
6208 text[this->interval.end] == '?' ||
-
6209 text[this->interval.end] == '/' ||
-
6210 isspace(text[this->interval.end]))
-
6211 break;
-
6212 else
-
6213 this->interval.end++;
-
6214 }
-
6215 else
-
6216 break;
-
6217 }
-
6218 this->interval.start = start;
-
6219 return true;
-
6220 }
-
6221 };
+
6188
+
+ +
6193 {
+
6194 public:
+
6195 virtual bool match(
+
6196 _In_reads_or_z_(end) const char* text,
+
6197 _In_ size_t start = 0,
+
6198 _In_ size_t end = (size_t)-1,
+
6199 _In_ int flags = match_default)
+
6200 {
+
6201 assert(text || start >= end);
+
6202 this->interval.end = start;
+
6203 for (;;) {
+
6204 if (this->interval.end < end && text[this->interval.end]) {
+
6205 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6206 (unsigned int)text[this->interval.end] == 0x7f ||
+
6207 text[this->interval.end] == '?' ||
+
6208 text[this->interval.end] == '/' ||
+
6209 isspace(text[this->interval.end]))
+
6210 break;
+
6211 else
+
6212 this->interval.end++;
+
6213 }
+
6214 else
+
6215 break;
+
6216 }
+
6217 this->interval.start = start;
+
6218 return true;
+
6219 }
+
6220 };
-
6222
-
-
6226 class http_url_path : public parser
-
6227 {
-
6228 public:
-
6229 virtual bool match(
-
6230 _In_reads_or_z_(end) const char* text,
-
6231 _In_ size_t start = 0,
-
6232 _In_ size_t end = (size_t)-1,
-
6233 _In_ int flags = match_default)
-
6234 {
-
6235 assert(text || start >= end);
- -
6237 this->interval.end = start;
-
6238 segments.clear();
-
6239 assert(text || this->interval.end >= end);
-
6240 if (this->interval.end < end && text[this->interval.end] != '/')
-
6241 goto error;
-
6242 this->interval.end++;
-
6243 s.match(text, this->interval.end, end, flags);
-
6244 segments.push_back(s);
-
6245 this->interval.end = s.interval.end;
-
6246 for (;;) {
-
6247 if (this->interval.end < end && text[this->interval.end]) {
-
6248 if (text[this->interval.end] == '/') {
-
6249 this->interval.end++;
-
6250 s.match(text, this->interval.end, end, flags);
-
6251 segments.push_back(s);
-
6252 this->interval.end = s.interval.end;
-
6253 }
-
6254 else
-
6255 break;
-
6256 }
-
6257 else
-
6258 break;
-
6259 }
-
6260 this->interval.start = start;
-
6261 return true;
-
6262
-
6263 error:
-
6264 segments.clear();
-
6265 this->interval.start = (this->interval.end = start) + 1;
-
6266 return false;
-
6267 }
-
6268
-
6269 virtual void invalidate()
-
6270 {
-
6271 segments.clear();
-
6272 parser::invalidate();
-
6273 }
-
6274
-
6275 public:
-
6276 std::vector<http_url_path_segment> segments;
-
6277 };
+
6221
+
+
6225 class http_url_path : public parser
+
6226 {
+
6227 public:
+
6228 virtual bool match(
+
6229 _In_reads_or_z_(end) const char* text,
+
6230 _In_ size_t start = 0,
+
6231 _In_ size_t end = (size_t)-1,
+
6232 _In_ int flags = match_default)
+
6233 {
+
6234 assert(text || start >= end);
+ +
6236 this->interval.end = start;
+
6237 segments.clear();
+
6238 assert(text || this->interval.end >= end);
+
6239 if (this->interval.end < end && text[this->interval.end] != '/')
+
6240 goto error;
+
6241 this->interval.end++;
+
6242 s.match(text, this->interval.end, end, flags);
+
6243 segments.push_back(s);
+
6244 this->interval.end = s.interval.end;
+
6245 for (;;) {
+
6246 if (this->interval.end < end && text[this->interval.end]) {
+
6247 if (text[this->interval.end] == '/') {
+
6248 this->interval.end++;
+
6249 s.match(text, this->interval.end, end, flags);
+
6250 segments.push_back(s);
+
6251 this->interval.end = s.interval.end;
+
6252 }
+
6253 else
+
6254 break;
+
6255 }
+
6256 else
+
6257 break;
+
6258 }
+
6259 this->interval.start = start;
+
6260 return true;
+
6261
+
6262 error:
+
6263 segments.clear();
+
6264 this->interval.start = (this->interval.end = start) + 1;
+
6265 return false;
+
6266 }
+
6267
+
6268 virtual void invalidate()
+
6269 {
+
6270 segments.clear();
+
6271 parser::invalidate();
+
6272 }
+
6273
+
6274 public:
+
6275 std::vector<http_url_path_segment> segments;
+
6276 };
-
6278
-
- -
6283 {
-
6284 public:
-
6285 virtual bool match(
-
6286 _In_reads_or_z_(end) const char* text,
-
6287 _In_ size_t start = 0,
-
6288 _In_ size_t end = (size_t)-1,
-
6289 _In_ int flags = match_default)
-
6290 {
-
6291 assert(text || start >= end);
-
6292 this->interval.end = start;
-
6293 name.start = this->interval.end;
-
6294 for (;;) {
-
6295 if (this->interval.end < end && text[this->interval.end]) {
-
6296 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6297 (unsigned int)text[this->interval.end] == 0x7f ||
-
6298 text[this->interval.end] == '&' ||
-
6299 text[this->interval.end] == '=' ||
-
6300 isspace(text[this->interval.end]))
-
6301 break;
-
6302 else
-
6303 this->interval.end++;
-
6304 }
-
6305 else
-
6306 break;
-
6307 }
- -
6309 name.end = this->interval.end;
-
6310 else
-
6311 goto error;
-
6312 if (text[this->interval.end] == '=') {
-
6313 this->interval.end++;
-
6314 value.start = this->interval.end;
-
6315 for (;;) {
-
6316 if (this->interval.end < end && text[this->interval.end]) {
-
6317 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6318 (unsigned int)text[this->interval.end] == 0x7f ||
-
6319 text[this->interval.end] == '&' ||
-
6320 isspace(text[this->interval.end]))
-
6321 break;
-
6322 else
-
6323 this->interval.end++;
-
6324 }
-
6325 else
-
6326 break;
-
6327 }
-
6328 value.end = this->interval.end;
-
6329 }
-
6330 else {
-
6331 value.start = 1;
-
6332 value.end = 0;
-
6333 }
-
6334 this->interval.start = start;
-
6335 return true;
-
6336
-
6337 error:
-
6338 name.start = 1;
-
6339 name.end = 0;
-
6340 value.start = 1;
-
6341 value.end = 0;
-
6342 this->interval.start = (this->interval.end = start) + 1;
-
6343 return false;
-
6344 }
-
6345
-
6346 virtual void invalidate()
-
6347 {
-
6348 name.start = 1;
-
6349 name.end = 0;
-
6350 value.start = 1;
-
6351 value.end = 0;
-
6352 parser::invalidate();
-
6353 }
-
6354
-
6355 public:
- - -
6358 };
+
6277
+
+ +
6282 {
+
6283 public:
+
6284 virtual bool match(
+
6285 _In_reads_or_z_(end) const char* text,
+
6286 _In_ size_t start = 0,
+
6287 _In_ size_t end = (size_t)-1,
+
6288 _In_ int flags = match_default)
+
6289 {
+
6290 assert(text || start >= end);
+
6291 this->interval.end = start;
+
6292 name.start = this->interval.end;
+
6293 for (;;) {
+
6294 if (this->interval.end < end && text[this->interval.end]) {
+
6295 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6296 (unsigned int)text[this->interval.end] == 0x7f ||
+
6297 text[this->interval.end] == '&' ||
+
6298 text[this->interval.end] == '=' ||
+
6299 isspace(text[this->interval.end]))
+
6300 break;
+
6301 else
+
6302 this->interval.end++;
+
6303 }
+
6304 else
+
6305 break;
+
6306 }
+ +
6308 name.end = this->interval.end;
+
6309 else
+
6310 goto error;
+
6311 if (text[this->interval.end] == '=') {
+
6312 this->interval.end++;
+
6313 value.start = this->interval.end;
+
6314 for (;;) {
+
6315 if (this->interval.end < end && text[this->interval.end]) {
+
6316 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6317 (unsigned int)text[this->interval.end] == 0x7f ||
+
6318 text[this->interval.end] == '&' ||
+
6319 isspace(text[this->interval.end]))
+
6320 break;
+
6321 else
+
6322 this->interval.end++;
+
6323 }
+
6324 else
+
6325 break;
+
6326 }
+
6327 value.end = this->interval.end;
+
6328 }
+
6329 else {
+
6330 value.start = 1;
+
6331 value.end = 0;
+
6332 }
+
6333 this->interval.start = start;
+
6334 return true;
+
6335
+
6336 error:
+
6337 name.start = 1;
+
6338 name.end = 0;
+
6339 value.start = 1;
+
6340 value.end = 0;
+
6341 this->interval.start = (this->interval.end = start) + 1;
+
6342 return false;
+
6343 }
+
6344
+
6345 virtual void invalidate()
+
6346 {
+
6347 name.start = 1;
+
6348 name.end = 0;
+
6349 value.start = 1;
+
6350 value.end = 0;
+
6351 parser::invalidate();
+
6352 }
+
6353
+
6354 public:
+ + +
6357 };
-
6359
-
-
6363 class http_url : public parser
-
6364 {
-
6365 public:
-
6366 http_url(_In_ const std::locale& locale = std::locale()) :
-
6367 parser(locale),
-
6368 port(locale)
-
6369 {}
-
6370
-
6371 virtual bool match(
-
6372 _In_reads_or_z_(end) const char* text,
-
6373 _In_ size_t start = 0,
-
6374 _In_ size_t end = (size_t)-1,
-
6375 _In_ int flags = match_default)
-
6376 {
-
6377 assert(text || start >= end);
-
6378 this->interval.end = start;
-
6379
-
6380 if (this->interval.end + 7 <= end && stdex::strnicmp(text + this->interval.end, 7, "http://", (size_t)-1, m_locale) == 0) {
-
6381 this->interval.end += 7;
-
6382 if (server.match(text, this->interval.end, end, flags))
-
6383 this->interval.end = server.interval.end;
-
6384 else
-
6385 goto error;
-
6386 if (this->interval.end < end && text[this->interval.end] == ':') {
-
6387 this->interval.end++;
-
6388 if (port.match(text, this->interval.end, end, flags))
-
6389 this->interval.end = port.interval.end;
-
6390 }
-
6391 else {
-
6392 port.invalidate();
-
6393 port.value = 80;
-
6394 }
-
6395 }
-
6396 else {
-
6397 server.invalidate();
-
6398 port.invalidate();
-
6399 port.value = 80;
-
6400 }
-
6401
-
6402 if (path.match(text, this->interval.end, end, flags))
-
6403 this->interval.end = path.interval.end;
-
6404 else
-
6405 goto error;
-
6406
-
6407 params.clear();
-
6408
-
6409 if (this->interval.end < end && text[this->interval.end] == '?') {
-
6410 this->interval.end++;
-
6411 for (;;) {
-
6412 if (this->interval.end < end && text[this->interval.end]) {
-
6413 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6414 (unsigned int)text[this->interval.end] == 0x7f ||
-
6415 isspace(text[this->interval.end]))
-
6416 break;
-
6417 else if (text[this->interval.end] == '&')
-
6418 this->interval.end++;
-
6419 else {
- -
6421 if (param.match(text, this->interval.end, end, flags)) {
-
6422 this->interval.end = param.interval.end;
-
6423 params.push_back(std::move(param));
-
6424 }
-
6425 else
-
6426 break;
-
6427 }
-
6428 }
-
6429 else
-
6430 break;
-
6431 }
-
6432 }
-
6433
-
6434 this->interval.start = start;
-
6435 return true;
-
6436
-
6437 error:
-
6438 server.invalidate();
-
6439 port.invalidate();
-
6440 path.invalidate();
-
6441 params.clear();
-
6442 this->interval.start = (this->interval.end = start) + 1;
-
6443 return false;
-
6444 }
-
6445
-
6446 virtual void invalidate()
-
6447 {
-
6448 server.invalidate();
-
6449 port.invalidate();
-
6450 path.invalidate();
-
6451 params.clear();
-
6452 parser::invalidate();
-
6453 }
-
6454
-
6455 public:
-
6456 http_url_server server;
-
6457 http_url_port port;
-
6458 http_url_path path;
-
6459 std::list<http_url_parameter> params;
-
6460 };
+
6358
+
+
6362 class http_url : public parser
+
6363 {
+
6364 public:
+
6365 http_url(_In_ const std::locale& locale = std::locale()) :
+
6366 parser(locale),
+
6367 port(locale)
+
6368 {}
+
6369
+
6370 virtual bool match(
+
6371 _In_reads_or_z_(end) const char* text,
+
6372 _In_ size_t start = 0,
+
6373 _In_ size_t end = (size_t)-1,
+
6374 _In_ int flags = match_default)
+
6375 {
+
6376 assert(text || start >= end);
+
6377 this->interval.end = start;
+
6378
+
6379 if (this->interval.end + 7 <= end && stdex::strnicmp(text + this->interval.end, 7, "http://", (size_t)-1, m_locale) == 0) {
+
6380 this->interval.end += 7;
+
6381 if (server.match(text, this->interval.end, end, flags))
+
6382 this->interval.end = server.interval.end;
+
6383 else
+
6384 goto error;
+
6385 if (this->interval.end < end && text[this->interval.end] == ':') {
+
6386 this->interval.end++;
+
6387 if (port.match(text, this->interval.end, end, flags))
+
6388 this->interval.end = port.interval.end;
+
6389 }
+
6390 else {
+
6391 port.invalidate();
+
6392 port.value = 80;
+
6393 }
+
6394 }
+
6395 else {
+
6396 server.invalidate();
+
6397 port.invalidate();
+
6398 port.value = 80;
+
6399 }
+
6400
+
6401 if (path.match(text, this->interval.end, end, flags))
+
6402 this->interval.end = path.interval.end;
+
6403 else
+
6404 goto error;
+
6405
+
6406 params.clear();
+
6407
+
6408 if (this->interval.end < end && text[this->interval.end] == '?') {
+
6409 this->interval.end++;
+
6410 for (;;) {
+
6411 if (this->interval.end < end && text[this->interval.end]) {
+
6412 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6413 (unsigned int)text[this->interval.end] == 0x7f ||
+
6414 isspace(text[this->interval.end]))
+
6415 break;
+
6416 else if (text[this->interval.end] == '&')
+
6417 this->interval.end++;
+
6418 else {
+ +
6420 if (param.match(text, this->interval.end, end, flags)) {
+
6421 this->interval.end = param.interval.end;
+
6422 params.push_back(std::move(param));
+
6423 }
+
6424 else
+
6425 break;
+
6426 }
+
6427 }
+
6428 else
+
6429 break;
+
6430 }
+
6431 }
+
6432
+
6433 this->interval.start = start;
+
6434 return true;
+
6435
+
6436 error:
+
6437 server.invalidate();
+
6438 port.invalidate();
+
6439 path.invalidate();
+
6440 params.clear();
+
6441 this->interval.start = (this->interval.end = start) + 1;
+
6442 return false;
+
6443 }
+
6444
+
6445 virtual void invalidate()
+
6446 {
+
6447 server.invalidate();
+
6448 port.invalidate();
+
6449 path.invalidate();
+
6450 params.clear();
+
6451 parser::invalidate();
+
6452 }
+
6453
+
6454 public:
+
6455 http_url_server server;
+
6456 http_url_port port;
+
6457 http_url_path path;
+
6458 std::list<http_url_parameter> params;
+
6459 };
-
6461
-
-
6465 class http_language : public parser
-
6466 {
-
6467 public:
-
6468 virtual bool match(
-
6469 _In_reads_or_z_(end) const char* text,
-
6470 _In_ size_t start = 0,
-
6471 _In_ size_t end = (size_t)-1,
-
6472 _In_ int flags = match_default)
-
6473 {
-
6474 assert(text || start >= end);
-
6475 this->interval.end = start;
-
6476 components.clear();
-
6477 for (;;) {
-
6478 if (this->interval.end < end && text[this->interval.end]) {
- -
6480 k.end = this->interval.end;
-
6481 for (;;) {
-
6482 if (k.end < end && text[k.end]) {
-
6483 if (isalpha(text[k.end]))
-
6484 k.end++;
-
6485 else
-
6486 break;
-
6487 }
-
6488 else
-
6489 break;
-
6490 }
-
6491 if (this->interval.end < k.end) {
-
6492 k.start = this->interval.end;
-
6493 this->interval.end = k.end;
-
6494 components.push_back(k);
-
6495 }
-
6496 else
-
6497 break;
-
6498 if (this->interval.end < end && text[this->interval.end] == '-')
-
6499 this->interval.end++;
-
6500 else
-
6501 break;
-
6502 }
-
6503 else
-
6504 break;
-
6505 }
-
6506 if (!components.empty()) {
-
6507 this->interval.start = start;
-
6508 this->interval.end = components.back().end;
-
6509 return true;
-
6510 }
-
6511 this->interval.start = (this->interval.end = start) + 1;
-
6512 return false;
-
6513 }
-
6514
-
6515 virtual void invalidate()
-
6516 {
-
6517 components.clear();
-
6518 parser::invalidate();
-
6519 }
-
6520
-
6521 public:
-
6522 std::vector<stdex::interval<size_t>> components;
-
6523 };
+
6460
+
+
6464 class http_language : public parser
+
6465 {
+
6466 public:
+
6467 virtual bool match(
+
6468 _In_reads_or_z_(end) const char* text,
+
6469 _In_ size_t start = 0,
+
6470 _In_ size_t end = (size_t)-1,
+
6471 _In_ int flags = match_default)
+
6472 {
+
6473 assert(text || start >= end);
+
6474 this->interval.end = start;
+
6475 components.clear();
+
6476 for (;;) {
+
6477 if (this->interval.end < end && text[this->interval.end]) {
+ +
6479 k.end = this->interval.end;
+
6480 for (;;) {
+
6481 if (k.end < end && text[k.end]) {
+
6482 if (isalpha(text[k.end]))
+
6483 k.end++;
+
6484 else
+
6485 break;
+
6486 }
+
6487 else
+
6488 break;
+
6489 }
+
6490 if (this->interval.end < k.end) {
+
6491 k.start = this->interval.end;
+
6492 this->interval.end = k.end;
+
6493 components.push_back(k);
+
6494 }
+
6495 else
+
6496 break;
+
6497 if (this->interval.end < end && text[this->interval.end] == '-')
+
6498 this->interval.end++;
+
6499 else
+
6500 break;
+
6501 }
+
6502 else
+
6503 break;
+
6504 }
+
6505 if (!components.empty()) {
+
6506 this->interval.start = start;
+
6507 this->interval.end = components.back().end;
+
6508 return true;
+
6509 }
+
6510 this->interval.start = (this->interval.end = start) + 1;
+
6511 return false;
+
6512 }
+
6513
+
6514 virtual void invalidate()
+
6515 {
+
6516 components.clear();
+
6517 parser::invalidate();
+
6518 }
+
6519
+
6520 public:
+
6521 std::vector<stdex::interval<size_t>> components;
+
6522 };
-
6524
-
-
6528 class http_weight : public parser
-
6529 {
-
6530 public:
-
6531 http_weight(_In_ const std::locale& locale = std::locale()) :
-
6532 parser(locale),
-
6533 value(1.0f)
-
6534 {}
-
6535
-
6536 virtual bool match(
-
6537 _In_reads_or_z_(end) const char* text,
-
6538 _In_ size_t start = 0,
-
6539 _In_ size_t end = (size_t)-1,
-
6540 _In_ int flags = match_default)
-
6541 {
-
6542 assert(text || start >= end);
-
6543 size_t celi_del = 0, decimalni_del = 0, decimalni_del_n = 1;
-
6544 this->interval.end = start;
-
6545 for (;;) {
-
6546 if (this->interval.end < end && text[this->interval.end]) {
-
6547 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
-
6548 celi_del = celi_del * 10 + text[this->interval.end] - '0';
-
6549 this->interval.end++;
-
6550 }
-
6551 else if (text[this->interval.end] == '.') {
-
6552 this->interval.end++;
-
6553 for (;;) {
-
6554 if (this->interval.end < end && text[this->interval.end]) {
-
6555 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
-
6556 decimalni_del = decimalni_del * 10 + text[this->interval.end] - '0';
-
6557 decimalni_del_n *= 10;
-
6558 this->interval.end++;
-
6559 }
-
6560 else
-
6561 break;
-
6562 }
-
6563 else
-
6564 break;
-
6565 }
-
6566 break;
-
6567 }
-
6568 else
-
6569 break;
-
6570 }
-
6571 else
-
6572 break;
-
6573 }
- - -
6576 this->interval.start = start;
-
6577 return true;
-
6578 }
-
6579 value = 1.0f;
-
6580 this->interval.start = (this->interval.end = start) + 1;
-
6581 return false;
-
6582 }
-
6583
-
6584 virtual void invalidate()
-
6585 {
-
6586 value = 1.0f;
-
6587 parser::invalidate();
-
6588 }
-
6589
-
6590 public:
-
6591 float value;
-
6592 };
+
6523
+
+
6527 class http_weight : public parser
+
6528 {
+
6529 public:
+
6530 http_weight(_In_ const std::locale& locale = std::locale()) :
+
6531 parser(locale),
+
6532 value(1.0f)
+
6533 {}
+
6534
+
6535 virtual bool match(
+
6536 _In_reads_or_z_(end) const char* text,
+
6537 _In_ size_t start = 0,
+
6538 _In_ size_t end = (size_t)-1,
+
6539 _In_ int flags = match_default)
+
6540 {
+
6541 assert(text || start >= end);
+
6542 size_t celi_del = 0, decimalni_del = 0, decimalni_del_n = 1;
+
6543 this->interval.end = start;
+
6544 for (;;) {
+
6545 if (this->interval.end < end && text[this->interval.end]) {
+
6546 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
+
6547 celi_del = celi_del * 10 + text[this->interval.end] - '0';
+
6548 this->interval.end++;
+
6549 }
+
6550 else if (text[this->interval.end] == '.') {
+
6551 this->interval.end++;
+
6552 for (;;) {
+
6553 if (this->interval.end < end && text[this->interval.end]) {
+
6554 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
+
6555 decimalni_del = decimalni_del * 10 + text[this->interval.end] - '0';
+
6556 decimalni_del_n *= 10;
+
6557 this->interval.end++;
+
6558 }
+
6559 else
+
6560 break;
+
6561 }
+
6562 else
+
6563 break;
+
6564 }
+
6565 break;
+
6566 }
+
6567 else
+
6568 break;
+
6569 }
+
6570 else
+
6571 break;
+
6572 }
+ + +
6575 this->interval.start = start;
+
6576 return true;
+
6577 }
+
6578 value = 1.0f;
+
6579 this->interval.start = (this->interval.end = start) + 1;
+
6580 return false;
+
6581 }
+
6582
+
6583 virtual void invalidate()
+
6584 {
+
6585 value = 1.0f;
+
6586 parser::invalidate();
+
6587 }
+
6588
+
6589 public:
+
6590 float value;
+
6591 };
-
6593
-
-
6597 class http_asterisk : public parser
-
6598 {
-
6599 public:
-
6600 virtual bool match(
-
6601 _In_reads_or_z_(end) const char* text,
-
6602 _In_ size_t start = 0,
-
6603 _In_ size_t end = (size_t)-1,
-
6604 _In_ int flags = match_default)
-
6605 {
-
6606 assert(text || end <= start);
-
6607 if (start < end && text[start] == '*') {
-
6608 this->interval.end = (this->interval.start = start) + 1;
-
6609 return true;
-
6610 }
-
6611 this->interval.start = (this->interval.end = start) + 1;
-
6612 return false;
-
6613 }
-
6614 };
+
6592
+
+
6596 class http_asterisk : public parser
+
6597 {
+
6598 public:
+
6599 virtual bool match(
+
6600 _In_reads_or_z_(end) const char* text,
+
6601 _In_ size_t start = 0,
+
6602 _In_ size_t end = (size_t)-1,
+
6603 _In_ int flags = match_default)
+
6604 {
+
6605 assert(text || end <= start);
+
6606 if (start < end && text[start] == '*') {
+
6607 this->interval.end = (this->interval.start = start) + 1;
+
6608 return true;
+
6609 }
+
6610 this->interval.start = (this->interval.end = start) + 1;
+
6611 return false;
+
6612 }
+
6613 };
-
6615
-
6619 template <class T, class T_asterisk = http_asterisk>
-
- -
6621 {
-
6622 public:
-
6623 http_weighted_value(_In_ const std::locale& locale = std::locale()) :
-
6624 parser(locale),
-
6625 factor(locale)
-
6626 {}
-
6627
-
6628 virtual bool match(
-
6629 _In_reads_or_z_(end) const char* text,
-
6630 _In_ size_t start = 0,
-
6631 _In_ size_t end = (size_t)-1,
-
6632 _In_ int flags = match_default)
-
6633 {
-
6634 assert(text || start >= end);
-
6635 size_t konec_vrednosti;
-
6636 this->interval.end = start;
-
6637 if (asterisk.match(text, this->interval.end, end, flags)) {
-
6638 this->interval.end = konec_vrednosti = asterisk.interval.end;
-
6639 value.invalidate();
-
6640 }
-
6641 else if (value.match(text, this->interval.end, end, flags)) {
-
6642 this->interval.end = konec_vrednosti = value.interval.end;
-
6643 asterisk.invalidate();
-
6644 }
-
6645 else {
-
6646 asterisk.invalidate();
-
6647 value.invalidate();
-
6648 this->interval.start = (this->interval.end = start) + 1;
-
6649 return false;
-
6650 }
-
6651
-
6652 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
-
6653 if (this->interval.end < end && text[this->interval.end] == ';') {
-
6654 this->interval.end++;
-
6655 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
-
6656 if (this->interval.end < end && (text[this->interval.end] == 'q' || text[this->interval.end] == 'Q')) {
-
6657 this->interval.end++;
-
6658 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
-
6659 if (this->interval.end < end && text[this->interval.end] == '=') {
-
6660 this->interval.end++;
-
6661 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
-
6662 if (factor.match(text, this->interval.end, end, flags))
-
6663 this->interval.end = factor.interval.end;
-
6664 }
-
6665 }
-
6666 }
-
6667 if (!factor.interval) {
-
6668 factor.invalidate();
- -
6670 }
-
6671 this->interval.start = start;
-
6672 return true;
-
6673 }
-
6674
-
6675 virtual void invalidate()
-
6676 {
-
6677 asterisk.invalidate();
-
6678 value.invalidate();
-
6679 factor.invalidate();
-
6680 parser::invalidate();
-
6681 }
-
6682
-
6683 public:
-
6684 T_asterisk asterisk;
-
6685 T value;
-
6686 http_weight factor;
-
6687 };
+
6614
+
6618 template <class T, class T_asterisk = http_asterisk>
+
+ +
6620 {
+
6621 public:
+
6622 http_weighted_value(_In_ const std::locale& locale = std::locale()) :
+
6623 parser(locale),
+
6624 factor(locale)
+
6625 {}
+
6626
+
6627 virtual bool match(
+
6628 _In_reads_or_z_(end) const char* text,
+
6629 _In_ size_t start = 0,
+
6630 _In_ size_t end = (size_t)-1,
+
6631 _In_ int flags = match_default)
+
6632 {
+
6633 assert(text || start >= end);
+
6634 size_t konec_vrednosti;
+
6635 this->interval.end = start;
+
6636 if (asterisk.match(text, this->interval.end, end, flags)) {
+
6637 this->interval.end = konec_vrednosti = asterisk.interval.end;
+
6638 value.invalidate();
+
6639 }
+
6640 else if (value.match(text, this->interval.end, end, flags)) {
+
6641 this->interval.end = konec_vrednosti = value.interval.end;
+
6642 asterisk.invalidate();
+
6643 }
+
6644 else {
+
6645 asterisk.invalidate();
+
6646 value.invalidate();
+
6647 this->interval.start = (this->interval.end = start) + 1;
+
6648 return false;
+
6649 }
+
6650
+
6651 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
+
6652 if (this->interval.end < end && text[this->interval.end] == ';') {
+
6653 this->interval.end++;
+
6654 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
+
6655 if (this->interval.end < end && (text[this->interval.end] == 'q' || text[this->interval.end] == 'Q')) {
+
6656 this->interval.end++;
+
6657 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
+
6658 if (this->interval.end < end && text[this->interval.end] == '=') {
+
6659 this->interval.end++;
+
6660 while (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])) this->interval.end++;
+
6661 if (factor.match(text, this->interval.end, end, flags))
+
6662 this->interval.end = factor.interval.end;
+
6663 }
+
6664 }
+
6665 }
+
6666 if (!factor.interval) {
+
6667 factor.invalidate();
+ +
6669 }
+
6670 this->interval.start = start;
+
6671 return true;
+
6672 }
+
6673
+
6674 virtual void invalidate()
+
6675 {
+
6676 asterisk.invalidate();
+
6677 value.invalidate();
+
6678 factor.invalidate();
+
6679 parser::invalidate();
+
6680 }
+
6681
+
6682 public:
+
6683 T_asterisk asterisk;
+
6684 T value;
+
6685 http_weight factor;
+
6686 };
-
6688
-
- -
6693 {
-
6694 public:
-
6695 virtual bool match(
-
6696 _In_reads_or_z_(end) const char* text,
-
6697 _In_ size_t start = 0,
-
6698 _In_ size_t end = (size_t)-1,
-
6699 _In_ int flags = match_default)
-
6700 {
-
6701 assert(text || start >= end);
-
6702 this->interval.end = start;
-
6703 if (this->interval.end < end && text[this->interval.end] == '$')
-
6704 this->interval.end++;
-
6705 else
-
6706 goto error;
-
6707 if (name.match(text, this->interval.end, end, flags))
-
6708 this->interval.end = name.interval.end;
-
6709 else
-
6710 goto error;
-
6711 while (m_space.match(text, this->interval.end, end, flags))
-
6712 this->interval.end = m_space.interval.end;
-
6713 if (this->interval.end < end && text[this->interval.end] == '=')
-
6714 this->interval.end++;
-
6715 else
-
6716 goto error;
-
6717 while (m_space.match(text, this->interval.end, end, flags))
-
6718 this->interval.end = m_space.interval.end;
-
6719 if (value.match(text, this->interval.end, end, flags))
-
6720 this->interval.end = value.interval.end;
-
6721 else
-
6722 goto error;
-
6723 this->interval.start = start;
-
6724 return true;
-
6725
-
6726 error:
-
6727 name.invalidate();
-
6728 value.invalidate();
-
6729 this->interval.start = (this->interval.end = start) + 1;
-
6730 return false;
-
6731 }
-
6732
-
6733 virtual void invalidate()
-
6734 {
-
6735 name.invalidate();
-
6736 value.invalidate();
-
6737 parser::invalidate();
-
6738 }
-
6739
-
6740 public:
-
6741 http_token name;
-
6742 http_value value;
-
6743
-
6744 protected:
-
6745 http_space m_space;
-
6746 };
+
6687
+
+ +
6692 {
+
6693 public:
+
6694 virtual bool match(
+
6695 _In_reads_or_z_(end) const char* text,
+
6696 _In_ size_t start = 0,
+
6697 _In_ size_t end = (size_t)-1,
+
6698 _In_ int flags = match_default)
+
6699 {
+
6700 assert(text || start >= end);
+
6701 this->interval.end = start;
+
6702 if (this->interval.end < end && text[this->interval.end] == '$')
+
6703 this->interval.end++;
+
6704 else
+
6705 goto error;
+
6706 if (name.match(text, this->interval.end, end, flags))
+
6707 this->interval.end = name.interval.end;
+
6708 else
+
6709 goto error;
+
6710 while (m_space.match(text, this->interval.end, end, flags))
+
6711 this->interval.end = m_space.interval.end;
+
6712 if (this->interval.end < end && text[this->interval.end] == '=')
+
6713 this->interval.end++;
+
6714 else
+
6715 goto error;
+
6716 while (m_space.match(text, this->interval.end, end, flags))
+
6717 this->interval.end = m_space.interval.end;
+
6718 if (value.match(text, this->interval.end, end, flags))
+
6719 this->interval.end = value.interval.end;
+
6720 else
+
6721 goto error;
+
6722 this->interval.start = start;
+
6723 return true;
+
6724
+
6725 error:
+
6726 name.invalidate();
+
6727 value.invalidate();
+
6728 this->interval.start = (this->interval.end = start) + 1;
+
6729 return false;
+
6730 }
+
6731
+
6732 virtual void invalidate()
+
6733 {
+
6734 name.invalidate();
+
6735 value.invalidate();
+
6736 parser::invalidate();
+
6737 }
+
6738
+
6739 public:
+
6740 http_token name;
+
6741 http_value value;
+
6742
+
6743 protected:
+
6744 http_space m_space;
+
6745 };
-
6747
-
-
6751 class http_cookie : public parser
-
6752 {
-
6753 public:
-
6754 virtual bool match(
-
6755 _In_reads_or_z_(end) const char* text,
-
6756 _In_ size_t start = 0,
-
6757 _In_ size_t end = (size_t)-1,
-
6758 _In_ int flags = match_default)
-
6759 {
-
6760 assert(text || start >= end);
-
6761 this->interval.end = start;
-
6762 if (name.match(text, this->interval.end, end, flags))
-
6763 this->interval.end = name.interval.end;
-
6764 else
-
6765 goto error;
-
6766 while (m_space.match(text, this->interval.end, end, flags))
-
6767 this->interval.end = m_space.interval.end;
-
6768 if (this->interval.end < end && text[this->interval.end] == '=')
-
6769 this->interval.end++;
-
6770 else
-
6771 goto error;
-
6772 while (m_space.match(text, this->interval.end, end, flags))
-
6773 this->interval.end = m_space.interval.end;
-
6774 if (value.match(text, this->interval.end, end, flags))
-
6775 this->interval.end = value.interval.end;
-
6776 else
-
6777 goto error;
-
6778 params.clear();
-
6779 for (;;) {
-
6780 if (this->interval.end < end && text[this->interval.end]) {
-
6781 if (m_space.match(text, this->interval.end, end, flags))
-
6782 this->interval.end = m_space.interval.end;
-
6783 else if (text[this->interval.end] == ';') {
-
6784 this->interval.end++;
-
6785 while (m_space.match(text, this->interval.end, end, flags))
-
6786 this->interval.end = m_space.interval.end;
- -
6788 if (param.match(text, this->interval.end, end, flags)) {
-
6789 this->interval.end = param.interval.end;
-
6790 params.push_back(std::move(param));
-
6791 }
-
6792 else
-
6793 break;
-
6794 }
-
6795 else
-
6796 break;
-
6797 }
-
6798 else
-
6799 break;
-
6800 }
-
6801 this->interval.start = start;
-
6802 this->interval.end = params.empty() ? value.interval.end : params.back().interval.end;
-
6803 return true;
-
6804
-
6805 error:
-
6806 name.invalidate();
-
6807 value.invalidate();
-
6808 params.clear();
-
6809 this->interval.start = (this->interval.end = start) + 1;
-
6810 return false;
-
6811 }
-
6812
-
6813 virtual void invalidate()
-
6814 {
-
6815 name.invalidate();
-
6816 value.invalidate();
-
6817 params.clear();
-
6818 parser::invalidate();
-
6819 }
-
6820
-
6821 public:
- - -
6824 std::list<http_cookie_parameter> params;
-
6825
-
6826 protected:
-
6827 http_space m_space;
-
6828 };
+
6746
+
+
6750 class http_cookie : public parser
+
6751 {
+
6752 public:
+
6753 virtual bool match(
+
6754 _In_reads_or_z_(end) const char* text,
+
6755 _In_ size_t start = 0,
+
6756 _In_ size_t end = (size_t)-1,
+
6757 _In_ int flags = match_default)
+
6758 {
+
6759 assert(text || start >= end);
+
6760 this->interval.end = start;
+
6761 if (name.match(text, this->interval.end, end, flags))
+
6762 this->interval.end = name.interval.end;
+
6763 else
+
6764 goto error;
+
6765 while (m_space.match(text, this->interval.end, end, flags))
+
6766 this->interval.end = m_space.interval.end;
+
6767 if (this->interval.end < end && text[this->interval.end] == '=')
+
6768 this->interval.end++;
+
6769 else
+
6770 goto error;
+
6771 while (m_space.match(text, this->interval.end, end, flags))
+
6772 this->interval.end = m_space.interval.end;
+
6773 if (value.match(text, this->interval.end, end, flags))
+
6774 this->interval.end = value.interval.end;
+
6775 else
+
6776 goto error;
+
6777 params.clear();
+
6778 for (;;) {
+
6779 if (this->interval.end < end && text[this->interval.end]) {
+
6780 if (m_space.match(text, this->interval.end, end, flags))
+
6781 this->interval.end = m_space.interval.end;
+
6782 else if (text[this->interval.end] == ';') {
+
6783 this->interval.end++;
+
6784 while (m_space.match(text, this->interval.end, end, flags))
+
6785 this->interval.end = m_space.interval.end;
+ +
6787 if (param.match(text, this->interval.end, end, flags)) {
+
6788 this->interval.end = param.interval.end;
+
6789 params.push_back(std::move(param));
+
6790 }
+
6791 else
+
6792 break;
+
6793 }
+
6794 else
+
6795 break;
+
6796 }
+
6797 else
+
6798 break;
+
6799 }
+
6800 this->interval.start = start;
+
6801 this->interval.end = params.empty() ? value.interval.end : params.back().interval.end;
+
6802 return true;
+
6803
+
6804 error:
+
6805 name.invalidate();
+
6806 value.invalidate();
+
6807 params.clear();
+
6808 this->interval.start = (this->interval.end = start) + 1;
+
6809 return false;
+
6810 }
+
6811
+
6812 virtual void invalidate()
+
6813 {
+
6814 name.invalidate();
+
6815 value.invalidate();
+
6816 params.clear();
+
6817 parser::invalidate();
+
6818 }
+
6819
+
6820 public:
+ + +
6823 std::list<http_cookie_parameter> params;
+
6824
+
6825 protected:
+
6826 http_space m_space;
+
6827 };
-
6829
-
-
6833 class http_agent : public parser
-
6834 {
-
6835 public:
-
6836 virtual bool match(
-
6837 _In_reads_or_z_(end) const char* text,
-
6838 _In_ size_t start = 0,
-
6839 _In_ size_t end = (size_t)-1,
-
6840 _In_ int flags = match_default)
-
6841 {
-
6842 assert(text || start >= end);
-
6843 this->interval.end = start;
-
6844 type.start = this->interval.end;
-
6845 for (;;) {
-
6846 if (this->interval.end < end && text[this->interval.end]) {
-
6847 if (text[this->interval.end] == '/') {
-
6848 type.end = this->interval.end;
-
6849 this->interval.end++;
-
6850 version.start = this->interval.end;
-
6851 for (;;) {
-
6852 if (this->interval.end < end && text[this->interval.end]) {
-
6853 if (isspace(text[this->interval.end])) {
-
6854 version.end = this->interval.end;
-
6855 break;
-
6856 }
-
6857 else
-
6858 this->interval.end++;
-
6859 }
-
6860 else {
-
6861 version.end = this->interval.end;
-
6862 break;
-
6863 }
-
6864 }
-
6865 break;
-
6866 }
-
6867 else if (isspace(text[this->interval.end])) {
-
6868 type.end = this->interval.end;
-
6869 break;
-
6870 }
-
6871 else
-
6872 this->interval.end++;
-
6873 }
-
6874 else {
-
6875 type.end = this->interval.end;
-
6876 break;
-
6877 }
-
6878 }
- -
6880 this->interval.start = start;
-
6881 return true;
-
6882 }
-
6883 type.start = 1;
-
6884 type.end = 0;
-
6885 version.start = 1;
-
6886 version.end = 0;
-
6887 this->interval.start = 1;
-
6888 this->interval.end = 0;
-
6889 return false;
-
6890 }
-
6891
-
6892 virtual void invalidate()
-
6893 {
-
6894 type.start = 1;
-
6895 type.end = 0;
-
6896 version.start = 1;
-
6897 version.end = 0;
-
6898 parser::invalidate();
-
6899 }
-
6900
-
6901 public:
- - -
6904 };
+
6828
+
+
6832 class http_agent : public parser
+
6833 {
+
6834 public:
+
6835 virtual bool match(
+
6836 _In_reads_or_z_(end) const char* text,
+
6837 _In_ size_t start = 0,
+
6838 _In_ size_t end = (size_t)-1,
+
6839 _In_ int flags = match_default)
+
6840 {
+
6841 assert(text || start >= end);
+
6842 this->interval.end = start;
+
6843 type.start = this->interval.end;
+
6844 for (;;) {
+
6845 if (this->interval.end < end && text[this->interval.end]) {
+
6846 if (text[this->interval.end] == '/') {
+
6847 type.end = this->interval.end;
+
6848 this->interval.end++;
+
6849 version.start = this->interval.end;
+
6850 for (;;) {
+
6851 if (this->interval.end < end && text[this->interval.end]) {
+
6852 if (isspace(text[this->interval.end])) {
+
6853 version.end = this->interval.end;
+
6854 break;
+
6855 }
+
6856 else
+
6857 this->interval.end++;
+
6858 }
+
6859 else {
+
6860 version.end = this->interval.end;
+
6861 break;
+
6862 }
+
6863 }
+
6864 break;
+
6865 }
+
6866 else if (isspace(text[this->interval.end])) {
+
6867 type.end = this->interval.end;
+
6868 break;
+
6869 }
+
6870 else
+
6871 this->interval.end++;
+
6872 }
+
6873 else {
+
6874 type.end = this->interval.end;
+
6875 break;
+
6876 }
+
6877 }
+ +
6879 this->interval.start = start;
+
6880 return true;
+
6881 }
+
6882 type.start = 1;
+
6883 type.end = 0;
+
6884 version.start = 1;
+
6885 version.end = 0;
+
6886 this->interval.start = 1;
+
6887 this->interval.end = 0;
+
6888 return false;
+
6889 }
+
6890
+
6891 virtual void invalidate()
+
6892 {
+
6893 type.start = 1;
+
6894 type.end = 0;
+
6895 version.start = 1;
+
6896 version.end = 0;
+
6897 parser::invalidate();
+
6898 }
+
6899
+
6900 public:
+ + +
6903 };
-
6905
-
-
6909 class http_protocol : public parser
-
6910 {
-
6911 public:
-
6912 http_protocol(_In_ const std::locale& locale = std::locale()) :
-
6913 parser(locale),
-
6914 version(0x009)
-
6915 {}
-
6916
-
6917 virtual bool match(
-
6918 _In_reads_or_z_(end) const char* text,
-
6919 _In_ size_t start = 0,
-
6920 _In_ size_t end = (size_t)-1,
-
6921 _In_ int flags = match_default)
-
6922 {
-
6923 assert(text || start >= end);
-
6924 this->interval.end = start;
-
6925 type.start = this->interval.end;
-
6926 for (;;) {
-
6927 if (this->interval.end < end && text[this->interval.end]) {
-
6928 if (text[this->interval.end] == '/') {
-
6929 type.end = this->interval.end;
-
6930 this->interval.end++;
-
6931 break;
-
6932 }
-
6933 else if (isspace(text[this->interval.end]))
-
6934 goto error;
-
6935 else
-
6936 this->interval.end++;
-
6937 }
-
6938 else {
-
6939 type.end = this->interval.end;
-
6940 goto error;
-
6941 }
-
6942 }
-
6943 version_maj.start = this->interval.end;
-
6944 for (;;) {
-
6945 if (this->interval.end < end && text[this->interval.end]) {
-
6946 if (text[this->interval.end] == '.') {
-
6947 version_maj.end = this->interval.end;
-
6948 this->interval.end++;
-
6949 version_min.start = this->interval.end;
-
6950 for (;;) {
-
6951 if (this->interval.end < end && text[this->interval.end]) {
-
6952 if (isspace(text[this->interval.end])) {
-
6953 version_min.end = this->interval.end;
-
6954 version =
-
6955 (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100 +
-
6956 (uint16_t)strtoui(text + version_min.start, version_min.size(), nullptr, 10);
-
6957 break;
-
6958 }
-
6959 else
-
6960 this->interval.end++;
-
6961 }
-
6962 else
-
6963 goto error;
-
6964 }
-
6965 break;
-
6966 }
-
6967 else if (isspace(text[this->interval.end])) {
-
6968 version_maj.end = this->interval.end;
-
6969 version_min.start = 1;
-
6970 version_min.end = 0;
-
6971 version = (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100;
-
6972 break;
-
6973 }
-
6974 else
-
6975 this->interval.end++;
-
6976 }
-
6977 else
-
6978 goto error;
-
6979 }
-
6980 this->interval.start = start;
-
6981 return true;
-
6982
-
6983 error:
-
6984 type.start = 1;
-
6985 type.end = 0;
-
6986 version_maj.start = 1;
-
6987 version_maj.end = 0;
-
6988 version_min.start = 1;
-
6989 version_min.end = 0;
-
6990 version = 0x009;
-
6991 this->interval.start = 1;
-
6992 this->interval.end = 0;
-
6993 return false;
-
6994 }
-
6995
-
6996 virtual void invalidate()
-
6997 {
-
6998 type.start = 1;
-
6999 type.end = 0;
-
7000 version_maj.start = 1;
-
7001 version_maj.end = 0;
-
7002 version_min.start = 1;
-
7003 version_min.end = 0;
-
7004 version = 0x009;
-
7005 parser::invalidate();
-
7006 }
-
7007
-
7008 public:
- -
7010 stdex::interval<size_t> version_maj;
-
7011 stdex::interval<size_t> version_min;
- -
7013 };
+
6904
+
+
6908 class http_protocol : public parser
+
6909 {
+
6910 public:
+
6911 http_protocol(_In_ const std::locale& locale = std::locale()) :
+
6912 parser(locale),
+
6913 version(0x009)
+
6914 {}
+
6915
+
6916 virtual bool match(
+
6917 _In_reads_or_z_(end) const char* text,
+
6918 _In_ size_t start = 0,
+
6919 _In_ size_t end = (size_t)-1,
+
6920 _In_ int flags = match_default)
+
6921 {
+
6922 assert(text || start >= end);
+
6923 this->interval.end = start;
+
6924 type.start = this->interval.end;
+
6925 for (;;) {
+
6926 if (this->interval.end < end && text[this->interval.end]) {
+
6927 if (text[this->interval.end] == '/') {
+
6928 type.end = this->interval.end;
+
6929 this->interval.end++;
+
6930 break;
+
6931 }
+
6932 else if (isspace(text[this->interval.end]))
+
6933 goto error;
+
6934 else
+
6935 this->interval.end++;
+
6936 }
+
6937 else {
+
6938 type.end = this->interval.end;
+
6939 goto error;
+
6940 }
+
6941 }
+
6942 version_maj.start = this->interval.end;
+
6943 for (;;) {
+
6944 if (this->interval.end < end && text[this->interval.end]) {
+
6945 if (text[this->interval.end] == '.') {
+
6946 version_maj.end = this->interval.end;
+
6947 this->interval.end++;
+
6948 version_min.start = this->interval.end;
+
6949 for (;;) {
+
6950 if (this->interval.end < end && text[this->interval.end]) {
+
6951 if (isspace(text[this->interval.end])) {
+
6952 version_min.end = this->interval.end;
+
6953 version =
+
6954 (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100 +
+
6955 (uint16_t)strtoui(text + version_min.start, version_min.size(), nullptr, 10);
+
6956 break;
+
6957 }
+
6958 else
+
6959 this->interval.end++;
+
6960 }
+
6961 else
+
6962 goto error;
+
6963 }
+
6964 break;
+
6965 }
+
6966 else if (isspace(text[this->interval.end])) {
+
6967 version_maj.end = this->interval.end;
+
6968 version_min.start = 1;
+
6969 version_min.end = 0;
+
6970 version = (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100;
+
6971 break;
+
6972 }
+
6973 else
+
6974 this->interval.end++;
+
6975 }
+
6976 else
+
6977 goto error;
+
6978 }
+
6979 this->interval.start = start;
+
6980 return true;
+
6981
+
6982 error:
+
6983 type.start = 1;
+
6984 type.end = 0;
+
6985 version_maj.start = 1;
+
6986 version_maj.end = 0;
+
6987 version_min.start = 1;
+
6988 version_min.end = 0;
+
6989 version = 0x009;
+
6990 this->interval.start = 1;
+
6991 this->interval.end = 0;
+
6992 return false;
+
6993 }
+
6994
+
6995 virtual void invalidate()
+
6996 {
+
6997 type.start = 1;
+
6998 type.end = 0;
+
6999 version_maj.start = 1;
+
7000 version_maj.end = 0;
+
7001 version_min.start = 1;
+
7002 version_min.end = 0;
+
7003 version = 0x009;
+
7004 parser::invalidate();
+
7005 }
+
7006
+
7007 public:
+ +
7009 stdex::interval<size_t> version_maj;
+
7010 stdex::interval<size_t> version_min;
+ +
7012 };
-
7014
-
-
7018 class http_request : public parser
-
7019 {
-
7020 public:
-
7021 http_request(_In_ const std::locale& locale = std::locale()) :
-
7022 parser(locale),
-
7023 url(locale),
-
7024 protocol(locale)
-
7025 {}
-
7026
-
7027 virtual bool match(
-
7028 _In_reads_or_z_(end) const char* text,
-
7029 _In_ size_t start = 0,
-
7030 _In_ size_t end = (size_t)-1,
-
7031 _In_ int flags = match_default)
-
7032 {
-
7033 assert(text || start >= end);
-
7034 this->interval.end = start;
-
7035
-
7036 for (;;) {
-
7037 if (m_line_break.match(text, this->interval.end, end, flags))
-
7038 goto error;
-
7039 else if (this->interval.end < end && text[this->interval.end]) {
-
7040 if (isspace(text[this->interval.end]))
-
7041 this->interval.end++;
-
7042 else
-
7043 break;
-
7044 }
-
7045 else
-
7046 goto error;
-
7047 }
-
7048 verb.start = this->interval.end;
-
7049 for (;;) {
-
7050 if (m_line_break.match(text, this->interval.end, end, flags))
-
7051 goto error;
-
7052 else if (this->interval.end < end && text[this->interval.end]) {
-
7053 if (isspace(text[this->interval.end])) {
-
7054 verb.end = this->interval.end;
-
7055 this->interval.end++;
-
7056 break;
-
7057 }
-
7058 else
-
7059 this->interval.end++;
-
7060 }
-
7061 else
-
7062 goto error;
-
7063 }
-
7064
-
7065 for (;;) {
-
7066 if (m_line_break.match(text, this->interval.end, end, flags))
-
7067 goto error;
-
7068 else if (this->interval.end < end && text[this->interval.end]) {
-
7069 if (isspace(text[this->interval.end]))
-
7070 this->interval.end++;
-
7071 else
-
7072 break;
-
7073 }
-
7074 else
-
7075 goto error;
-
7076 }
-
7077 if (url.match(text, this->interval.end, end, flags))
-
7078 this->interval.end = url.interval.end;
-
7079 else
-
7080 goto error;
-
7081
-
7082 protocol.invalidate();
-
7083 for (;;) {
-
7084 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7085 this->interval.end = m_line_break.interval.end;
-
7086 goto end;
-
7087 }
-
7088 else if (this->interval.end < end && text[this->interval.end]) {
-
7089 if (isspace(text[this->interval.end]))
-
7090 this->interval.end++;
-
7091 else
-
7092 break;
-
7093 }
-
7094 else
-
7095 goto end;
-
7096 }
-
7097 for (;;) {
-
7098 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7099 this->interval.end = m_line_break.interval.end;
-
7100 goto end;
-
7101 }
-
7102 else if (protocol.match(text, this->interval.end, end, flags)) {
-
7103 this->interval.end = protocol.interval.end;
-
7104 break;
-
7105 }
-
7106 else
-
7107 goto end;
-
7108 }
-
7109
-
7110 for (;;) {
-
7111 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7112 this->interval.end = m_line_break.interval.end;
-
7113 break;
-
7114 }
-
7115 else if (this->interval.end < end && text[this->interval.end])
-
7116 this->interval.end++;
-
7117 else
-
7118 goto end;
-
7119 }
-
7120
-
7121 end:
-
7122 this->interval.start = start;
-
7123 return true;
-
7124
-
7125 error:
-
7126 verb.start = 1;
-
7127 verb.end = 0;
-
7128 url.invalidate();
-
7129 protocol.invalidate();
-
7130 this->interval.start = 1;
-
7131 this->interval.end = 0;
-
7132 return false;
-
7133 }
-
7134
-
7135 virtual void invalidate()
-
7136 {
-
7137 verb.start = 1;
-
7138 verb.end = 0;
-
7139 url.invalidate();
-
7140 protocol.invalidate();
-
7141 parser::invalidate();
-
7142 }
-
7143
-
7144 public:
- -
7146 http_url url;
-
7147 http_protocol protocol;
-
7148
-
7149 protected:
-
7150 http_line_break m_line_break;
-
7151 };
+
7013
+
+
7017 class http_request : public parser
+
7018 {
+
7019 public:
+
7020 http_request(_In_ const std::locale& locale = std::locale()) :
+
7021 parser(locale),
+
7022 url(locale),
+
7023 protocol(locale)
+
7024 {}
+
7025
+
7026 virtual bool match(
+
7027 _In_reads_or_z_(end) const char* text,
+
7028 _In_ size_t start = 0,
+
7029 _In_ size_t end = (size_t)-1,
+
7030 _In_ int flags = match_default)
+
7031 {
+
7032 assert(text || start >= end);
+
7033 this->interval.end = start;
+
7034
+
7035 for (;;) {
+
7036 if (m_line_break.match(text, this->interval.end, end, flags))
+
7037 goto error;
+
7038 else if (this->interval.end < end && text[this->interval.end]) {
+
7039 if (isspace(text[this->interval.end]))
+
7040 this->interval.end++;
+
7041 else
+
7042 break;
+
7043 }
+
7044 else
+
7045 goto error;
+
7046 }
+
7047 verb.start = this->interval.end;
+
7048 for (;;) {
+
7049 if (m_line_break.match(text, this->interval.end, end, flags))
+
7050 goto error;
+
7051 else if (this->interval.end < end && text[this->interval.end]) {
+
7052 if (isspace(text[this->interval.end])) {
+
7053 verb.end = this->interval.end;
+
7054 this->interval.end++;
+
7055 break;
+
7056 }
+
7057 else
+
7058 this->interval.end++;
+
7059 }
+
7060 else
+
7061 goto error;
+
7062 }
+
7063
+
7064 for (;;) {
+
7065 if (m_line_break.match(text, this->interval.end, end, flags))
+
7066 goto error;
+
7067 else if (this->interval.end < end && text[this->interval.end]) {
+
7068 if (isspace(text[this->interval.end]))
+
7069 this->interval.end++;
+
7070 else
+
7071 break;
+
7072 }
+
7073 else
+
7074 goto error;
+
7075 }
+
7076 if (url.match(text, this->interval.end, end, flags))
+
7077 this->interval.end = url.interval.end;
+
7078 else
+
7079 goto error;
+
7080
+
7081 protocol.invalidate();
+
7082 for (;;) {
+
7083 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7084 this->interval.end = m_line_break.interval.end;
+
7085 goto end;
+
7086 }
+
7087 else if (this->interval.end < end && text[this->interval.end]) {
+
7088 if (isspace(text[this->interval.end]))
+
7089 this->interval.end++;
+
7090 else
+
7091 break;
+
7092 }
+
7093 else
+
7094 goto end;
+
7095 }
+
7096 for (;;) {
+
7097 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7098 this->interval.end = m_line_break.interval.end;
+
7099 goto end;
+
7100 }
+
7101 else if (protocol.match(text, this->interval.end, end, flags)) {
+
7102 this->interval.end = protocol.interval.end;
+
7103 break;
+
7104 }
+
7105 else
+
7106 goto end;
+
7107 }
+
7108
+
7109 for (;;) {
+
7110 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7111 this->interval.end = m_line_break.interval.end;
+
7112 break;
+
7113 }
+
7114 else if (this->interval.end < end && text[this->interval.end])
+
7115 this->interval.end++;
+
7116 else
+
7117 goto end;
+
7118 }
+
7119
+
7120 end:
+
7121 this->interval.start = start;
+
7122 return true;
+
7123
+
7124 error:
+
7125 verb.start = 1;
+
7126 verb.end = 0;
+
7127 url.invalidate();
+
7128 protocol.invalidate();
+
7129 this->interval.start = 1;
+
7130 this->interval.end = 0;
+
7131 return false;
+
7132 }
+
7133
+
7134 virtual void invalidate()
+
7135 {
+
7136 verb.start = 1;
+
7137 verb.end = 0;
+
7138 url.invalidate();
+
7139 protocol.invalidate();
+
7140 parser::invalidate();
+
7141 }
+
7142
+
7143 public:
+ +
7145 http_url url;
+
7146 http_protocol protocol;
+
7147
+
7148 protected:
+
7149 http_line_break m_line_break;
+
7150 };
-
7152
-
-
7156 class http_header : public parser
-
7157 {
-
7158 public:
-
7159 virtual bool match(
-
7160 _In_reads_or_z_(end) const char* text,
-
7161 _In_ size_t start = 0,
-
7162 _In_ size_t end = (size_t)-1,
-
7163 _In_ int flags = match_default)
-
7164 {
-
7165 assert(text || start >= end);
-
7166 this->interval.end = start;
-
7167
-
7168 if (m_line_break.match(text, this->interval.end, end, flags) ||
-
7169 (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])))
-
7170 goto error;
-
7171 name.start = this->interval.end;
-
7172 for (;;) {
-
7173 if (m_line_break.match(text, this->interval.end, end, flags))
-
7174 goto error;
-
7175 else if (this->interval.end < end && text[this->interval.end]) {
-
7176 if (isspace(text[this->interval.end])) {
-
7177 name.end = this->interval.end;
-
7178 this->interval.end++;
-
7179 for (;;) {
-
7180 if (m_line_break.match(text, this->interval.end, end, flags))
-
7181 goto error;
-
7182 else if (this->interval.end < end && text[this->interval.end]) {
-
7183 if (isspace(text[this->interval.end]))
-
7184 this->interval.end++;
-
7185 else
-
7186 break;
-
7187 }
-
7188 else
-
7189 goto error;
-
7190 }
-
7191 if (this->interval.end < end && text[this->interval.end] == ':') {
-
7192 this->interval.end++;
-
7193 break;
-
7194 }
-
7195 else
-
7196 goto error;
-
7197 break;
-
7198 }
-
7199 else if (text[this->interval.end] == ':') {
-
7200 name.end = this->interval.end;
-
7201 this->interval.end++;
-
7202 break;
-
7203 }
-
7204 else
-
7205 this->interval.end++;
-
7206 }
-
7207 else
-
7208 goto error;
-
7209 }
-
7210 value.start = (size_t)-1;
-
7211 value.end = 0;
-
7212 for (;;) {
-
7213 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7214 this->interval.end = m_line_break.interval.end;
-
7215 if (!m_line_break.match(text, this->interval.end, end, flags) &&
-
7216 this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end]))
-
7217 this->interval.end++;
-
7218 else
-
7219 break;
-
7220 }
-
7221 else if (this->interval.end < end && text[this->interval.end]) {
-
7222 if (isspace(text[this->interval.end]))
-
7223 this->interval.end++;
-
7224 else {
-
7225 if (value.start == (size_t)-1) value.start = this->interval.end;
-
7226 value.end = ++this->interval.end;
-
7227 }
-
7228 }
-
7229 else
-
7230 break;
-
7231 }
-
7232 this->interval.start = start;
-
7233 return true;
-
7234
-
7235 error:
-
7236 name.start = 1;
-
7237 name.end = 0;
-
7238 value.start = 1;
-
7239 value.end = 0;
-
7240 this->interval.start = 1;
-
7241 this->interval.end = 0;
-
7242 return false;
-
7243 }
-
7244
-
7245 virtual void invalidate()
-
7246 {
-
7247 name.start = 1;
-
7248 name.end = 0;
-
7249 value.start = 1;
-
7250 value.end = 0;
-
7251 parser::invalidate();
-
7252 }
-
7253
-
7254 public:
- - -
7257
-
7258 protected:
-
7259 http_line_break m_line_break;
-
7260 };
+
7151
+
+
7155 class http_header : public parser
+
7156 {
+
7157 public:
+
7158 virtual bool match(
+
7159 _In_reads_or_z_(end) const char* text,
+
7160 _In_ size_t start = 0,
+
7161 _In_ size_t end = (size_t)-1,
+
7162 _In_ int flags = match_default)
+
7163 {
+
7164 assert(text || start >= end);
+
7165 this->interval.end = start;
+
7166
+
7167 if (m_line_break.match(text, this->interval.end, end, flags) ||
+
7168 (this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end])))
+
7169 goto error;
+
7170 name.start = this->interval.end;
+
7171 for (;;) {
+
7172 if (m_line_break.match(text, this->interval.end, end, flags))
+
7173 goto error;
+
7174 else if (this->interval.end < end && text[this->interval.end]) {
+
7175 if (isspace(text[this->interval.end])) {
+
7176 name.end = this->interval.end;
+
7177 this->interval.end++;
+
7178 for (;;) {
+
7179 if (m_line_break.match(text, this->interval.end, end, flags))
+
7180 goto error;
+
7181 else if (this->interval.end < end && text[this->interval.end]) {
+
7182 if (isspace(text[this->interval.end]))
+
7183 this->interval.end++;
+
7184 else
+
7185 break;
+
7186 }
+
7187 else
+
7188 goto error;
+
7189 }
+
7190 if (this->interval.end < end && text[this->interval.end] == ':') {
+
7191 this->interval.end++;
+
7192 break;
+
7193 }
+
7194 else
+
7195 goto error;
+
7196 break;
+
7197 }
+
7198 else if (text[this->interval.end] == ':') {
+
7199 name.end = this->interval.end;
+
7200 this->interval.end++;
+
7201 break;
+
7202 }
+
7203 else
+
7204 this->interval.end++;
+
7205 }
+
7206 else
+
7207 goto error;
+
7208 }
+
7209 value.start = (size_t)-1;
+
7210 value.end = 0;
+
7211 for (;;) {
+
7212 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7213 this->interval.end = m_line_break.interval.end;
+
7214 if (!m_line_break.match(text, this->interval.end, end, flags) &&
+
7215 this->interval.end < end && text[this->interval.end] && isspace(text[this->interval.end]))
+
7216 this->interval.end++;
+
7217 else
+
7218 break;
+
7219 }
+
7220 else if (this->interval.end < end && text[this->interval.end]) {
+
7221 if (isspace(text[this->interval.end]))
+
7222 this->interval.end++;
+
7223 else {
+
7224 if (value.start == (size_t)-1) value.start = this->interval.end;
+
7225 value.end = ++this->interval.end;
+
7226 }
+
7227 }
+
7228 else
+
7229 break;
+
7230 }
+
7231 this->interval.start = start;
+
7232 return true;
+
7233
+
7234 error:
+
7235 name.start = 1;
+
7236 name.end = 0;
+
7237 value.start = 1;
+
7238 value.end = 0;
+
7239 this->interval.start = 1;
+
7240 this->interval.end = 0;
+
7241 return false;
+
7242 }
+
7243
+
7244 virtual void invalidate()
+
7245 {
+
7246 name.start = 1;
+
7247 name.end = 0;
+
7248 value.start = 1;
+
7249 value.end = 0;
+
7250 parser::invalidate();
+
7251 }
+
7252
+
7253 public:
+ + +
7256
+
7257 protected:
+
7258 http_line_break m_line_break;
+
7259 };
-
7261
-
7265 template <class _Key, class T>
-
-
7266 class http_value_collection : public T
-
7267 {
-
7268 public:
-
7269 void insert(
-
7270 _In_reads_or_z_(end) const char* text,
-
7271 _In_ size_t start = 0,
-
7272 _In_ size_t end = (size_t)-1,
-
7273 _In_ int flags = match_default)
-
7274 {
-
7275 while (start < end) {
-
7276 while (start < end && text[start] && isspace(text[start])) start++;
-
7277 if (start < end && text[start] == ',') {
-
7278 start++;
-
7279 while (start < end&& text[start] && isspace(text[start])) start++;
-
7280 }
-
7281 _Key el;
-
7282 if (el.match(text, start, end, flags)) {
-
7283 start = el.interval.end;
-
7284 T::insert(std::move(el));
-
7285 }
-
7286 else
-
7287 break;
-
7288 }
-
7289 }
-
7290 };
+
7260
+
7264 template <class _Key, class T>
+
+
7265 class http_value_collection : public T
+
7266 {
+
7267 public:
+
7268 void insert(
+
7269 _In_reads_or_z_(end) const char* text,
+
7270 _In_ size_t start = 0,
+
7271 _In_ size_t end = (size_t)-1,
+
7272 _In_ int flags = match_default)
+
7273 {
+
7274 while (start < end) {
+
7275 while (start < end && text[start] && isspace(text[start])) start++;
+
7276 if (start < end && text[start] == ',') {
+
7277 start++;
+
7278 while (start < end&& text[start] && isspace(text[start])) start++;
+
7279 }
+
7280 _Key el;
+
7281 if (el.match(text, start, end, flags)) {
+
7282 start = el.interval.end;
+
7283 T::insert(std::move(el));
+
7284 }
+
7285 else
+
7286 break;
+
7287 }
+
7288 }
+
7289 };
-
7291
-
7292 template <class T>
-
- -
7294 constexpr bool operator()(const T& a, const T& b) const noexcept
-
7295 {
-
7296 return a.factor.value > b.factor.value;
-
7297 }
-
7298 };
+
7290
+
7291 template <class T>
+
+ +
7293 constexpr bool operator()(const T& a, const T& b) const noexcept
+
7294 {
+
7295 return a.factor.value > b.factor.value;
+
7296 }
+
7297 };
-
7299
-
7303 template <class T, class _Alloc = std::allocator<T>>
- -
7305
-
7309 template <class T>
-
- -
7311 {
-
7312 public:
- -
7314 _In_ const std::shared_ptr<basic_parser<T>>& quote,
-
7315 _In_ const std::shared_ptr<basic_parser<T>>& chr,
-
7316 _In_ const std::shared_ptr<basic_parser<T>>& escape,
-
7317 _In_ const std::shared_ptr<basic_parser<T>>& sol,
-
7318 _In_ const std::shared_ptr<basic_parser<T>>& bs,
-
7319 _In_ const std::shared_ptr<basic_parser<T>>& ff,
-
7320 _In_ const std::shared_ptr<basic_parser<T>>& lf,
-
7321 _In_ const std::shared_ptr<basic_parser<T>>& cr,
-
7322 _In_ const std::shared_ptr<basic_parser<T>>& htab,
-
7323 _In_ const std::shared_ptr<basic_parser<T>>& uni,
-
7324 _In_ const std::shared_ptr<basic_integer16<T>>& hex,
-
7325 _In_ const std::locale& locale = std::locale()) :
-
7326 basic_parser<T>(locale),
-
7327 m_quote(quote),
-
7328 m_chr(chr),
-
7329 m_escape(escape),
-
7330 m_sol(sol),
-
7331 m_bs(bs),
-
7332 m_ff(ff),
-
7333 m_lf(lf),
-
7334 m_cr(cr),
-
7335 m_htab(htab),
-
7336 m_uni(uni),
-
7337 m_hex(hex)
-
7338 {}
-
7339
-
7340 virtual bool match(
-
7341 _In_reads_or_z_(end) const T* text,
-
7342 _In_ size_t start = 0,
-
7343 _In_ size_t end = (size_t)-1,
-
7344 _In_ int flags = match_default)
-
7345 {
-
7346 assert(text || start >= end);
-
7347 this->interval.end = start;
-
7348 if (m_quote->match(text, this->interval.end, end, flags)) {
-
7349 this->interval.end = m_quote->interval.end;
-
7350 value.clear();
-
7351 for (;;) {
-
7352 if (m_quote->match(text, this->interval.end, end, flags)) {
-
7353 this->interval.start = start;
-
7354 this->interval.end = m_quote->interval.end;
-
7355 return true;
-
7356 }
-
7357 if (m_escape->match(text, this->interval.end, end, flags)) {
-
7358 if (m_quote->match(text, m_escape->interval.end, end, flags)) {
-
7359 value += '"'; this->interval.end = m_quote->interval.end;
-
7360 continue;
-
7361 }
-
7362 if (m_sol->match(text, m_escape->interval.end, end, flags)) {
-
7363 value += '/'; this->interval.end = m_sol->interval.end;
-
7364 continue;
-
7365 }
-
7366 if (m_bs->match(text, m_escape->interval.end, end, flags)) {
-
7367 value += '\b'; this->interval.end = m_bs->interval.end;
-
7368 continue;
-
7369 }
-
7370 if (m_ff->match(text, m_escape->interval.end, end, flags)) {
-
7371 value += '\f'; this->interval.end = m_ff->interval.end;
-
7372 continue;
-
7373 }
-
7374 if (m_lf->match(text, m_escape->interval.end, end, flags)) {
-
7375 value += '\n'; this->interval.end = m_lf->interval.end;
-
7376 continue;
-
7377 }
-
7378 if (m_cr->match(text, m_escape->interval.end, end, flags)) {
-
7379 value += '\r'; this->interval.end = m_cr->interval.end;
-
7380 continue;
-
7381 }
-
7382 if (m_htab->match(text, m_escape->interval.end, end, flags)) {
-
7383 value += '\t'; this->interval.end = m_htab->interval.end;
-
7384 continue;
-
7385 }
-
7386 if (
-
7387 m_uni->match(text, m_escape->interval.end, end, flags) &&
-
7388 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end), flags | match_case_insensitive) &&
-
7389 m_hex->interval.size() == 4 /* JSON requests 4-digit Unicode sequneces: \u.... */)
-
7390 {
-
7391 assert(m_hex->value <= 0xffff);
-
7392 if (sizeof(T) == 1) {
-
7393 if (m_hex->value > 0x7ff) {
-
7394 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
-
7395 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
-
7396 value += (T)(0x80 | (m_hex->value & 0x3f));
-
7397 }
-
7398 else if (m_hex->value > 0x7f) {
-
7399 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
-
7400 value += (T)(0x80 | (m_hex->value & 0x3f));
-
7401 }
-
7402 else
-
7403 value += (T)(m_hex->value & 0x7f);
-
7404 }
-
7405 else
-
7406 value += (T)m_hex->value;
-
7407 this->interval.end = m_hex->interval.end;
-
7408 continue;
-
7409 }
-
7410 if (m_escape->match(text, m_escape->interval.end, end, flags)) {
-
7411 value += '\\'; this->interval.end = m_escape->interval.end;
-
7412 continue;
-
7413 }
-
7414 }
-
7415 if (m_chr->match(text, this->interval.end, end, flags)) {
-
7416 value.Prilepi(text + m_chr->interval.start, m_chr->interval.size());
-
7417 this->interval.end = m_chr->interval.end;
-
7418 continue;
-
7419 }
-
7420 break;
-
7421 }
-
7422 }
-
7423 value.clear();
-
7424 this->interval.start = (this->interval.end = start) + 1;
-
7425 return false;
-
7426 }
-
7427
-
7428 virtual void invalidate()
-
7429 {
-
7430 value.clear();
- -
7432 }
-
7433
-
7434 public:
-
7435 std::basic_string<T> value;
-
7436
-
7437 protected:
-
7438 std::shared_ptr<basic_parser<T>> m_quote;
-
7439 std::shared_ptr<basic_parser<T>> m_chr;
-
7440 std::shared_ptr<basic_parser<T>> m_escape;
-
7441 std::shared_ptr<basic_parser<T>> m_sol;
-
7442 std::shared_ptr<basic_parser<T>> m_bs;
-
7443 std::shared_ptr<basic_parser<T>> m_ff;
-
7444 std::shared_ptr<basic_parser<T>> m_lf;
-
7445 std::shared_ptr<basic_parser<T>> m_cr;
-
7446 std::shared_ptr<basic_parser<T>> m_htab;
-
7447 std::shared_ptr<basic_parser<T>> m_uni;
-
7448 std::shared_ptr<basic_integer16<T>> m_hex;
-
7449 };
+
7298
+
7302 template <class T, class _Alloc = std::allocator<T>>
+ +
7304
+
7308 template <class T>
+
+ +
7310 {
+
7311 public:
+ +
7313 _In_ const std::shared_ptr<basic_parser<T>>& quote,
+
7314 _In_ const std::shared_ptr<basic_parser<T>>& chr,
+
7315 _In_ const std::shared_ptr<basic_parser<T>>& escape,
+
7316 _In_ const std::shared_ptr<basic_parser<T>>& sol,
+
7317 _In_ const std::shared_ptr<basic_parser<T>>& bs,
+
7318 _In_ const std::shared_ptr<basic_parser<T>>& ff,
+
7319 _In_ const std::shared_ptr<basic_parser<T>>& lf,
+
7320 _In_ const std::shared_ptr<basic_parser<T>>& cr,
+
7321 _In_ const std::shared_ptr<basic_parser<T>>& htab,
+
7322 _In_ const std::shared_ptr<basic_parser<T>>& uni,
+
7323 _In_ const std::shared_ptr<basic_integer16<T>>& hex,
+
7324 _In_ const std::locale& locale = std::locale()) :
+
7325 basic_parser<T>(locale),
+
7326 m_quote(quote),
+
7327 m_chr(chr),
+
7328 m_escape(escape),
+
7329 m_sol(sol),
+
7330 m_bs(bs),
+
7331 m_ff(ff),
+
7332 m_lf(lf),
+
7333 m_cr(cr),
+
7334 m_htab(htab),
+
7335 m_uni(uni),
+
7336 m_hex(hex)
+
7337 {}
+
7338
+
7339 virtual bool match(
+
7340 _In_reads_or_z_(end) const T* text,
+
7341 _In_ size_t start = 0,
+
7342 _In_ size_t end = (size_t)-1,
+
7343 _In_ int flags = match_default)
+
7344 {
+
7345 assert(text || start >= end);
+
7346 this->interval.end = start;
+
7347 if (m_quote->match(text, this->interval.end, end, flags)) {
+
7348 this->interval.end = m_quote->interval.end;
+
7349 value.clear();
+
7350 for (;;) {
+
7351 if (m_quote->match(text, this->interval.end, end, flags)) {
+
7352 this->interval.start = start;
+
7353 this->interval.end = m_quote->interval.end;
+
7354 return true;
+
7355 }
+
7356 if (m_escape->match(text, this->interval.end, end, flags)) {
+
7357 if (m_quote->match(text, m_escape->interval.end, end, flags)) {
+
7358 value += '"'; this->interval.end = m_quote->interval.end;
+
7359 continue;
+
7360 }
+
7361 if (m_sol->match(text, m_escape->interval.end, end, flags)) {
+
7362 value += '/'; this->interval.end = m_sol->interval.end;
+
7363 continue;
+
7364 }
+
7365 if (m_bs->match(text, m_escape->interval.end, end, flags)) {
+
7366 value += '\b'; this->interval.end = m_bs->interval.end;
+
7367 continue;
+
7368 }
+
7369 if (m_ff->match(text, m_escape->interval.end, end, flags)) {
+
7370 value += '\f'; this->interval.end = m_ff->interval.end;
+
7371 continue;
+
7372 }
+
7373 if (m_lf->match(text, m_escape->interval.end, end, flags)) {
+
7374 value += '\n'; this->interval.end = m_lf->interval.end;
+
7375 continue;
+
7376 }
+
7377 if (m_cr->match(text, m_escape->interval.end, end, flags)) {
+
7378 value += '\r'; this->interval.end = m_cr->interval.end;
+
7379 continue;
+
7380 }
+
7381 if (m_htab->match(text, m_escape->interval.end, end, flags)) {
+
7382 value += '\t'; this->interval.end = m_htab->interval.end;
+
7383 continue;
+
7384 }
+
7385 if (
+
7386 m_uni->match(text, m_escape->interval.end, end, flags) &&
+
7387 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end), flags | match_case_insensitive) &&
+
7388 m_hex->interval.size() == 4 /* JSON requests 4-digit Unicode sequneces: \u.... */)
+
7389 {
+
7390 assert(m_hex->value <= 0xffff);
+
7391 if (sizeof(T) == 1) {
+
7392 if (m_hex->value > 0x7ff) {
+
7393 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
+
7394 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
+
7395 value += (T)(0x80 | (m_hex->value & 0x3f));
+
7396 }
+
7397 else if (m_hex->value > 0x7f) {
+
7398 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
+
7399 value += (T)(0x80 | (m_hex->value & 0x3f));
+
7400 }
+
7401 else
+
7402 value += (T)(m_hex->value & 0x7f);
+
7403 }
+
7404 else
+
7405 value += (T)m_hex->value;
+
7406 this->interval.end = m_hex->interval.end;
+
7407 continue;
+
7408 }
+
7409 if (m_escape->match(text, m_escape->interval.end, end, flags)) {
+
7410 value += '\\'; this->interval.end = m_escape->interval.end;
+
7411 continue;
+
7412 }
+
7413 }
+
7414 if (m_chr->match(text, this->interval.end, end, flags)) {
+
7415 value.Prilepi(text + m_chr->interval.start, m_chr->interval.size());
+
7416 this->interval.end = m_chr->interval.end;
+
7417 continue;
+
7418 }
+
7419 break;
+
7420 }
+
7421 }
+
7422 value.clear();
+
7423 this->interval.start = (this->interval.end = start) + 1;
+
7424 return false;
+
7425 }
+
7426
+
7427 virtual void invalidate()
+
7428 {
+
7429 value.clear();
+ +
7431 }
+
7432
+
7433 public:
+
7434 std::basic_string<T> value;
+
7435
+
7436 protected:
+
7437 std::shared_ptr<basic_parser<T>> m_quote;
+
7438 std::shared_ptr<basic_parser<T>> m_chr;
+
7439 std::shared_ptr<basic_parser<T>> m_escape;
+
7440 std::shared_ptr<basic_parser<T>> m_sol;
+
7441 std::shared_ptr<basic_parser<T>> m_bs;
+
7442 std::shared_ptr<basic_parser<T>> m_ff;
+
7443 std::shared_ptr<basic_parser<T>> m_lf;
+
7444 std::shared_ptr<basic_parser<T>> m_cr;
+
7445 std::shared_ptr<basic_parser<T>> m_htab;
+
7446 std::shared_ptr<basic_parser<T>> m_uni;
+
7447 std::shared_ptr<basic_integer16<T>> m_hex;
+
7448 };
-
7450
- - -
7453#ifdef _UNICODE
-
7454 using tjson_string = wjson_string;
-
7455#else
-
7456 using tjson_string = json_string;
-
7457#endif
-
7458 }
-
7459}
-
7460
-
7461#undef ENUM_FLAG_OPERATOR
-
7462#undef ENUM_FLAGS
-
7463
-
7464#ifdef _MSC_VER
-
7465#pragma warning(pop)
-
7466#endif
+
7449
+ + +
7452#ifdef _UNICODE
+
7453 using tjson_string = wjson_string;
+
7454#else
+
7455 using tjson_string = json_string;
+
7456#endif
+
7457 }
+
7458}
+
7459
+
7460#undef ENUM_FLAG_OPERATOR
+
7461#undef ENUM_FLAGS
+
7462
+
7463#ifdef _MSC_VER
+
7464#pragma warning(pop)
+
7465#endif
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4396
Test for any code unit.
Definition parser.hpp:222
Test for beginning of line.
Definition parser.hpp:616
Test for any.
Definition parser.hpp:1058
-
Test for chemical formula.
Definition parser.hpp:5549
-
Test for Creditor Reference.
Definition parser.hpp:4975
-
T reference[22]
Normalized national reference number.
Definition parser.hpp:5104
-
T check_digits[3]
Two check digits.
Definition parser.hpp:5103
-
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:5105
+
Test for chemical formula.
Definition parser.hpp:5548
+
Test for Creditor Reference.
Definition parser.hpp:4974
+
T reference[22]
Normalized national reference number.
Definition parser.hpp:5103
+
T check_digits[3]
Two check digits.
Definition parser.hpp:5102
+
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:5104
Test for any code unit from a given string of code units.
Definition parser.hpp:721
Test for specific code unit.
Definition parser.hpp:292
Test for date.
Definition parser.hpp:4026
@@ -7465,10 +7464,10 @@ $(document).ready(function() { init_codefold(0); });
Test for end of line.
Definition parser.hpp:654
Test for fraction.
Definition parser.hpp:1687
Test for International Bank Account Number.
Definition parser.hpp:4672
-
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4952
-
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4950
-
T check_digits[3]
Two check digits.
Definition parser.hpp:4951
-
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4953
+
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4951
+
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4949
+
T check_digits[3]
Two check digits.
Definition parser.hpp:4950
+
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4952
Test for decimal integer.
Definition parser.hpp:1296
Test for decimal integer possibly containing thousand separators.
Definition parser.hpp:1381
bool has_separators
Did integer have any separators?
Definition parser.hpp:1441
@@ -7489,7 +7488,7 @@ $(document).ready(function() { init_codefold(0); });
std::shared_ptr< basic_parser< T > > m_el
repeating element
Definition parser.hpp:947
size_t m_min_iterations
minimum number of iterations
Definition parser.hpp:948
size_t m_max_iterations
maximum number of iterations
Definition parser.hpp:949
-
Test for JSON string.
Definition parser.hpp:7311
+
Test for JSON string.
Definition parser.hpp:7310
Test for mixed numeral.
Definition parser.hpp:1923
std::shared_ptr< basic_parser< T > > fraction
fraction
Definition parser.hpp:2029
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2027
@@ -7527,14 +7526,14 @@ $(document).ready(function() { init_codefold(0); });
Test for match score.
Definition parser.hpp:1750
Test for sequence.
Definition parser.hpp:1007
Definition parser.hpp:689
-
Test for SI Reference delimiter.
Definition parser.hpp:5172
-
Test for SI Reference part.
Definition parser.hpp:5127
-
Test for SI Reference.
Definition parser.hpp:5210
-
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5527
-
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5525
-
bool is_valid
Is reference valid.
Definition parser.hpp:5528
-
T model[3]
Reference model.
Definition parser.hpp:5524
-
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5526
+
Test for SI Reference delimiter.
Definition parser.hpp:5171
+
Test for SI Reference part.
Definition parser.hpp:5126
+
Test for SI Reference.
Definition parser.hpp:5209
+
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5526
+
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5524
+
bool is_valid
Is reference valid.
Definition parser.hpp:5527
+
T model[3]
Reference model.
Definition parser.hpp:5523
+
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5525
Test for signed numeral.
Definition parser.hpp:1837
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1905
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1904
@@ -7550,44 +7549,44 @@ $(document).ready(function() { init_codefold(0); });
Test for URL path.
Definition parser.hpp:3297
Test for valid URL username character.
Definition parser.hpp:2990
Test for URL.
Definition parser.hpp:3438
-
Test for HTTP agent.
Definition parser.hpp:6834
-
Test for HTTP any type.
Definition parser.hpp:5956
-
Test for HTTP asterisk.
Definition parser.hpp:6598
- - - - - -
Test for HTTP header.
Definition parser.hpp:7157
-
Test for HTTP language (RFC1766)
Definition parser.hpp:6466
-
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5630
-
Test for HTTP media range (RFC2616: media-range)
Definition parser.hpp:5988
-
Test for HTTP media type (RFC2616: media-type)
Definition parser.hpp:6043
-
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5901
-
http_token name
Parameter name.
Definition parser.hpp:5945
-
http_value value
Parameter value.
Definition parser.hpp:5946
-
Test for HTTP protocol.
Definition parser.hpp:6910
-
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:7012
-
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5791
-
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5847
-
Test for HTTP request.
Definition parser.hpp:7019
-
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5666
-
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5703
-
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5737
-
Test for HTTP URL parameter.
Definition parser.hpp:6283
-
Test for HTTP URL path segment.
Definition parser.hpp:6194
-
Test for HTTP URL path segment.
Definition parser.hpp:6227
-
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6276
-
Test for HTTP URL port.
Definition parser.hpp:6138
-
Test for HTTP URL server.
Definition parser.hpp:6101
-
Test for HTTP URL.
Definition parser.hpp:6364
-
Collection of HTTP values.
Definition parser.hpp:7267
-
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5857
-
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5893
-
http_token token
Value when matched as token.
Definition parser.hpp:5894
-
Test for HTTP weight factor.
Definition parser.hpp:6529
-
float value
Calculated value of the weight factor.
Definition parser.hpp:6591
-
Test for HTTP weighted value.
Definition parser.hpp:6621
+
Test for HTTP agent.
Definition parser.hpp:6833
+
Test for HTTP any type.
Definition parser.hpp:5955
+
Test for HTTP asterisk.
Definition parser.hpp:6597
+ + + + + +
Test for HTTP header.
Definition parser.hpp:7156
+
Test for HTTP language (RFC1766)
Definition parser.hpp:6465
+
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5629
+
Test for HTTP media range (RFC2616: media-range)
Definition parser.hpp:5987
+
Test for HTTP media type (RFC2616: media-type)
Definition parser.hpp:6042
+
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5900
+
http_token name
Parameter name.
Definition parser.hpp:5944
+
http_value value
Parameter value.
Definition parser.hpp:5945
+
Test for HTTP protocol.
Definition parser.hpp:6909
+
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:7011
+
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5790
+
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5846
+
Test for HTTP request.
Definition parser.hpp:7018
+
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5665
+
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5702
+
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5736
+
Test for HTTP URL parameter.
Definition parser.hpp:6282
+
Test for HTTP URL path segment.
Definition parser.hpp:6193
+
Test for HTTP URL path segment.
Definition parser.hpp:6226
+
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6275
+
Test for HTTP URL port.
Definition parser.hpp:6137
+
Test for HTTP URL server.
Definition parser.hpp:6100
+
Test for HTTP URL.
Definition parser.hpp:6363
+
Collection of HTTP values.
Definition parser.hpp:7266
+
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5856
+
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5892
+
http_token token
Value when matched as token.
Definition parser.hpp:5893
+
Test for HTTP weight factor.
Definition parser.hpp:6528
+
float value
Calculated value of the weight factor.
Definition parser.hpp:6590
+
Test for HTTP weighted value.
Definition parser.hpp:6620
Base template for collection-holding parsers.
Definition parser.hpp:967
Test for any SGML code point.
Definition parser.hpp:254
Test for any SGML code point from a given string of SGML code points.
Definition parser.hpp:773
@@ -7606,11 +7605,11 @@ $(document).ready(function() { init_codefold(0); });
T end
interval end
Definition interval.hpp:20
interval() noexcept
Constructs an invalid interval.
Definition interval.hpp:25
T start
interval start
Definition interval.hpp:19
-
Definition parser.hpp:7293
+
Definition parser.hpp:7292
diff --git a/pch_8h_source.html b/pch_8h_source.html index 4cc16d0b0..dcacf9c02 100644 --- a/pch_8h_source.html +++ b/pch_8h_source.html @@ -116,7 +116,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/progress_8hpp_source.html b/progress_8hpp_source.html index 6d2aac01e..6464fbc29 100644 --- a/progress_8hpp_source.html +++ b/progress_8hpp_source.html @@ -331,7 +331,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/ring_8cpp_source.html b/ring_8cpp_source.html index e0dc7d9e3..02f464d7a 100644 --- a/ring_8cpp_source.html +++ b/ring_8cpp_source.html @@ -144,7 +144,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/ring_8hpp_source.html b/ring_8hpp_source.html index 43abebe4b..3b0efa2d2 100644 --- a/ring_8hpp_source.html +++ b/ring_8hpp_source.html @@ -224,7 +224,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/sgml_8cpp_source.html b/sgml_8cpp_source.html index 1371a98c8..f23b7c455 100644 --- a/sgml_8cpp_source.html +++ b/sgml_8cpp_source.html @@ -153,7 +153,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/sgml_8hpp_source.html b/sgml_8hpp_source.html index 4cea1db25..faf8caeef 100644 --- a/sgml_8hpp_source.html +++ b/sgml_8hpp_source.html @@ -773,7 +773,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/sgml__unicode_8hpp_source.html b/sgml__unicode_8hpp_source.html index 6888a1b88..703001d73 100644 --- a/sgml__unicode_8hpp_source.html +++ b/sgml__unicode_8hpp_source.html @@ -3175,7 +3175,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/stream_8cpp_source.html b/stream_8cpp_source.html index 0df6d1287..05b6a0df4 100644 --- a/stream_8cpp_source.html +++ b/stream_8cpp_source.html @@ -236,19 +236,19 @@ $(document).ready(function() { init_codefold(0); });
152 }
153 };
154}
-
Provides read-ahead stream capability.
Definition stream.hpp:1118
-
Provides write-back stream capability.
Definition stream.hpp:1186
-
bool ok() const
Returns true if the stream state is clean i.e. previous operation was succesful.
Definition stream.hpp:170
-
Buffered read/write stream.
Definition stream.hpp:1257
-
Cached file-system file.
Definition stream.hpp:2751
-
File-system file.
Definition stream.hpp:2434
-
In-memory file.
Definition stream.hpp:2813
-
Replicates writing of the same data to multiple streams.
Definition stream.hpp:949
-
void push_back(basic *source)
Adds stream on the list.
Definition stream.hpp:968
+
Provides read-ahead stream capability.
Definition stream.hpp:1120
+
Provides write-back stream capability.
Definition stream.hpp:1188
+
bool ok() const
Returns true if the stream state is clean i.e. previous operation was succesful.
Definition stream.hpp:172
+
Buffered read/write stream.
Definition stream.hpp:1259
+
Cached file-system file.
Definition stream.hpp:2753
+
File-system file.
Definition stream.hpp:2436
+
In-memory file.
Definition stream.hpp:2815
+
Replicates writing of the same data to multiple streams.
Definition stream.hpp:951
+
void push_back(basic *source)
Adds stream on the list.
Definition stream.hpp:970
diff --git a/stream_8hpp_source.html b/stream_8hpp_source.html index 2b989a0eb..26b6a505d 100644 --- a/stream_8hpp_source.html +++ b/stream_8hpp_source.html @@ -153,3703 +153,3705 @@ $(document).ready(function() { init_codefold(0); });
77 public:
78 basic(_In_ state_t state = state_t::ok) : m_state(state) {}
79
-
-
91 virtual _Success_(return != 0 || length == 0) size_t read(
-
92 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
93 {
-
94 _Unreferenced_(data);
-
95 _Unreferenced_(length);
-
96 m_state = state_t::fail;
-
97 return 0;
-
98 }
+
80 virtual ~basic() noexcept(false) {}
+
81
+
+
93 virtual _Success_(return != 0 || length == 0) size_t read(
+
94 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
95 {
+
96 _Unreferenced_(data);
+
97 _Unreferenced_(length);
+
98 m_state = state_t::fail;
+
99 return 0;
+
100 }
-
99
-
-
109 virtual _Success_(return != 0) size_t write(
-
110 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
111 {
-
112 _Unreferenced_(data);
-
113 _Unreferenced_(length);
-
114 m_state = state_t::fail;
-
115 return 0;
-
116 }
+
101
+
+
111 virtual _Success_(return != 0) size_t write(
+
112 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
113 {
+
114 _Unreferenced_(data);
+
115 _Unreferenced_(length);
+
116 m_state = state_t::fail;
+
117 return 0;
+
118 }
-
117
-
-
121 virtual void flush()
-
122 {
-
123 m_state = state_t::ok;
-
124 }
+
119
+
+
123 virtual void flush()
+
124 {
+
125 m_state = state_t::ok;
+
126 }
-
125
-
-
129 virtual void close()
-
130 {
-
131 m_state = state_t::ok;
-
132 }
+
127
+
+
131 virtual void close()
+
132 {
+
133 m_state = state_t::ok;
+
134 }
-
133
-
-
137 virtual void skip(_In_ fsize_t amount)
-
138 {
-
139 if (amount == 1)
-
140 read_byte();
-
141 else if (amount < iterate_count) {
-
142 for (size_t i = 0; i < static_cast<size_t>(amount); i++) {
-
143 read_byte();
-
144 if (!ok()) _Unlikely_
-
145 break;
-
146 }
-
147 }
-
148 else {
-
149 size_t block = static_cast<size_t>(std::min<fsize_t>(amount, default_block_size));
-
150 try {
-
151 std::unique_ptr<uint8_t[]> dummy(new uint8_t[block]);
-
152 while (amount) {
-
153 amount -= read_array(dummy.get(), sizeof(uint8_t), static_cast<size_t>(std::min<fsize_t>(amount, block)));
-
154 if (!ok()) _Unlikely_
-
155 break;
-
156 }
-
157 }
-
158 catch (const std::bad_alloc&) { m_state = state_t::fail; }
-
159 }
-
160 }
+
135
+
+
139 virtual void skip(_In_ fsize_t amount)
+
140 {
+
141 if (amount == 1)
+
142 read_byte();
+
143 else if (amount < iterate_count) {
+
144 for (size_t i = 0; i < static_cast<size_t>(amount); i++) {
+
145 read_byte();
+
146 if (!ok()) _Unlikely_
+
147 break;
+
148 }
+
149 }
+
150 else {
+
151 size_t block = static_cast<size_t>(std::min<fsize_t>(amount, default_block_size));
+
152 try {
+
153 std::unique_ptr<uint8_t[]> dummy(new uint8_t[block]);
+
154 while (amount) {
+
155 amount -= read_array(dummy.get(), sizeof(uint8_t), static_cast<size_t>(std::min<fsize_t>(amount, block)));
+
156 if (!ok()) _Unlikely_
+
157 break;
+
158 }
+
159 }
+
160 catch (const std::bad_alloc&) { m_state = state_t::fail; }
+
161 }
+
162 }
-
161
-
165 inline state_t state() const { return m_state; };
-
166
-
170 inline bool ok() const { return m_state == state_t::ok; };
-
171
-
-
179 virtual std::vector<uint8_t> read_remainder(_In_ size_t max_length = SIZE_MAX)
-
180 {
-
181 std::vector<uint8_t> result;
-
182 size_t offset, length;
-
183 offset = 0;
-
184 length = default_block_size;
-
185 while (offset < max_length) {
-
186 length = std::min(length, max_length);
-
187 try { result.resize(length); }
-
188 catch (const std::bad_alloc&) {
-
189 m_state = state_t::fail;
-
190 return result;
-
191 }
-
192 auto num_read = read_array(result.data() + offset, sizeof(uint8_t), length - offset);
-
193 offset += num_read;
-
194 if (!ok()) _Unlikely_
-
195 break;
-
196 length += default_block_size;
-
197 }
-
198 result.resize(offset);
-
199 return result;
-
200 }
+
163
+
167 inline state_t state() const { return m_state; };
+
168
+
172 inline bool ok() const { return m_state == state_t::ok; };
+
173
+
+
181 virtual std::vector<uint8_t> read_remainder(_In_ size_t max_length = SIZE_MAX)
+
182 {
+
183 std::vector<uint8_t> result;
+
184 size_t offset, length;
+
185 offset = 0;
+
186 length = default_block_size;
+
187 while (offset < max_length) {
+
188 length = std::min(length, max_length);
+
189 try { result.resize(length); }
+
190 catch (const std::bad_alloc&) {
+
191 m_state = state_t::fail;
+
192 return result;
+
193 }
+
194 auto num_read = read_array(result.data() + offset, sizeof(uint8_t), length - offset);
+
195 offset += num_read;
+
196 if (!ok()) _Unlikely_
+
197 break;
+
198 length += default_block_size;
+
199 }
+
200 result.resize(offset);
+
201 return result;
+
202 }
-
201
-
-
205 inline uint8_t read_byte()
-
206 {
-
207 uint8_t byte;
-
208 if (read_array(&byte, sizeof(byte), 1) == 1)
-
209 return byte;
-
210 throw std::runtime_error("failed to read");
-
211 }
+
203
+
+
207 inline uint8_t read_byte()
+
208 {
+
209 uint8_t byte;
+
210 if (read_array(&byte, sizeof(byte), 1) == 1)
+
211 return byte;
+
212 throw std::runtime_error("failed to read");
+
213 }
-
212
-
-
216 void write_byte(_In_ uint8_t byte, _In_ fsize_t amount = 1)
-
217 {
-
218 if (amount == 1)
-
219 write(&byte, sizeof(uint8_t));
-
220 else if (amount < iterate_count) {
-
221 for (size_t i = 0; i < static_cast<size_t>(amount); i++) {
-
222 write(&byte, sizeof(uint8_t));
-
223 if (!ok()) _Unlikely_
-
224 break;
-
225 }
-
226 }
-
227 else {
-
228 size_t block = static_cast<size_t>(std::min<fsize_t>(amount, default_block_size));
-
229 try {
-
230 std::unique_ptr<uint8_t[]> dummy(new uint8_t[block]);
-
231 memset(dummy.get(), byte, block);
-
232 while (amount) {
-
233 amount -= write_array(dummy.get(), sizeof(uint8_t), static_cast<size_t>(std::min<fsize_t>(amount, block)));
-
234 if (!ok()) _Unlikely_
-
235 break;
-
236 }
-
237 }
-
238 catch (const std::bad_alloc&) { m_state = state_t::fail; }
-
239 }
-
240 }
+
214
+
+
218 void write_byte(_In_ uint8_t byte, _In_ fsize_t amount = 1)
+
219 {
+
220 if (amount == 1)
+
221 write(&byte, sizeof(uint8_t));
+
222 else if (amount < iterate_count) {
+
223 for (size_t i = 0; i < static_cast<size_t>(amount); i++) {
+
224 write(&byte, sizeof(uint8_t));
+
225 if (!ok()) _Unlikely_
+
226 break;
+
227 }
+
228 }
+
229 else {
+
230 size_t block = static_cast<size_t>(std::min<fsize_t>(amount, default_block_size));
+
231 try {
+
232 std::unique_ptr<uint8_t[]> dummy(new uint8_t[block]);
+
233 memset(dummy.get(), byte, block);
+
234 while (amount) {
+
235 amount -= write_array(dummy.get(), sizeof(uint8_t), static_cast<size_t>(std::min<fsize_t>(amount, block)));
+
236 if (!ok()) _Unlikely_
+
237 break;
+
238 }
+
239 }
+
240 catch (const std::bad_alloc&) { m_state = state_t::fail; }
+
241 }
+
242 }
-
241
-
253 template <class T>
-
-
254 inline basic& read_data(_Out_ T& data)
-
255 {
-
256 if (!ok()) _Unlikely_ {
-
257 data = 0;
-
258 return *this;
-
259 }
-
260 if (read_array(&data, sizeof(T), 1) == 1)
-
261 (void)LE2HE(&data);
-
262 else {
-
263 data = 0;
-
264 if (ok())
-
265 m_state = state_t::eof;
-
266 }
-
267 return *this;
-
268 }
+
243
+
255 template <class T>
+
+
256 inline basic& read_data(_Out_ T& data)
+
257 {
+
258 if (!ok()) _Unlikely_ {
+
259 data = 0;
+
260 return *this;
+
261 }
+
262 if (read_array(&data, sizeof(T), 1) == 1)
+
263 (void)LE2HE(&data);
+
264 else {
+
265 data = 0;
+
266 if (ok())
+
267 m_state = state_t::eof;
+
268 }
+
269 return *this;
+
270 }
-
269
-
281 template <class T>
-
-
282 inline basic& write_data(_In_ const T data)
-
283 {
-
284 if (!ok()) _Unlikely_
-
285 return *this;
-
286#if BYTE_ORDER == BIG_ENDIAN
-
287 T data_le = HE2LE(data);
-
288 write(&data_le, sizeof(T));
-
289#else
-
290 write(&data, sizeof(T));
-
291#endif
-
292 return *this;
-
293 }
+
271
+
283 template <class T>
+
+
284 inline basic& write_data(_In_ const T data)
+
285 {
+
286 if (!ok()) _Unlikely_
+
287 return *this;
+
288#if BYTE_ORDER == BIG_ENDIAN
+
289 T data_le = HE2LE(data);
+
290 write(&data_le, sizeof(T));
+
291#else
+
292 write(&data, sizeof(T));
+
293#endif
+
294 return *this;
+
295 }
-
294
-
300 template<class _Traits = std::char_traits<char>, class _Ax = std::allocator<char>>
-
-
301 inline size_t readln(_Inout_ std::basic_string<char, _Traits, _Ax>& str)
-
302 {
-
303 str.clear();
-
304 return readln_and_attach(str);
-
305 }
+
296
+
302 template<class _Traits = std::char_traits<char>, class _Ax = std::allocator<char>>
+
+
303 inline size_t readln(_Inout_ std::basic_string<char, _Traits, _Ax>& str)
+
304 {
+
305 str.clear();
+
306 return readln_and_attach(str);
+
307 }
-
306
-
312 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
-
-
313 inline size_t readln(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr)
-
314 {
-
315 wstr.clear();
-
316 return readln_and_attach(wstr);
-
317 }
+
308
+
314 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
+
+
315 inline size_t readln(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr)
+
316 {
+
317 wstr.clear();
+
318 return readln_and_attach(wstr);
+
319 }
-
318
-
324 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
-
-
325 size_t readln(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr, _In_ charset_id charset)
-
326 {
-
327 if (charset == charset_id::utf16)
-
328 return readln(wstr);
-
329 std::string str;
- -
331 wstr.clear();
-
332 str2wstr(wstr, str, charset);
-
333 return wstr.size();
-
334 }
+
320
+
326 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
+
+
327 size_t readln(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr, _In_ charset_id charset)
+
328 {
+
329 if (charset == charset_id::utf16)
+
330 return readln(wstr);
+
331 std::string str;
+ +
333 wstr.clear();
+
334 str2wstr(wstr, str, charset);
+
335 return wstr.size();
+
336 }
-
335
-
341 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
-
342 size_t readln_and_attach(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& str)
-
343 {
-
344 bool initial = true;
-
345 _Elem chr, previous = (_Elem)0;
-
346 do {
-
347 read_array(&chr, sizeof(_Elem), 1);
-
348 if (!initial && !(previous == static_cast<_Elem>('\r') && chr == static_cast<_Elem>('\n')))
-
349 str += previous;
-
350 else
-
351 initial = false;
-
352 previous = chr;
-
353 } while (ok() && chr != static_cast<_Elem>('\n'));
-
354 return str.size();
-
355 }
+
337
+
343 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
+
344 size_t readln_and_attach(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& str)
+
345 {
+
346 bool initial = true;
+
347 _Elem chr, previous = (_Elem)0;
+
348 do {
+
349 read_array(&chr, sizeof(_Elem), 1);
+
350 if (!initial && !(previous == static_cast<_Elem>('\r') && chr == static_cast<_Elem>('\n')))
+
351 str += previous;
+
352 else
+
353 initial = false;
+
354 previous = chr;
+
355 } while (ok() && chr != static_cast<_Elem>('\n'));
+
356 return str.size();
+
357 }
-
356
-
362 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
-
-
363 size_t readln_and_attach(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr, _In_ charset_id charset)
-
364 {
-
365 if (charset == charset_id::utf16)
-
366 return readln_and_attach(wstr);
-
367 std::string str;
- -
369 str2wstr(wstr, str, charset);
-
370 return wstr.size();
-
371 }
+
358
+
364 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
+
+
365 size_t readln_and_attach(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr, _In_ charset_id charset)
+
366 {
+
367 if (charset == charset_id::utf16)
+
368 return readln_and_attach(wstr);
+
369 std::string str;
+ +
371 str2wstr(wstr, str, charset);
+
372 return wstr.size();
+
373 }
-
372
-
-
378 size_t read_array(_Out_writes_bytes_(size* count) void* array, _In_ size_t size, _In_ size_t count)
-
379 {
-
380 for (size_t to_read = mul(size, count);;) {
-
381 size_t num_read = read(array, to_read);
-
382 to_read -= num_read;
-
383 if (!to_read)
-
384 return count;
-
385 if (!ok()) _Unlikely_
-
386 return count - to_read / size;
-
387 reinterpret_cast<uint8_t*&>(array) += num_read;
-
388 }
-
389 }
+
374
+
+
380 size_t read_array(_Out_writes_bytes_(size* count) void* array, _In_ size_t size, _In_ size_t count)
+
381 {
+
382 for (size_t to_read = mul(size, count);;) {
+
383 size_t num_read = read(array, to_read);
+
384 to_read -= num_read;
+
385 if (!to_read)
+
386 return count;
+
387 if (!ok()) _Unlikely_
+
388 return count - to_read / size;
+
389 reinterpret_cast<uint8_t*&>(array) += num_read;
+
390 }
+
391 }
-
390
-
-
396 inline size_t write_array(_In_reads_bytes_opt_(size* count) const void* array, _In_ size_t size, _In_ size_t count)
-
397 {
-
398 return write(array, mul(size, count)) / size;
-
399 }
+
392
+
+
398 inline size_t write_array(_In_reads_bytes_opt_(size* count) const void* array, _In_ size_t size, _In_ size_t count)
+
399 {
+
400 return write(array, mul(size, count)) / size;
+
401 }
-
400
-
-
409 size_t write_array(_In_z_ const wchar_t* wstr, _In_ charset_id charset)
-
410 {
-
411 if (!ok()) _Unlikely_
-
412 return 0;
-
413 size_t num_chars = stdex::strlen(wstr);
-
414 if (charset != charset_id::utf16) {
-
415 std::string str(wstr2str(wstr, num_chars, charset));
-
416 return write_array(str.data(), sizeof(char), str.size());
-
417 }
-
418 return write_array(wstr, sizeof(wchar_t), num_chars);
-
419 }
+
402
+
+
411 size_t write_array(_In_z_ const wchar_t* wstr, _In_ charset_id charset)
+
412 {
+
413 if (!ok()) _Unlikely_
+
414 return 0;
+
415 size_t num_chars = stdex::strlen(wstr);
+
416 if (charset != charset_id::utf16) {
+
417 std::string str(wstr2str(wstr, num_chars, charset));
+
418 return write_array(str.data(), sizeof(char), str.size());
+
419 }
+
420 return write_array(wstr, sizeof(wchar_t), num_chars);
+
421 }
-
420
-
-
430 size_t write_array(_In_reads_or_z_opt_(num_chars) const wchar_t* wstr, _In_ size_t num_chars, _In_ charset_id charset)
-
431 {
-
432 if (!ok()) _Unlikely_
-
433 return 0;
-
434 num_chars = stdex::strnlen(wstr, num_chars);
-
435 if (charset != charset_id::utf16) {
-
436 std::string str(wstr2str(wstr, num_chars, charset));
-
437 return write_array(str.data(), sizeof(char), str.size());
-
438 }
-
439 return write_array(wstr, sizeof(wchar_t), num_chars);
-
440 }
+
422
+
+
432 size_t write_array(_In_reads_or_z_opt_(num_chars) const wchar_t* wstr, _In_ size_t num_chars, _In_ charset_id charset)
+
433 {
+
434 if (!ok()) _Unlikely_
+
435 return 0;
+
436 num_chars = stdex::strnlen(wstr, num_chars);
+
437 if (charset != charset_id::utf16) {
+
438 std::string str(wstr2str(wstr, num_chars, charset));
+
439 return write_array(str.data(), sizeof(char), str.size());
+
440 }
+
441 return write_array(wstr, sizeof(wchar_t), num_chars);
+
442 }
-
441
-
450 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
-
-
451 size_t write_array(_In_ const std::basic_string<wchar_t, _Traits, _Ax>& wstr, _In_ charset_id charset)
-
452 {
-
453 if (!ok()) _Unlikely_
-
454 return 0;
-
455 if (charset != charset_id::utf16) {
-
456 std::string str(wstr2str(wstr, charset));
-
457 return write_array(str.data(), sizeof(char), str.size());
-
458 }
-
459 return write_array(wstr.data(), sizeof(wchar_t), wstr.size());
-
460 }
+
443
+
452 template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
+
+
453 size_t write_array(_In_ const std::basic_string<wchar_t, _Traits, _Ax>& wstr, _In_ charset_id charset)
+
454 {
+
455 if (!ok()) _Unlikely_
+
456 return 0;
+
457 if (charset != charset_id::utf16) {
+
458 std::string str(wstr2str(wstr, charset));
+
459 return write_array(str.data(), sizeof(char), str.size());
+
460 }
+
461 return write_array(wstr.data(), sizeof(wchar_t), wstr.size());
+
462 }
-
461
-
473 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
-
474 inline basic& read_str(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& data)
-
475 {
-
476 uint32_t num_chars;
-
477 read_data(num_chars);
-
478 if (!ok()) _Unlikely_ {
-
479 data.clear();
-
480 return *this;
-
481 }
-
482 data.resize(num_chars);
-
483 data.resize(read_array(data.data(), sizeof(_Elem), num_chars));
-
484 return *this;
-
485 }
+
463
+
475 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
+
476 inline basic& read_str(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& data)
+
477 {
+
478 uint32_t num_chars;
+
479 read_data(num_chars);
+
480 if (!ok()) _Unlikely_ {
+
481 data.clear();
+
482 return *this;
+
483 }
+
484 data.resize(num_chars);
+
485 data.resize(read_array(data.data(), sizeof(_Elem), num_chars));
+
486 return *this;
+
487 }
-
486
-
498 template <class T>
-
-
499 inline basic& write_str(_In_z_ const T* data)
-
500 {
-
501 // Stream state will be checked in write_data.
-
502 size_t num_chars = stdex::strlen(data);
-
503 if (num_chars > UINT32_MAX)
-
504 throw std::invalid_argument("string too long");
-
505 write_data((uint32_t)num_chars);
-
506 if (!ok()) _Unlikely_
-
507 return *this;
-
508 write_array(data, sizeof(T), num_chars);
-
509 return *this;
-
510 }
+
488
+
500 template <class T>
+
+
501 inline basic& write_str(_In_z_ const T* data)
+
502 {
+
503 // Stream state will be checked in write_data.
+
504 size_t num_chars = stdex::strlen(data);
+
505 if (num_chars > UINT32_MAX)
+
506 throw std::invalid_argument("string too long");
+
507 write_data((uint32_t)num_chars);
+
508 if (!ok()) _Unlikely_
+
509 return *this;
+
510 write_array(data, sizeof(T), num_chars);
+
511 return *this;
+
512 }
-
511
-
512#ifdef _WIN32
-
518 size_t write_sa(_In_ LPSAFEARRAY sa)
-
519 {
-
520 safearray_accessor<void> a(sa);
-
521 long ubound, lbound;
-
522 if (FAILED(SafeArrayGetUBound(sa, 1, &ubound)) ||
-
523 FAILED(SafeArrayGetLBound(sa, 1, &lbound)))
-
524 throw std::invalid_argument("SafeArrayGet[UL]Bound failed");
-
525 return write(a.data(), static_cast<size_t>(ubound) - lbound + 1);
-
526 }
-
527#endif
-
528
-
-
534 fsize_t write_stream(_Inout_ basic& stream, _In_ fsize_t amount = fsize_max)
-
535 {
-
536 std::unique_ptr<uint8_t[]> data(new uint8_t[static_cast<size_t>(std::min<fsize_t>(amount, default_block_size))]);
-
537 fsize_t num_copied = 0, to_write = amount;
-
538 m_state = state_t::ok;
-
539 while (to_write) {
-
540 size_t num_read = stream.read(data.get(), static_cast<size_t>(std::min<fsize_t>(default_block_size, to_write)));
-
541 size_t num_written = write(data.get(), num_read);
-
542 num_copied += num_written;
-
543 to_write -= num_written;
-
544 if (stream.m_state == state_t::eof) {
-
545 // EOF is not an error.
-
546 m_state = state_t::ok;
-
547 break;
-
548 }
-
549 m_state = stream.m_state;
-
550 if (!ok())
-
551 break;
-
552 }
-
553 return num_copied;
-
554 }
+
513
+
514#ifdef _WIN32
+
520 size_t write_sa(_In_ LPSAFEARRAY sa)
+
521 {
+
522 safearray_accessor<void> a(sa);
+
523 long ubound, lbound;
+
524 if (FAILED(SafeArrayGetUBound(sa, 1, &ubound)) ||
+
525 FAILED(SafeArrayGetLBound(sa, 1, &lbound)))
+
526 throw std::invalid_argument("SafeArrayGet[UL]Bound failed");
+
527 return write(a.data(), static_cast<size_t>(ubound) - lbound + 1);
+
528 }
+
529#endif
+
530
+
+
536 fsize_t write_stream(_Inout_ basic& stream, _In_ fsize_t amount = fsize_max)
+
537 {
+
538 std::unique_ptr<uint8_t[]> data(new uint8_t[static_cast<size_t>(std::min<fsize_t>(amount, default_block_size))]);
+
539 fsize_t num_copied = 0, to_write = amount;
+
540 m_state = state_t::ok;
+
541 while (to_write) {
+
542 size_t num_read = stream.read(data.get(), static_cast<size_t>(std::min<fsize_t>(default_block_size, to_write)));
+
543 size_t num_written = write(data.get(), num_read);
+
544 num_copied += num_written;
+
545 to_write -= num_written;
+
546 if (stream.m_state == state_t::eof) {
+
547 // EOF is not an error.
+
548 m_state = state_t::ok;
+
549 break;
+
550 }
+
551 m_state = stream.m_state;
+
552 if (!ok())
+
553 break;
+
554 }
+
555 return num_copied;
+
556 }
-
555
-
-
559 void write_charset(_In_ charset_id charset)
-
560 {
-
561 if (charset == charset_id::utf16)
-
562 write_data(utf16_bom);
-
563 else if (charset == charset_id::utf8)
-
564 write_array(utf8_bom, sizeof(utf8_bom), 1);
-
565 }
+
557
+
+
561 void write_charset(_In_ charset_id charset)
+
562 {
+
563 if (charset == charset_id::utf16)
+
564 write_data(utf16_bom);
+
565 else if (charset == charset_id::utf8)
+
566 write_array(utf8_bom, sizeof(utf8_bom), 1);
+
567 }
-
566
-
-
572 size_t write_sprintf(_In_z_ _Printf_format_string_params_(2) const char* format, _In_opt_ locale_t locale, ...)
-
573 {
-
574 va_list params;
-
575 va_start(params, locale);
-
576 size_t num_chars = write_vsprintf(format, locale, params);
-
577 va_end(params);
-
578 return num_chars;
-
579 }
+
568
+
+
574 size_t write_sprintf(_In_z_ _Printf_format_string_params_(2) const char* format, _In_opt_ locale_t locale, ...)
+
575 {
+
576 va_list params;
+
577 va_start(params, locale);
+
578 size_t num_chars = write_vsprintf(format, locale, params);
+
579 va_end(params);
+
580 return num_chars;
+
581 }
-
580
-
-
586 size_t write_sprintf(_In_z_ _Printf_format_string_params_(2) const wchar_t* format, _In_opt_ locale_t locale, ...)
-
587 {
-
588 va_list params;
-
589 va_start(params, locale);
-
590 size_t num_chars = write_vsprintf(format, locale, params);
-
591 va_end(params);
-
592 return num_chars;
-
593 }
+
582
+
+
588 size_t write_sprintf(_In_z_ _Printf_format_string_params_(2) const wchar_t* format, _In_opt_ locale_t locale, ...)
+
589 {
+
590 va_list params;
+
591 va_start(params, locale);
+
592 size_t num_chars = write_vsprintf(format, locale, params);
+
593 va_end(params);
+
594 return num_chars;
+
595 }
-
594
-
-
600 size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const char* format, _In_opt_ locale_t locale, _In_ va_list params)
-
601 {
-
602 std::string str;
-
603 str.reserve(default_block_size);
-
604 vappendf(str, format, locale, params);
-
605 return write_array(str.data(), sizeof(char), str.size());
-
606 }
+
596
+
+
602 size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const char* format, _In_opt_ locale_t locale, _In_ va_list params)
+
603 {
+
604 std::string str;
+
605 str.reserve(default_block_size);
+
606 vappendf(str, format, locale, params);
+
607 return write_array(str.data(), sizeof(char), str.size());
+
608 }
-
607
-
-
613 size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const wchar_t* format, _In_opt_ locale_t locale, _In_ va_list params)
-
614 {
-
615 std::wstring str;
-
616 str.reserve(default_block_size);
-
617 vappendf(str, format, locale, params);
-
618 return write_array(str.data(), sizeof(wchar_t), str.size());
-
619 }
+
609
+
+
615 size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const wchar_t* format, _In_opt_ locale_t locale, _In_ va_list params)
+
616 {
+
617 std::wstring str;
+
618 str.reserve(default_block_size);
+
619 vappendf(str, format, locale, params);
+
620 return write_array(str.data(), sizeof(wchar_t), str.size());
+
621 }
-
620
-
621 inline basic& operator >>(_Out_ int8_t& data) { return read_data(data); }
-
622 inline basic& operator <<(_In_ const int8_t data) { return write_data(data); }
-
623 inline basic& operator >>(_Out_ int16_t& data) { return read_data(data); }
-
624 inline basic& operator <<(_In_ const int16_t data) { return write_data(data); }
-
625 inline basic& operator >>(_Out_ int32_t& data) { return read_data(data); }
-
626 inline basic& operator <<(_In_ const int32_t data) { return write_data(data); }
-
627 inline basic& operator >>(_Out_ int64_t& data) { return read_data(data); }
-
628 inline basic& operator <<(_In_ const int64_t data) { return write_data(data); }
-
629 inline basic& operator >>(_Out_ uint8_t& data) { return read_data(data); }
-
630 inline basic& operator <<(_In_ const uint8_t data) { return write_data(data); }
-
631 inline basic& operator >>(_Out_ uint16_t& data) { return read_data(data); }
-
632 inline basic& operator <<(_In_ const uint16_t data) { return write_data(data); }
-
633 inline basic& operator >>(_Out_ uint32_t& data) { return read_data(data); }
-
634 inline basic& operator <<(_In_ const uint32_t data) { return write_data(data); }
-
635 inline basic& operator >>(_Out_ uint64_t& data) { return read_data(data); }
-
636 inline basic& operator <<(_In_ const uint64_t data) { return write_data(data); }
-
637 inline basic& operator >>(_Out_ float& data) { return read_data(data); }
-
638 inline basic& operator <<(_In_ const float data) { return write_data(data); }
-
639 inline basic& operator >>(_Out_ double& data) { return read_data(data); }
-
640 inline basic& operator <<(_In_ const double data) { return write_data(data); }
-
641 inline basic& operator >>(_Out_ char& data) { return read_data(data); }
-
642 inline basic& operator <<(_In_ const char data) { return write_data(data); }
-
643#ifdef _NATIVE_WCHAR_T_DEFINED
-
644 inline basic& operator >>(_Out_ wchar_t& data) { return read_data(data); }
-
645 inline basic& operator <<(_In_ const wchar_t data) { return write_data(data); }
-
646#endif
-
647 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
648 inline basic& operator >>(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& data) { return read_str(data); }
-
649 template <class T>
-
650 inline basic& operator <<(_In_ const T* data) { return write_str(data); }
-
651
-
652 protected:
-
653 state_t m_state;
-
654 };
+
622
+
623 inline basic& operator >>(_Out_ int8_t& data) { return read_data(data); }
+
624 inline basic& operator <<(_In_ const int8_t data) { return write_data(data); }
+
625 inline basic& operator >>(_Out_ int16_t& data) { return read_data(data); }
+
626 inline basic& operator <<(_In_ const int16_t data) { return write_data(data); }
+
627 inline basic& operator >>(_Out_ int32_t& data) { return read_data(data); }
+
628 inline basic& operator <<(_In_ const int32_t data) { return write_data(data); }
+
629 inline basic& operator >>(_Out_ int64_t& data) { return read_data(data); }
+
630 inline basic& operator <<(_In_ const int64_t data) { return write_data(data); }
+
631 inline basic& operator >>(_Out_ uint8_t& data) { return read_data(data); }
+
632 inline basic& operator <<(_In_ const uint8_t data) { return write_data(data); }
+
633 inline basic& operator >>(_Out_ uint16_t& data) { return read_data(data); }
+
634 inline basic& operator <<(_In_ const uint16_t data) { return write_data(data); }
+
635 inline basic& operator >>(_Out_ uint32_t& data) { return read_data(data); }
+
636 inline basic& operator <<(_In_ const uint32_t data) { return write_data(data); }
+
637 inline basic& operator >>(_Out_ uint64_t& data) { return read_data(data); }
+
638 inline basic& operator <<(_In_ const uint64_t data) { return write_data(data); }
+
639 inline basic& operator >>(_Out_ float& data) { return read_data(data); }
+
640 inline basic& operator <<(_In_ const float data) { return write_data(data); }
+
641 inline basic& operator >>(_Out_ double& data) { return read_data(data); }
+
642 inline basic& operator <<(_In_ const double data) { return write_data(data); }
+
643 inline basic& operator >>(_Out_ char& data) { return read_data(data); }
+
644 inline basic& operator <<(_In_ const char data) { return write_data(data); }
+
645#ifdef _NATIVE_WCHAR_T_DEFINED
+
646 inline basic& operator >>(_Out_ wchar_t& data) { return read_data(data); }
+
647 inline basic& operator <<(_In_ const wchar_t data) { return write_data(data); }
+
648#endif
+
649 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
650 inline basic& operator >>(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& data) { return read_str(data); }
+
651 template <class T>
+
652 inline basic& operator <<(_In_ const T* data) { return write_str(data); }
+
653
+
654 protected:
+
655 state_t m_state;
+
656 };
-
655
-
659 using fpos_t = uint64_t;
-
660 constexpr fpos_t fpos_max = UINT64_MAX;
-
661 constexpr fpos_t fpos_min = 0;
-
662
-
666 using foff_t = int64_t;
-
667 constexpr foff_t foff_max = INT64_MAX;
-
668 constexpr foff_t foff_min = INT64_MIN;
-
669
-
673 enum class seek_t {
-
674#ifdef _WIN32
-
675 beg = FILE_BEGIN,
-
676 cur = FILE_CURRENT,
-
677 end = FILE_END
-
678#else
-
679 beg = SEEK_SET,
-
680 cur = SEEK_CUR,
-
681 end = SEEK_END
-
682#endif
-
683 };
-
684
-
685#if _HAS_CXX20
-
686 using clock = std::chrono::file_clock;
-
687#else
-
688 using clock = std::chrono::system_clock;
-
689#endif
-
690 using time_point = std::chrono::time_point<clock>;
-
691
-
-
695 class basic_file : virtual public basic
-
696 {
-
697 public:
-
-
698 virtual std::vector<uint8_t> read_remainder(_In_ size_t max_length = SIZE_MAX)
-
699 {
-
700 size_t length = std::min<size_t>(max_length, static_cast<size_t>(size() - tell()));
-
701 std::vector<uint8_t> result;
-
702 try { result.resize(length); }
-
703 catch (const std::bad_alloc&) {
-
704 m_state = state_t::fail;
-
705 return result;
-
706 }
-
707 result.resize(read_array(result.data(), sizeof(uint8_t), length));
-
708 return result;
-
709 }
+
657
+
661 using fpos_t = uint64_t;
+
662 constexpr fpos_t fpos_max = UINT64_MAX;
+
663 constexpr fpos_t fpos_min = 0;
+
664
+
668 using foff_t = int64_t;
+
669 constexpr foff_t foff_max = INT64_MAX;
+
670 constexpr foff_t foff_min = INT64_MIN;
+
671
+
675 enum class seek_t {
+
676#ifdef _WIN32
+
677 beg = FILE_BEGIN,
+
678 cur = FILE_CURRENT,
+
679 end = FILE_END
+
680#else
+
681 beg = SEEK_SET,
+
682 cur = SEEK_CUR,
+
683 end = SEEK_END
+
684#endif
+
685 };
+
686
+
687#if _HAS_CXX20
+
688 using clock = std::chrono::file_clock;
+
689#else
+
690 using clock = std::chrono::system_clock;
+
691#endif
+
692 using time_point = std::chrono::time_point<clock>;
+
693
+
+
697 class basic_file : virtual public basic
+
698 {
+
699 public:
+
+
700 virtual std::vector<uint8_t> read_remainder(_In_ size_t max_length = SIZE_MAX)
+
701 {
+
702 size_t length = std::min<size_t>(max_length, static_cast<size_t>(size() - tell()));
+
703 std::vector<uint8_t> result;
+
704 try { result.resize(length); }
+
705 catch (const std::bad_alloc&) {
+
706 m_state = state_t::fail;
+
707 return result;
+
708 }
+
709 result.resize(read_array(result.data(), sizeof(uint8_t), length));
+
710 return result;
+
711 }
-
710
-
716 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg) = 0;
-
717
-
723 inline fpos_t seekbeg(_In_ fpos_t offset) { return seek(offset, seek_t::beg); }
-
724
-
730 inline fpos_t seekcur(_In_ foff_t offset) { return seek(offset, seek_t::cur); }
-
731
-
737 inline fpos_t seekend(_In_ foff_t offset) { return seek(offset, seek_t::end); }
-
738
-
-
739 virtual void skip(_In_ fsize_t amount)
-
740 {
-
741 seek(amount, seek_t::cur);
-
742 }
+
712
+
718 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg) = 0;
+
719
+
725 inline fpos_t seekbeg(_In_ fpos_t offset) { return seek(offset, seek_t::beg); }
+
726
+
732 inline fpos_t seekcur(_In_ foff_t offset) { return seek(offset, seek_t::cur); }
+
733
+
739 inline fpos_t seekend(_In_ foff_t offset) { return seek(offset, seek_t::end); }
+
740
+
+
741 virtual void skip(_In_ fsize_t amount)
+
742 {
+
743 seek(amount, seek_t::cur);
+
744 }
-
743
-
750 virtual fpos_t tell() const = 0;
-
751
-
-
755 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
-
756 {
-
757 _Unreferenced_(offset);
-
758 _Unreferenced_(length);
-
759 throw std::domain_error("not implemented");
-
760 }
+
745
+
752 virtual fpos_t tell() const = 0;
+
753
+
+
757 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
+
758 {
+
759 _Unreferenced_(offset);
+
760 _Unreferenced_(length);
+
761 throw std::domain_error("not implemented");
+
762 }
-
761
-
-
765 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
-
766 {
-
767 _Unreferenced_(offset);
-
768 _Unreferenced_(length);
-
769 throw std::domain_error("not implemented");
-
770 }
+
763
+
+
767 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
+
768 {
+
769 _Unreferenced_(offset);
+
770 _Unreferenced_(length);
+
771 throw std::domain_error("not implemented");
+
772 }
-
771
-
776 virtual fsize_t size() = 0;
-
777
-
781 virtual void truncate() = 0;
-
782
-
-
786 virtual time_point ctime() const
-
787 {
-
788 return time_point::min();
-
789 }
+
773
+
778 virtual fsize_t size() = 0;
+
779
+
783 virtual void truncate() = 0;
+
784
+
+
788 virtual time_point ctime() const
+
789 {
+
790 return time_point::min();
+
791 }
-
790
-
-
794 virtual time_point atime() const
-
795 {
-
796 return time_point::min();
-
797 }
+
792
+
+
796 virtual time_point atime() const
+
797 {
+
798 return time_point::min();
+
799 }
-
798
-
-
802 virtual time_point mtime() const
-
803 {
-
804 return time_point::min();
-
805 }
+
800
+
+
804 virtual time_point mtime() const
+
805 {
+
806 return time_point::min();
+
807 }
-
806
-
-
810 virtual void set_ctime(time_point date)
-
811 {
-
812 _Unreferenced_(date);
-
813 throw std::domain_error("not implemented");
-
814 }
+
808
+
+
812 virtual void set_ctime(time_point date)
+
813 {
+
814 _Unreferenced_(date);
+
815 throw std::domain_error("not implemented");
+
816 }
-
815
-
-
819 virtual void set_atime(time_point date)
-
820 {
-
821 _Unreferenced_(date);
-
822 throw std::domain_error("not implemented");
-
823 }
+
817
+
+
821 virtual void set_atime(time_point date)
+
822 {
+
823 _Unreferenced_(date);
+
824 throw std::domain_error("not implemented");
+
825 }
-
824
-
-
828 virtual void set_mtime(time_point date)
-
829 {
-
830 _Unreferenced_(date);
-
831 throw std::domain_error("not implemented");
-
832 }
+
826
+
+
830 virtual void set_mtime(time_point date)
+
831 {
+
832 _Unreferenced_(date);
+
833 throw std::domain_error("not implemented");
+
834 }
-
833
-
834#ifdef _WIN32
-
838 LPSAFEARRAY read_sa()
-
839 {
-
840 assert(size() <= SIZE_MAX);
-
841 size_t length = static_cast<size_t>(size());
-
842 std::unique_ptr<SAFEARRAY, SafeArrayDestroy_delete> sa(SafeArrayCreateVector(VT_UI1, 0, (ULONG)length));
-
843 if (!sa)
-
844 throw std::runtime_error("SafeArrayCreateVector failed");
-
845 safearray_accessor<void> a(sa.get());
-
846 if (seek(0) != 0)
-
847 throw std::runtime_error("failed to seek");
-
848 if (read_array(a.data(), 1, length) != length)
-
849 throw std::runtime_error("failed to read");
-
850 return sa.release();
-
851 }
-
852#endif
-
853
-
-
859 charset_id read_charset(_In_ charset_id default_charset = charset_id::system)
-
860 {
-
861 if (seek(0) != 0)
-
862 throw std::runtime_error("failed to seek");
-
863 wchar_t id_utf16;
-
864 read_array(&id_utf16, sizeof(wchar_t), 1);
-
865 if (!ok()) _Unlikely_
-
866 return default_charset;
-
867 if (id_utf16 == utf16_bom)
-
868 return charset_id::utf16;
-
869
-
870 if (seek(0) != 0)
-
871 throw std::runtime_error("failed to seek");
-
872 char id_utf8[3] = { 0 };
-
873 read_array(id_utf8, sizeof(id_utf8), 1);
-
874 if (!ok()) _Unlikely_
-
875 return default_charset;
-
876 if (strncmp(id_utf8, _countof(id_utf8), utf8_bom, _countof(utf8_bom)) == 0)
-
877 return charset_id::utf8;
-
878
-
879 if (seek(0) != 0)
-
880 throw std::runtime_error("failed to seek");
-
881 return default_charset;
-
882 }
+
835
+
836#ifdef _WIN32
+
840 LPSAFEARRAY read_sa()
+
841 {
+
842 assert(size() <= SIZE_MAX);
+
843 size_t length = static_cast<size_t>(size());
+
844 std::unique_ptr<SAFEARRAY, SafeArrayDestroy_delete> sa(SafeArrayCreateVector(VT_UI1, 0, (ULONG)length));
+
845 if (!sa)
+
846 throw std::runtime_error("SafeArrayCreateVector failed");
+
847 safearray_accessor<void> a(sa.get());
+
848 if (seek(0) != 0)
+
849 throw std::runtime_error("failed to seek");
+
850 if (read_array(a.data(), 1, length) != length)
+
851 throw std::runtime_error("failed to read");
+
852 return sa.release();
+
853 }
+
854#endif
+
855
+
+
861 charset_id read_charset(_In_ charset_id default_charset = charset_id::system)
+
862 {
+
863 if (seek(0) != 0)
+
864 throw std::runtime_error("failed to seek");
+
865 wchar_t id_utf16;
+
866 read_array(&id_utf16, sizeof(wchar_t), 1);
+
867 if (!ok()) _Unlikely_
+
868 return default_charset;
+
869 if (id_utf16 == utf16_bom)
+
870 return charset_id::utf16;
+
871
+
872 if (seek(0) != 0)
+
873 throw std::runtime_error("failed to seek");
+
874 char id_utf8[3] = { 0 };
+
875 read_array(id_utf8, sizeof(id_utf8), 1);
+
876 if (!ok()) _Unlikely_
+
877 return default_charset;
+
878 if (strncmp(id_utf8, _countof(id_utf8), utf8_bom, _countof(utf8_bom)) == 0)
+
879 return charset_id::utf8;
+
880
+
881 if (seek(0) != 0)
+
882 throw std::runtime_error("failed to seek");
+
883 return default_charset;
+
884 }
-
883 };
+
885 };
-
884
-
-
888 class converter : public basic
-
889 {
-
890 protected:
-
891 explicit converter() :
-
892 basic(state_t::fail),
-
893 m_source(nullptr)
-
894 {}
-
895
-
896 void init(_Inout_ basic& source)
-
897 {
-
898 m_state = source.state();
-
899 m_source = &source;
-
900 }
-
901
-
902 void done()
-
903 {
-
904 m_source = nullptr;
-
905 }
-
906
-
907 public:
-
908 converter(_Inout_ basic& source) :
-
909 basic(source.state()),
-
910 m_source(&source)
-
911 {}
-
912
-
-
913 virtual _Success_(return != 0 || length == 0) size_t read(
-
914 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
915 {
-
916 size_t num_read = m_source->read(data, length);
-
917 m_state = m_source->state();
-
918 return num_read;
-
919 }
+
886
+
+
890 class converter : public basic
+
891 {
+
892 protected:
+
893 explicit converter() :
+
894 basic(state_t::fail),
+
895 m_source(nullptr)
+
896 {}
+
897
+
898 void init(_Inout_ basic& source)
+
899 {
+
900 m_state = source.state();
+
901 m_source = &source;
+
902 }
+
903
+
904 void done()
+
905 {
+
906 m_source = nullptr;
+
907 }
+
908
+
909 public:
+
910 converter(_Inout_ basic& source) :
+
911 basic(source.state()),
+
912 m_source(&source)
+
913 {}
+
914
+
+
915 virtual _Success_(return != 0 || length == 0) size_t read(
+
916 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
917 {
+
918 size_t num_read = m_source->read(data, length);
+
919 m_state = m_source->state();
+
920 return num_read;
+
921 }
-
920
-
-
921 virtual _Success_(return != 0) size_t write(
-
922 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
923 {
-
924 size_t num_written = m_source->write(data, length);
-
925 m_state = m_source->state();
-
926 return num_written;
-
927 }
+
922
+
+
923 virtual _Success_(return != 0) size_t write(
+
924 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
925 {
+
926 size_t num_written = m_source->write(data, length);
+
927 m_state = m_source->state();
+
928 return num_written;
+
929 }
-
928
-
-
929 virtual void close()
-
930 {
-
931 m_source->close();
-
932 m_state = m_source->state();
-
933 }
+
930
+
+
931 virtual void close()
+
932 {
+
933 m_source->close();
+
934 m_state = m_source->state();
+
935 }
-
934
-
-
935 virtual void flush()
-
936 {
-
937 m_source->flush();
-
938 m_state = m_source->state();
-
939 }
+
936
+
+
937 virtual void flush()
+
938 {
+
939 m_source->flush();
+
940 m_state = m_source->state();
+
941 }
-
940
-
941 protected:
-
942 basic* m_source;
-
943 };
+
942
+
943 protected:
+
944 basic* m_source;
+
945 };
-
944
-
-
948 class replicator : public basic
-
949 {
-
950 public:
-
951 virtual ~replicator()
-
952 {
-
953 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
-
954 auto _w = w->get();
-
955 {
-
956 const std::lock_guard<std::mutex> lk(_w->mutex);
-
957 _w->op = worker::op_t::quit;
-
958 }
-
959 _w->cv.notify_one();
-
960 }
-
961 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w)
-
962 w->get()->thread.join();
-
963 }
-
964
-
-
968 void push_back(_In_ basic* source)
-
969 {
-
970 m_workers.push_back(std::unique_ptr<worker>(new worker(source)));
-
971 }
+
946
+
+
950 class replicator : public basic
+
951 {
+
952 public:
+
953 virtual ~replicator()
+
954 {
+
955 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
+
956 auto _w = w->get();
+
957 {
+
958 const std::lock_guard<std::mutex> lk(_w->mutex);
+
959 _w->op = worker::op_t::quit;
+
960 }
+
961 _w->cv.notify_one();
+
962 }
+
963 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w)
+
964 w->get()->thread.join();
+
965 }
+
966
+
+
970 void push_back(_In_ basic* source)
+
971 {
+
972 m_workers.push_back(std::unique_ptr<worker>(new worker(source)));
+
973 }
-
972
-
-
976 void remove(basic* source)
-
977 {
-
978 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
-
979 auto _w = w->get();
-
980 if (_w->source == source) {
-
981 {
-
982 const std::lock_guard<std::mutex> lk(_w->mutex);
-
983 _w->op = worker::op_t::quit;
-
984 }
-
985 _w->cv.notify_one();
-
986 _w->thread.join();
-
987 m_workers.erase(w);
-
988 return;
-
989 }
-
990 }
-
991 }
+
974
+
+
978 void remove(basic* source)
+
979 {
+
980 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
+
981 auto _w = w->get();
+
982 if (_w->source == source) {
+
983 {
+
984 const std::lock_guard<std::mutex> lk(_w->mutex);
+
985 _w->op = worker::op_t::quit;
+
986 }
+
987 _w->cv.notify_one();
+
988 _w->thread.join();
+
989 m_workers.erase(w);
+
990 return;
+
991 }
+
992 }
+
993 }
-
992
-
-
993 virtual _Success_(return != 0) size_t write(
-
994 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
995 {
-
996 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
-
997 auto _w = w->get();
-
998 {
-
999 const std::lock_guard<std::mutex> lk(_w->mutex);
-
1000 _w->op = worker::op_t::write;
-
1001 _w->data = data;
-
1002 _w->length = length;
-
1003 }
-
1004 _w->cv.notify_one();
-
1005 }
-
1006 size_t num_written = length;
-
1007 m_state = state_t::ok;
-
1008 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
-
1009 auto _w = w->get();
-
1010 std::unique_lock<std::mutex> lk(_w->mutex);
-
1011 _w->cv.wait(lk, [&] {return _w->op == worker::op_t::noop; });
-
1012 if (_w->num_written < num_written)
-
1013 num_written = _w->num_written;
-
1014 if (ok() && !_w->source->ok())
-
1015 m_state = _w->source->state();
-
1016 }
-
1017 return num_written;
-
1018 }
+
994
+
+
995 virtual _Success_(return != 0) size_t write(
+
996 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
997 {
+
998 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
+
999 auto _w = w->get();
+
1000 {
+
1001 const std::lock_guard<std::mutex> lk(_w->mutex);
+
1002 _w->op = worker::op_t::write;
+
1003 _w->data = data;
+
1004 _w->length = length;
+
1005 }
+
1006 _w->cv.notify_one();
+
1007 }
+
1008 size_t num_written = length;
+
1009 m_state = state_t::ok;
+
1010 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
+
1011 auto _w = w->get();
+
1012 std::unique_lock<std::mutex> lk(_w->mutex);
+
1013 _w->cv.wait(lk, [&] {return _w->op == worker::op_t::noop; });
+
1014 if (_w->num_written < num_written)
+
1015 num_written = _w->num_written;
+
1016 if (ok() && !_w->source->ok())
+
1017 m_state = _w->source->state();
+
1018 }
+
1019 return num_written;
+
1020 }
-
1019
-
-
1020 virtual void close()
-
1021 {
-
1022 foreach_worker(worker::op_t::close);
-
1023 }
+
1021
+
+
1022 virtual void close()
+
1023 {
+
1024 foreach_worker(worker::op_t::close);
+
1025 }
-
1024
-
-
1025 virtual void flush()
-
1026 {
-
1027 foreach_worker(worker::op_t::flush);
-
1028 }
+
1026
+
+
1027 virtual void flush()
+
1028 {
+
1029 foreach_worker(worker::op_t::flush);
+
1030 }
-
1029
-
1030 protected:
-
- -
1032 {
-
1033 public:
-
1034 worker(_In_ basic* _source) :
-
1035 source(_source),
-
1036 op(op_t::noop),
-
1037 data(nullptr),
-
1038 length(0),
-
1039 num_written(0),
-
1040 thread(process_op, std::ref(*this))
-
1041 {}
-
1042
-
1043 protected:
-
1044 static void process_op(_Inout_ worker& w)
-
1045 {
-
1046 for (;;) {
-
1047 std::unique_lock<std::mutex> lk(w.mutex);
-
1048 w.cv.wait(lk, [&] {return w.op != op_t::noop; });
-
1049 switch (w.op) {
-
1050 case op_t::quit:
-
1051 return;
-
1052 case op_t::write:
-
1053 w.num_written = w.source->write(w.data, w.length);
-
1054 break;
-
1055 case op_t::close:
-
1056 w.source->close();
-
1057 break;
-
1058 case op_t::flush:
-
1059 w.source->flush();
-
1060 break;
-
1061 case op_t::noop:;
-
1062 }
-
1063 w.op = op_t::noop;
-
1064 lk.unlock();
-
1065 w.cv.notify_one();
-
1066 }
-
1067 }
-
1068
-
1069 public:
-
1070 basic* source;
-
1071 enum class op_t {
-
1072 noop = 0,
-
1073 quit,
-
1074 write,
-
1075 close,
-
1076 flush,
-
1077 } op;
-
1078 const void* data;
-
1079 size_t length;
- -
1081 std::mutex mutex;
-
1082 std::condition_variable cv;
-
1083 std::thread thread;
-
1084 };
+
1031
+
1032 protected:
+
+ +
1034 {
+
1035 public:
+
1036 worker(_In_ basic* _source) :
+
1037 source(_source),
+
1038 op(op_t::noop),
+
1039 data(nullptr),
+
1040 length(0),
+
1041 num_written(0),
+
1042 thread(process_op, std::ref(*this))
+
1043 {}
+
1044
+
1045 protected:
+
1046 static void process_op(_Inout_ worker& w)
+
1047 {
+
1048 for (;;) {
+
1049 std::unique_lock<std::mutex> lk(w.mutex);
+
1050 w.cv.wait(lk, [&] {return w.op != op_t::noop; });
+
1051 switch (w.op) {
+
1052 case op_t::quit:
+
1053 return;
+
1054 case op_t::write:
+
1055 w.num_written = w.source->write(w.data, w.length);
+
1056 break;
+
1057 case op_t::close:
+
1058 w.source->close();
+
1059 break;
+
1060 case op_t::flush:
+
1061 w.source->flush();
+
1062 break;
+
1063 case op_t::noop:;
+
1064 }
+
1065 w.op = op_t::noop;
+
1066 lk.unlock();
+
1067 w.cv.notify_one();
+
1068 }
+
1069 }
+
1070
+
1071 public:
+
1072 basic* source;
+
1073 enum class op_t {
+
1074 noop = 0,
+
1075 quit,
+
1076 write,
+
1077 close,
+
1078 flush,
+
1079 } op;
+
1080 const void* data;
+
1081 size_t length;
+ +
1083 std::mutex mutex;
+
1084 std::condition_variable cv;
+
1085 std::thread thread;
+
1086 };
-
1085
-
1086 void foreach_worker(_In_ worker::op_t op)
-
1087 {
-
1088 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
-
1089 auto _w = w->get();
-
1090 {
-
1091 const std::lock_guard<std::mutex> lk(_w->mutex);
-
1092 _w->op = op;
-
1093 }
-
1094 _w->cv.notify_one();
-
1095 }
-
1096 m_state = state_t::ok;
-
1097 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
-
1098 auto _w = w->get();
-
1099 std::unique_lock<std::mutex> lk(_w->mutex);
-
1100 _w->cv.wait(lk, [&] {return _w->op == worker::op_t::noop; });
-
1101 if (ok())
-
1102 m_state = _w->source->state();
-
1103 }
-
1104 }
-
1105
-
1106 std::list<std::unique_ptr<worker>> m_workers;
-
1107 };
+
1087
+
1088 void foreach_worker(_In_ worker::op_t op)
+
1089 {
+
1090 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
+
1091 auto _w = w->get();
+
1092 {
+
1093 const std::lock_guard<std::mutex> lk(_w->mutex);
+
1094 _w->op = op;
+
1095 }
+
1096 _w->cv.notify_one();
+
1097 }
+
1098 m_state = state_t::ok;
+
1099 for (auto w = m_workers.begin(), w_end = m_workers.end(); w != w_end; ++w) {
+
1100 auto _w = w->get();
+
1101 std::unique_lock<std::mutex> lk(_w->mutex);
+
1102 _w->cv.wait(lk, [&] {return _w->op == worker::op_t::noop; });
+
1103 if (ok())
+
1104 m_state = _w->source->state();
+
1105 }
+
1106 }
+
1107
+
1108 std::list<std::unique_ptr<worker>> m_workers;
+
1109 };
-
1108
-
1109 constexpr size_t default_async_limit = 0x100000;
1110
-
1116 template <size_t CAPACITY = default_async_limit>
-
- -
1118 {
-
1119 public:
-
1120 async_reader(_Inout_ basic& source) :
-
1121 converter(source),
-
1122 m_worker(process, std::ref(*this))
-
1123 {}
-
1124
-
1125 virtual ~async_reader()
-
1126 {
-
1127 m_ring.quit();
-
1128 m_worker.join();
-
1129 }
-
1130
-
1131#pragma warning(suppress: 6101) // See [1] below
-
-
1132 virtual _Success_(return != 0 || length == 0) size_t read(
-
1133 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
1134 {
-
1135 assert(data || !length);
-
1136 for (size_t to_read = length;;) {
-
1137 uint8_t* ptr; size_t num_read;
-
1138 std::tie(ptr, num_read) = m_ring.front();
-
1139 if (!ptr) _Unlikely_ {
-
1140 // [1] Code analysis misses length - to_read bytes were written to data in previous loop iterations.
-
1141 m_state = to_read < length || !length ? state_t::ok : m_source->state();
-
1142 return length - to_read;
-
1143 }
-
1144 if (to_read < num_read)
-
1145 num_read = to_read;
-
1146 memcpy(data, ptr, num_read);
-
1147 m_ring.pop(num_read);
-
1148 to_read -= num_read;
-
1149 if (!to_read) {
-
1150 m_state = state_t::ok;
-
1151 return length;
-
1152 }
-
1153 reinterpret_cast<uint8_t*&>(data) += num_read;
-
1154 }
-
1155 }
+
1111 constexpr size_t default_async_limit = 0x100000;
+
1112
+
1118 template <size_t CAPACITY = default_async_limit>
+
+ +
1120 {
+
1121 public:
+
1122 async_reader(_Inout_ basic& source) :
+
1123 converter(source),
+
1124 m_worker(process, std::ref(*this))
+
1125 {}
+
1126
+
1127 virtual ~async_reader()
+
1128 {
+
1129 m_ring.quit();
+
1130 m_worker.join();
+
1131 }
+
1132
+
1133#pragma warning(suppress: 6101) // See [1] below
+
+
1134 virtual _Success_(return != 0 || length == 0) size_t read(
+
1135 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
1136 {
+
1137 assert(data || !length);
+
1138 for (size_t to_read = length;;) {
+
1139 uint8_t* ptr; size_t num_read;
+
1140 std::tie(ptr, num_read) = m_ring.front();
+
1141 if (!ptr) _Unlikely_ {
+
1142 // [1] Code analysis misses length - to_read bytes were written to data in previous loop iterations.
+
1143 m_state = to_read < length || !length ? state_t::ok : m_source->state();
+
1144 return length - to_read;
+
1145 }
+
1146 if (to_read < num_read)
+
1147 num_read = to_read;
+
1148 memcpy(data, ptr, num_read);
+
1149 m_ring.pop(num_read);
+
1150 to_read -= num_read;
+
1151 if (!to_read) {
+
1152 m_state = state_t::ok;
+
1153 return length;
+
1154 }
+
1155 reinterpret_cast<uint8_t*&>(data) += num_read;
+
1156 }
+
1157 }
-
1156
-
1157 protected:
-
1158 static void process(_Inout_ async_reader& w)
-
1159 {
-
1160 for (;;) {
-
1161 uint8_t* ptr; size_t num_write;
-
1162 std::tie(ptr, num_write) = w.m_ring.back();
-
1163 if (!ptr) _Unlikely_
-
1164 break;
-
1165 num_write = w.m_source->read(ptr, num_write);
-
1166 w.m_ring.push(num_write);
-
1167 if (!w.m_source->ok()) {
-
1168 w.m_ring.quit();
-
1169 break;
-
1170 }
-
1171 }
-
1172 }
-
1173
-
1174 protected:
-
1175 ring<uint8_t, CAPACITY> m_ring;
-
1176 std::thread m_worker;
-
1177 };
+
1158
+
1159 protected:
+
1160 static void process(_Inout_ async_reader& w)
+
1161 {
+
1162 for (;;) {
+
1163 uint8_t* ptr; size_t num_write;
+
1164 std::tie(ptr, num_write) = w.m_ring.back();
+
1165 if (!ptr) _Unlikely_
+
1166 break;
+
1167 num_write = w.m_source->read(ptr, num_write);
+
1168 w.m_ring.push(num_write);
+
1169 if (!w.m_source->ok()) {
+
1170 w.m_ring.quit();
+
1171 break;
+
1172 }
+
1173 }
+
1174 }
+
1175
+
1176 protected:
+
1177 ring<uint8_t, CAPACITY> m_ring;
+
1178 std::thread m_worker;
+
1179 };
-
1178
-
1184 template <size_t CAPACITY = default_async_limit>
-
- -
1186 {
-
1187 public:
-
1188 async_writer(_Inout_ basic& source) :
-
1189 converter(source),
-
1190 m_worker(process, std::ref(*this))
-
1191 {}
-
1192
-
1193 virtual ~async_writer()
-
1194 {
-
1195 m_ring.quit();
-
1196 m_worker.join();
-
1197 }
-
1198
-
-
1199 virtual _Success_(return != 0) size_t write(
-
1200 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
1201 {
-
1202 assert(data || !length);
-
1203 for (size_t to_write = length;;) {
-
1204 uint8_t* ptr; size_t num_write;
-
1205 std::tie(ptr, num_write) = m_ring.back();
-
1206 if (!ptr) _Unlikely_ {
-
1207 m_state = state_t::fail;
-
1208 return length - to_write;
-
1209 }
-
1210 if (to_write < num_write)
-
1211 num_write = to_write;
-
1212 memcpy(ptr, data, num_write);
-
1213 m_ring.push(num_write);
-
1214 to_write -= num_write;
-
1215 if (!to_write) {
-
1216 m_state = state_t::ok;
-
1217 return length;
-
1218 }
-
1219 reinterpret_cast<const uint8_t*&>(data) += num_write;
-
1220 }
-
1221 }
+
1180
+
1186 template <size_t CAPACITY = default_async_limit>
+
+ +
1188 {
+
1189 public:
+
1190 async_writer(_Inout_ basic& source) :
+
1191 converter(source),
+
1192 m_worker(process, std::ref(*this))
+
1193 {}
+
1194
+
1195 virtual ~async_writer()
+
1196 {
+
1197 m_ring.quit();
+
1198 m_worker.join();
+
1199 }
+
1200
+
+
1201 virtual _Success_(return != 0) size_t write(
+
1202 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
1203 {
+
1204 assert(data || !length);
+
1205 for (size_t to_write = length;;) {
+
1206 uint8_t* ptr; size_t num_write;
+
1207 std::tie(ptr, num_write) = m_ring.back();
+
1208 if (!ptr) _Unlikely_ {
+
1209 m_state = state_t::fail;
+
1210 return length - to_write;
+
1211 }
+
1212 if (to_write < num_write)
+
1213 num_write = to_write;
+
1214 memcpy(ptr, data, num_write);
+
1215 m_ring.push(num_write);
+
1216 to_write -= num_write;
+
1217 if (!to_write) {
+
1218 m_state = state_t::ok;
+
1219 return length;
+
1220 }
+
1221 reinterpret_cast<const uint8_t*&>(data) += num_write;
+
1222 }
+
1223 }
-
1222
-
-
1223 virtual void flush()
-
1224 {
-
1225 m_ring.sync();
- -
1227 }
+
1224
+
+
1225 virtual void flush()
+
1226 {
+
1227 m_ring.sync();
+ +
1229 }
-
1228
-
1229 protected:
-
1230 static void process(_Inout_ async_writer& w)
-
1231 {
-
1232 for (;;) {
-
1233 uint8_t* ptr; size_t num_read;
-
1234 std::tie(ptr, num_read) = w.m_ring.front();
-
1235 if (!ptr)
-
1236 break;
-
1237 num_read = w.m_source->write(ptr, num_read);
-
1238 w.m_ring.pop(num_read);
-
1239 if (!w.m_source->ok()) {
-
1240 w.m_ring.quit();
-
1241 break;
-
1242 }
-
1243 }
-
1244 }
-
1245
-
1246 protected:
-
1247 ring<uint8_t, CAPACITY> m_ring;
-
1248 std::thread m_worker;
-
1249 };
+
1230
+
1231 protected:
+
1232 static void process(_Inout_ async_writer& w)
+
1233 {
+
1234 for (;;) {
+
1235 uint8_t* ptr; size_t num_read;
+
1236 std::tie(ptr, num_read) = w.m_ring.front();
+
1237 if (!ptr)
+
1238 break;
+
1239 num_read = w.m_source->write(ptr, num_read);
+
1240 w.m_ring.pop(num_read);
+
1241 if (!w.m_source->ok()) {
+
1242 w.m_ring.quit();
+
1243 break;
+
1244 }
+
1245 }
+
1246 }
+
1247
+
1248 protected:
+
1249 ring<uint8_t, CAPACITY> m_ring;
+
1250 std::thread m_worker;
+
1251 };
-
1250
-
1251 constexpr size_t default_buffer_size = 0x400;
1252
-
-
1256 class buffer : public converter
-
1257 {
-
1258 protected:
-
1259 explicit buffer(_In_ size_t read_buffer_size = default_buffer_size, _In_ size_t write_buffer_size = default_buffer_size) :
-
1260 converter(),
-
1261 m_read_buffer(read_buffer_size),
-
1262 m_write_buffer(write_buffer_size)
-
1263 {}
-
1264
-
1265 void done()
-
1266 {
-
1267 if (m_source)
-
1268 flush_write();
-
1269 converter::done();
-
1270 }
-
1271
-
1272 public:
-
1273 buffer(_Inout_ basic& source, _In_ size_t read_buffer_size = default_buffer_size, _In_ size_t write_buffer_size = default_buffer_size) :
-
1274 converter(source),
-
1275 m_read_buffer(read_buffer_size),
-
1276 m_write_buffer(write_buffer_size)
-
1277 {}
-
1278
-
1279 virtual ~buffer()
-
1280 {
-
1281 if (m_source)
-
1282 flush_write();
-
1283 }
-
1284
-
-
1285 virtual _Success_(return != 0 || length == 0) size_t read(
-
1286 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
1287 {
-
1288 assert(data || !length);
-
1289 for (size_t to_read = length;;) {
-
1290 size_t buffer_size = m_read_buffer.tail - m_read_buffer.head;
-
1291 if (to_read <= buffer_size) {
-
1292 memcpy(data, m_read_buffer.data + m_read_buffer.head, to_read);
-
1293 m_read_buffer.head += to_read;
-
1294 m_state = state_t::ok;
-
1295 return length;
-
1296 }
-
1297 if (buffer_size) {
-
1298 memcpy(data, m_read_buffer.data + m_read_buffer.head, buffer_size);
-
1299 reinterpret_cast<uint8_t*&>(data) += buffer_size;
-
1300 to_read -= buffer_size;
-
1301 }
-
1302 m_read_buffer.head = 0;
-
1303 if (to_read > m_read_buffer.capacity) {
-
1304 // When needing to read more data than buffer capacity, bypass the buffer.
-
1305 m_read_buffer.tail = 0;
-
1306 to_read -= m_source->read(data, to_read);
-
1307 m_state = to_read < length ? state_t::ok : m_source->state();
-
1308 return length - to_read;
-
1309 }
-
1310 m_read_buffer.tail = m_source->read(m_read_buffer.data, m_read_buffer.capacity);
-
1311 if (m_read_buffer.tail < m_read_buffer.capacity && m_read_buffer.tail < to_read) _Unlikely_ {
-
1312 memcpy(data, m_read_buffer.data, m_read_buffer.tail);
-
1313 m_read_buffer.head = m_read_buffer.tail;
-
1314 to_read -= m_read_buffer.tail;
-
1315 m_state = to_read < length ? state_t::ok : m_source->state();
-
1316 return length - to_read;
-
1317 }
-
1318 }
-
1319 }
+
1253 constexpr size_t default_buffer_size = 0x400;
+
1254
+
+
1258 class buffer : public converter
+
1259 {
+
1260 protected:
+
1261 explicit buffer(_In_ size_t read_buffer_size = default_buffer_size, _In_ size_t write_buffer_size = default_buffer_size) :
+
1262 converter(),
+
1263 m_read_buffer(read_buffer_size),
+
1264 m_write_buffer(write_buffer_size)
+
1265 {}
+
1266
+
1267 void done()
+
1268 {
+
1269 if (m_source)
+
1270 flush_write();
+
1271 converter::done();
+
1272 }
+
1273
+
1274 public:
+
1275 buffer(_Inout_ basic& source, _In_ size_t read_buffer_size = default_buffer_size, _In_ size_t write_buffer_size = default_buffer_size) :
+
1276 converter(source),
+
1277 m_read_buffer(read_buffer_size),
+
1278 m_write_buffer(write_buffer_size)
+
1279 {}
+
1280
+
1281 virtual ~buffer()
+
1282 {
+
1283 if (m_source)
+
1284 flush_write();
+
1285 }
+
1286
+
+
1287 virtual _Success_(return != 0 || length == 0) size_t read(
+
1288 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
1289 {
+
1290 assert(data || !length);
+
1291 for (size_t to_read = length;;) {
+
1292 size_t buffer_size = m_read_buffer.tail - m_read_buffer.head;
+
1293 if (to_read <= buffer_size) {
+
1294 memcpy(data, m_read_buffer.data + m_read_buffer.head, to_read);
+
1295 m_read_buffer.head += to_read;
+
1296 m_state = state_t::ok;
+
1297 return length;
+
1298 }
+
1299 if (buffer_size) {
+
1300 memcpy(data, m_read_buffer.data + m_read_buffer.head, buffer_size);
+
1301 reinterpret_cast<uint8_t*&>(data) += buffer_size;
+
1302 to_read -= buffer_size;
+
1303 }
+
1304 m_read_buffer.head = 0;
+
1305 if (to_read > m_read_buffer.capacity) {
+
1306 // When needing to read more data than buffer capacity, bypass the buffer.
+
1307 m_read_buffer.tail = 0;
+
1308 to_read -= m_source->read(data, to_read);
+
1309 m_state = to_read < length ? state_t::ok : m_source->state();
+
1310 return length - to_read;
+
1311 }
+
1312 m_read_buffer.tail = m_source->read(m_read_buffer.data, m_read_buffer.capacity);
+
1313 if (m_read_buffer.tail < m_read_buffer.capacity && m_read_buffer.tail < to_read) _Unlikely_ {
+
1314 memcpy(data, m_read_buffer.data, m_read_buffer.tail);
+
1315 m_read_buffer.head = m_read_buffer.tail;
+
1316 to_read -= m_read_buffer.tail;
+
1317 m_state = to_read < length ? state_t::ok : m_source->state();
+
1318 return length - to_read;
+
1319 }
+
1320 }
+
1321 }
-
1320
-
-
1321 virtual _Success_(return != 0) size_t write(
-
1322 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
1323 {
-
1324 assert(data || !length);
-
1325 if (!length) _Unlikely_ {
-
1326 // Pass null writes (zero-byte length). Null write operations have special meaning with with Windows pipes.
-
1327 flush_write();
-
1328 if (!ok()) _Unlikely_
-
1329 return 0;
-
1330 m_source->write(nullptr, 0);
-
1331 m_state = m_source->state();
-
1332 return 0;
-
1333 }
-
1334
-
1335 for (size_t to_write = length;;) {
-
1336 size_t available_buffer = m_write_buffer.capacity - m_write_buffer.tail;
-
1337 if (to_write <= available_buffer) {
-
1338 memcpy(m_write_buffer.data + m_write_buffer.tail, data, to_write);
-
1339 m_write_buffer.tail += to_write;
-
1340 m_state = state_t::ok;
-
1341 return length;
-
1342 }
-
1343 if (available_buffer) {
-
1344 memcpy(m_write_buffer.data + m_write_buffer.tail, data, available_buffer);
-
1345 reinterpret_cast<const uint8_t*&>(data) += available_buffer;
-
1346 to_write -= available_buffer;
-
1347 m_write_buffer.tail += available_buffer;
-
1348 }
-
1349 size_t buffer_size = m_write_buffer.tail - m_write_buffer.head;
-
1350 if (buffer_size) {
-
1351 m_write_buffer.head += m_source->write(m_write_buffer.data + m_write_buffer.head, buffer_size);
-
1352 m_state = m_source->state();
-
1353 if (m_write_buffer.head == m_write_buffer.tail)
-
1354 m_write_buffer.head = m_write_buffer.tail = 0;
-
1355 else
-
1356 return length - to_write;
-
1357 }
-
1358 if (to_write > m_write_buffer.capacity) {
-
1359 // When needing to write more data than buffer capacity, bypass the buffer.
-
1360 to_write -= m_source->write(data, to_write);
-
1361 m_state = m_source->state();
-
1362 return length - to_write;
-
1363 }
-
1364 }
-
1365 }
+
1322
+
+
1323 virtual _Success_(return != 0) size_t write(
+
1324 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
1325 {
+
1326 assert(data || !length);
+
1327 if (!length) _Unlikely_ {
+
1328 // Pass null writes (zero-byte length). Null write operations have special meaning with with Windows pipes.
+
1329 flush_write();
+
1330 if (!ok()) _Unlikely_
+
1331 return 0;
+
1332 m_source->write(nullptr, 0);
+
1333 m_state = m_source->state();
+
1334 return 0;
+
1335 }
+
1336
+
1337 for (size_t to_write = length;;) {
+
1338 size_t available_buffer = m_write_buffer.capacity - m_write_buffer.tail;
+
1339 if (to_write <= available_buffer) {
+
1340 memcpy(m_write_buffer.data + m_write_buffer.tail, data, to_write);
+
1341 m_write_buffer.tail += to_write;
+
1342 m_state = state_t::ok;
+
1343 return length;
+
1344 }
+
1345 if (available_buffer) {
+
1346 memcpy(m_write_buffer.data + m_write_buffer.tail, data, available_buffer);
+
1347 reinterpret_cast<const uint8_t*&>(data) += available_buffer;
+
1348 to_write -= available_buffer;
+
1349 m_write_buffer.tail += available_buffer;
+
1350 }
+
1351 size_t buffer_size = m_write_buffer.tail - m_write_buffer.head;
+
1352 if (buffer_size) {
+
1353 m_write_buffer.head += m_source->write(m_write_buffer.data + m_write_buffer.head, buffer_size);
+
1354 m_state = m_source->state();
+
1355 if (m_write_buffer.head == m_write_buffer.tail)
+
1356 m_write_buffer.head = m_write_buffer.tail = 0;
+
1357 else
+
1358 return length - to_write;
+
1359 }
+
1360 if (to_write > m_write_buffer.capacity) {
+
1361 // When needing to write more data than buffer capacity, bypass the buffer.
+
1362 to_write -= m_source->write(data, to_write);
+
1363 m_state = m_source->state();
+
1364 return length - to_write;
+
1365 }
+
1366 }
+
1367 }
-
1366
-
-
1367 virtual void flush()
-
1368 {
-
1369 flush_write();
-
1370 if (ok())
- -
1372 }
+
1368
+
+
1369 virtual void flush()
+
1370 {
+
1371 flush_write();
+
1372 if (ok())
+ +
1374 }
-
1373
-
1374 protected:
-
1375 void flush_write()
-
1376 {
-
1377 size_t buffer_size = m_write_buffer.tail - m_write_buffer.head;
-
1378 if (buffer_size) {
-
1379 m_write_buffer.head += m_source->write(m_write_buffer.data + m_write_buffer.head, buffer_size);
-
1380 if (m_write_buffer.head == m_write_buffer.tail) {
-
1381 m_write_buffer.head = 0;
-
1382 m_write_buffer.tail = 0;
-
1383 }
-
1384 else {
-
1385 m_state = m_source->state();
-
1386 return;
-
1387 }
-
1388 }
-
1389 m_state = state_t::ok;
-
1390 }
-
1391
-
-
1392 struct buffer_t {
-
1393 uint8_t* data;
-
1394 size_t head, tail, capacity;
-
1395
-
1396 buffer_t(_In_ size_t buffer_size) :
-
1397 head(0),
-
1398 tail(0),
-
1399 capacity(buffer_size),
-
1400 data(buffer_size ? new uint8_t[buffer_size] : nullptr)
-
1401 {}
-
1402
-
1403 ~buffer_t()
-
1404 {
-
1405 if (data)
-
1406 delete[] data;
-
1407 }
-
1408 } m_read_buffer, m_write_buffer;
+
1375
+
1376 protected:
+
1377 void flush_write()
+
1378 {
+
1379 size_t buffer_size = m_write_buffer.tail - m_write_buffer.head;
+
1380 if (buffer_size) {
+
1381 m_write_buffer.head += m_source->write(m_write_buffer.data + m_write_buffer.head, buffer_size);
+
1382 if (m_write_buffer.head == m_write_buffer.tail) {
+
1383 m_write_buffer.head = 0;
+
1384 m_write_buffer.tail = 0;
+
1385 }
+
1386 else {
+
1387 m_state = m_source->state();
+
1388 return;
+
1389 }
+
1390 }
+
1391 m_state = state_t::ok;
+
1392 }
+
1393
+
+
1394 struct buffer_t {
+
1395 uint8_t* data;
+
1396 size_t head, tail, capacity;
+
1397
+
1398 buffer_t(_In_ size_t buffer_size) :
+
1399 head(0),
+
1400 tail(0),
+
1401 capacity(buffer_size),
+
1402 data(buffer_size ? new uint8_t[buffer_size] : nullptr)
+
1403 {}
+
1404
+
1405 ~buffer_t()
+
1406 {
+
1407 if (data)
+
1408 delete[] data;
+
1409 }
+
1410 } m_read_buffer, m_write_buffer;
-
1409 };
+
1411 };
-
1410
-
-
1414 class limiter : public converter
-
1415 {
-
1416 public:
-
1417 limiter(_Inout_ basic& source, _In_ fsize_t _read_limit = 0, _In_ fsize_t _write_limit = 0) :
-
1418 converter(source),
-
1419 read_limit(_read_limit),
-
1420 write_limit(_write_limit)
-
1421 {}
-
1422
-
-
1423 virtual _Success_(return != 0 || length == 0) size_t read(
-
1424 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
1425 {
-
1426 size_t num_read;
-
1427 if (read_limit == fsize_max) {
-
1428 num_read = m_source->read(data, length);
-
1429 m_state = m_source->state();
-
1430 }
-
1431 else if (length <= read_limit) {
-
1432 num_read = m_source->read(data, length);
-
1433 m_state = m_source->state();
-
1434 read_limit -= num_read;
-
1435 }
-
1436 else if (length && !read_limit) {
-
1437 num_read = 0;
-
1438 m_state = state_t::eof;
-
1439 }
-
1440 else {
-
1441 num_read = m_source->read(data, static_cast<size_t>(read_limit));
-
1442 m_state = m_source->state();
-
1443 read_limit -= num_read;
-
1444 }
-
1445 return num_read;
-
1446 }
+
1412
+
+
1416 class limiter : public converter
+
1417 {
+
1418 public:
+
1419 limiter(_Inout_ basic& source, _In_ fsize_t _read_limit = 0, _In_ fsize_t _write_limit = 0) :
+
1420 converter(source),
+
1421 read_limit(_read_limit),
+
1422 write_limit(_write_limit)
+
1423 {}
+
1424
+
+
1425 virtual _Success_(return != 0 || length == 0) size_t read(
+
1426 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
1427 {
+
1428 size_t num_read;
+
1429 if (read_limit == fsize_max) {
+
1430 num_read = m_source->read(data, length);
+
1431 m_state = m_source->state();
+
1432 }
+
1433 else if (length <= read_limit) {
+
1434 num_read = m_source->read(data, length);
+
1435 m_state = m_source->state();
+
1436 read_limit -= num_read;
+
1437 }
+
1438 else if (length && !read_limit) {
+
1439 num_read = 0;
+
1440 m_state = state_t::eof;
+
1441 }
+
1442 else {
+
1443 num_read = m_source->read(data, static_cast<size_t>(read_limit));
+
1444 m_state = m_source->state();
+
1445 read_limit -= num_read;
+
1446 }
+
1447 return num_read;
+
1448 }
-
1447
-
-
1448 virtual _Success_(return != 0) size_t write(
-
1449 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
1450 {
-
1451 size_t num_written;
-
1452 if (write_limit == fsize_max) {
-
1453 num_written = m_source->write(data, length);
-
1454 m_state = m_source->state();
-
1455 }
-
1456 else if (length <= write_limit) {
-
1457 num_written = m_source->write(data, length);
-
1458 m_state = m_source->state();
-
1459 write_limit -= num_written;
-
1460 }
-
1461 else if (length && !write_limit) {
-
1462 num_written = 0;
-
1463 m_state = state_t::fail;
-
1464 }
-
1465 else {
-
1466 num_written = m_source->write(data, static_cast<size_t>(write_limit));
-
1467 m_state = m_source->state();
-
1468 write_limit -= num_written;
-
1469 }
-
1470 return num_written;
-
1471 }
+
1449
+
+
1450 virtual _Success_(return != 0) size_t write(
+
1451 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
1452 {
+
1453 size_t num_written;
+
1454 if (write_limit == fsize_max) {
+
1455 num_written = m_source->write(data, length);
+
1456 m_state = m_source->state();
+
1457 }
+
1458 else if (length <= write_limit) {
+
1459 num_written = m_source->write(data, length);
+
1460 m_state = m_source->state();
+
1461 write_limit -= num_written;
+
1462 }
+
1463 else if (length && !write_limit) {
+
1464 num_written = 0;
+
1465 m_state = state_t::fail;
+
1466 }
+
1467 else {
+
1468 num_written = m_source->write(data, static_cast<size_t>(write_limit));
+
1469 m_state = m_source->state();
+
1470 write_limit -= num_written;
+
1471 }
+
1472 return num_written;
+
1473 }
-
1472
-
1473 public:
-
1474 fsize_t
- - -
1477 };
+
1474
+
1475 public:
+
1476 fsize_t
+ + +
1479 };
-
1478
-
-
1482 class window : public limiter
-
1483 {
-
1484 public:
-
1485 window(_Inout_ basic& source, _In_ fpos_t _read_offset = 0, _In_ fsize_t read_limit = fsize_max, _In_ fpos_t _write_offset = 0, _In_ fsize_t write_limit = fsize_max) :
-
1486 limiter(source, read_limit, write_limit),
-
1487 read_offset(_read_offset),
-
1488 write_offset(_write_offset)
-
1489 {}
-
1490
-
-
1491 virtual _Success_(return != 0 || length == 0) size_t read(
-
1492 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
1493 {
-
1494 if (read_offset) {
-
1495 m_source->skip(read_offset);
-
1496 m_state = m_source->state();
-
1497 if (!ok()) _Unlikely_
-
1498 return 0;
-
1499 read_offset = 0;
-
1500 }
-
1501 size_t num_read;
-
1502 if (read_limit == fsize_max) {
-
1503 num_read = m_source->read(data, length);
-
1504 m_state = m_source->state();
-
1505 }
-
1506 else if (length <= read_limit) {
-
1507 num_read = m_source->read(data, length);
-
1508 m_state = m_source->state();
-
1509 read_limit -= num_read;
-
1510 }
-
1511 else if (length && !read_limit) {
-
1512 num_read = 0;
-
1513 m_source->skip(length);
-
1514 m_state = state_t::eof;
-
1515 }
-
1516 else {
-
1517 num_read = m_source->read(data, static_cast<size_t>(read_limit));
-
1518 m_state = m_source->state();
-
1519 read_limit -= num_read;
-
1520 }
-
1521 return num_read;
-
1522 }
+
1480
+
+
1484 class window : public limiter
+
1485 {
+
1486 public:
+
1487 window(_Inout_ basic& source, _In_ fpos_t _read_offset = 0, _In_ fsize_t read_limit = fsize_max, _In_ fpos_t _write_offset = 0, _In_ fsize_t write_limit = fsize_max) :
+
1488 limiter(source, read_limit, write_limit),
+
1489 read_offset(_read_offset),
+
1490 write_offset(_write_offset)
+
1491 {}
+
1492
+
+
1493 virtual _Success_(return != 0 || length == 0) size_t read(
+
1494 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
1495 {
+
1496 if (read_offset) {
+
1497 m_source->skip(read_offset);
+
1498 m_state = m_source->state();
+
1499 if (!ok()) _Unlikely_
+
1500 return 0;
+
1501 read_offset = 0;
+
1502 }
+
1503 size_t num_read;
+
1504 if (read_limit == fsize_max) {
+
1505 num_read = m_source->read(data, length);
+
1506 m_state = m_source->state();
+
1507 }
+
1508 else if (length <= read_limit) {
+
1509 num_read = m_source->read(data, length);
+
1510 m_state = m_source->state();
+
1511 read_limit -= num_read;
+
1512 }
+
1513 else if (length && !read_limit) {
+
1514 num_read = 0;
+
1515 m_source->skip(length);
+
1516 m_state = state_t::eof;
+
1517 }
+
1518 else {
+
1519 num_read = m_source->read(data, static_cast<size_t>(read_limit));
+
1520 m_state = m_source->state();
+
1521 read_limit -= num_read;
+
1522 }
+
1523 return num_read;
+
1524 }
-
1523
-
-
1524 virtual _Success_(return != 0) size_t write(
-
1525 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
1526 {
-
1527 size_t num_skipped, num_written;
-
1528 if (length <= write_offset) {
-
1529 write_offset -= length;
-
1530 m_state = state_t::ok;
-
1531 return length;
-
1532 }
-
1533 if (write_offset) {
-
1534 reinterpret_cast<const uint8_t*&>(data) += static_cast<size_t>(write_offset);
-
1535 length -= static_cast<size_t>(write_offset);
-
1536 num_skipped = static_cast<size_t>(write_offset);
-
1537 write_offset = 0;
-
1538 }
-
1539 else
-
1540 num_skipped = 0;
-
1541 if (write_limit == fsize_max) {
-
1542 num_written = m_source->write(data, length);
-
1543 m_state = m_source->state();
-
1544 }
-
1545 else if (length <= write_limit) {
-
1546 num_written = m_source->write(data, length);
-
1547 m_state = m_source->state();
-
1548 write_limit -= num_written;
-
1549 }
-
1550 else if (length && !write_limit) {
-
1551 num_skipped += length;
-
1552 num_written = 0;
-
1553 m_state = state_t::ok;
-
1554 }
-
1555 else {
-
1556 num_skipped += length - static_cast<size_t>(write_limit);
-
1557 num_written = m_source->write(data, static_cast<size_t>(write_limit));
-
1558 m_state = m_source->state();
-
1559 write_limit -= num_written;
-
1560 }
-
1561 return num_skipped + num_written;
-
1562 }
+
1525
+
+
1526 virtual _Success_(return != 0) size_t write(
+
1527 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
1528 {
+
1529 size_t num_skipped, num_written;
+
1530 if (length <= write_offset) {
+
1531 write_offset -= length;
+
1532 m_state = state_t::ok;
+
1533 return length;
+
1534 }
+
1535 if (write_offset) {
+
1536 reinterpret_cast<const uint8_t*&>(data) += static_cast<size_t>(write_offset);
+
1537 length -= static_cast<size_t>(write_offset);
+
1538 num_skipped = static_cast<size_t>(write_offset);
+
1539 write_offset = 0;
+
1540 }
+
1541 else
+
1542 num_skipped = 0;
+
1543 if (write_limit == fsize_max) {
+
1544 num_written = m_source->write(data, length);
+
1545 m_state = m_source->state();
+
1546 }
+
1547 else if (length <= write_limit) {
+
1548 num_written = m_source->write(data, length);
+
1549 m_state = m_source->state();
+
1550 write_limit -= num_written;
+
1551 }
+
1552 else if (length && !write_limit) {
+
1553 num_skipped += length;
+
1554 num_written = 0;
+
1555 m_state = state_t::ok;
+
1556 }
+
1557 else {
+
1558 num_skipped += length - static_cast<size_t>(write_limit);
+
1559 num_written = m_source->write(data, static_cast<size_t>(write_limit));
+
1560 m_state = m_source->state();
+
1561 write_limit -= num_written;
+
1562 }
+
1563 return num_skipped + num_written;
+
1564 }
-
1563
-
1564 public:
-
1565 fpos_t
- - -
1568 };
+
1565
+
1566 public:
+
1567 fpos_t
+ + +
1570 };
-
1569
-
- -
1574 {
-
1575 public:
-
1576 file_window(_Inout_ basic_file& source, fpos_t offset = 0, fsize_t length = 0) :
-
1577 basic(source.state()),
-
1578 m_source(source),
-
1579 m_offset(source.tell()),
-
1580 m_region(offset, offset + length)
-
1581 {}
-
1582
-
-
1583 virtual _Success_(return != 0 || length == 0) size_t read(
-
1584 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
1585 {
-
1586 assert(data || !length);
-
1587 if (m_region.contains(m_offset)) {
-
1588 size_t num_read = m_source.read(data, static_cast<size_t>(std::min<fpos_t>(length, m_region.end - m_offset)));
-
1589 m_state = m_source.state();
-
1590 m_offset += num_read;
-
1591 return num_read;
-
1592 }
-
1593 m_state = length ? state_t::eof : state_t::ok;
-
1594 return 0;
-
1595 }
+
1571
+
+ +
1576 {
+
1577 public:
+
1578 file_window(_Inout_ basic_file& source, fpos_t offset = 0, fsize_t length = 0) :
+
1579 basic(source.state()),
+
1580 m_source(source),
+
1581 m_offset(source.tell()),
+
1582 m_region(offset, offset + length)
+
1583 {}
+
1584
+
+
1585 virtual _Success_(return != 0 || length == 0) size_t read(
+
1586 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
1587 {
+
1588 assert(data || !length);
+
1589 if (m_region.contains(m_offset)) {
+
1590 size_t num_read = m_source.read(data, static_cast<size_t>(std::min<fpos_t>(length, m_region.end - m_offset)));
+
1591 m_state = m_source.state();
+
1592 m_offset += num_read;
+
1593 return num_read;
+
1594 }
+
1595 m_state = length ? state_t::eof : state_t::ok;
+
1596 return 0;
+
1597 }
-
1596
-
-
1597 virtual _Success_(return != 0) size_t write(
-
1598 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
1599 {
-
1600 assert(data || !length);
-
1601 if (m_region.contains(m_offset)) {
-
1602 size_t num_written = m_source.write(data, static_cast<size_t>(std::min<fpos_t>(length, m_region.end - m_offset)));
-
1603 m_state = m_source.state();
-
1604 m_offset += num_written;
-
1605 return num_written;
-
1606 }
-
1607 m_state = state_t::fail;
-
1608 return 0;
-
1609 }
+
1598
+
+
1599 virtual _Success_(return != 0) size_t write(
+
1600 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
1601 {
+
1602 assert(data || !length);
+
1603 if (m_region.contains(m_offset)) {
+
1604 size_t num_written = m_source.write(data, static_cast<size_t>(std::min<fpos_t>(length, m_region.end - m_offset)));
+
1605 m_state = m_source.state();
+
1606 m_offset += num_written;
+
1607 return num_written;
+
1608 }
+
1609 m_state = state_t::fail;
+
1610 return 0;
+
1611 }
-
1610
-
-
1611 virtual void close()
-
1612 {
-
1613 m_source.close();
-
1614 m_state = m_source.state();
-
1615 }
+
1612
+
+
1613 virtual void close()
+
1614 {
+
1615 m_source.close();
+
1616 m_state = m_source.state();
+
1617 }
-
1616
-
-
1617 virtual void flush()
-
1618 {
-
1619 m_source.flush();
-
1620 m_state = m_source.state();
-
1621 }
+
1618
+
+
1619 virtual void flush()
+
1620 {
+
1621 m_source.flush();
+
1622 m_state = m_source.state();
+
1623 }
-
1622
-
-
1623 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
1624 {
-
1625 m_offset = m_source.seek(offset, how);
-
1626 m_state = m_source.state();
-
1627 return ok() ? m_offset - m_region.start : fpos_max;
-
1628 }
+
1624
+
+
1625 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
1626 {
+
1627 m_offset = m_source.seek(offset, how);
+
1628 m_state = m_source.state();
+
1629 return ok() ? m_offset - m_region.start : fpos_max;
+
1630 }
-
1629
-
-
1630 virtual void skip(_In_ fsize_t amount)
-
1631 {
-
1632 m_source.skip(amount);
-
1633 m_state = m_source.state();
-
1634 }
+
1631
+
+
1632 virtual void skip(_In_ fsize_t amount)
+
1633 {
+
1634 m_source.skip(amount);
+
1635 m_state = m_source.state();
+
1636 }
-
1635
-
-
1636 virtual fpos_t tell() const
-
1637 {
-
1638 fpos_t offset = m_source.tell();
-
1639 return m_region.contains(offset) ? offset - m_region.start : fpos_max;
-
1640 }
+
1637
+
+
1638 virtual fpos_t tell() const
+
1639 {
+
1640 fpos_t offset = m_source.tell();
+
1641 return m_region.contains(offset) ? offset - m_region.start : fpos_max;
+
1642 }
-
1641
-
-
1642 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
-
1643 {
-
1644 if (m_region.contains(offset)) {
-
1645 m_source.lock(m_region.start + offset, std::min<fsize_t>(length, m_region.end - offset));
-
1646 m_state = m_source.state();
-
1647 }
-
1648 else
-
1649 m_state = state_t::fail;
-
1650 }
+
1643
+
+
1644 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
+
1645 {
+
1646 if (m_region.contains(offset)) {
+
1647 m_source.lock(m_region.start + offset, std::min<fsize_t>(length, m_region.end - offset));
+
1648 m_state = m_source.state();
+
1649 }
+
1650 else
+
1651 m_state = state_t::fail;
+
1652 }
-
1651
-
-
1652 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
-
1653 {
-
1654 if (m_region.contains(offset)) {
-
1655 m_source.unlock(m_region.start + offset, std::min<fsize_t>(length, m_region.end - offset));
-
1656 m_state = m_source.state();
-
1657 }
-
1658 else
-
1659 m_state = state_t::fail;
-
1660 }
+
1653
+
+
1654 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
+
1655 {
+
1656 if (m_region.contains(offset)) {
+
1657 m_source.unlock(m_region.start + offset, std::min<fsize_t>(length, m_region.end - offset));
+
1658 m_state = m_source.state();
+
1659 }
+
1660 else
+
1661 m_state = state_t::fail;
+
1662 }
-
1661
-
-
1662 virtual fsize_t size()
-
1663 {
-
1664 return m_region.size();
-
1665 }
+
1663
+
+
1664 virtual fsize_t size()
+
1665 {
+
1666 return m_region.size();
+
1667 }
-
1666
-
-
1667 virtual void truncate()
-
1668 {
-
1669 m_state = state_t::fail;
-
1670 }
+
1668
+
+
1669 virtual void truncate()
+
1670 {
+
1671 m_state = state_t::fail;
+
1672 }
-
1671
-
1672 protected:
-
1673 basic_file& m_source;
-
1674 fpos_t m_offset;
-
1675 interval<fpos_t> m_region;
-
1676 };
+
1673
+
1674 protected:
+
1675 basic_file& m_source;
+
1676 fpos_t m_offset;
+
1677 interval<fpos_t> m_region;
+
1678 };
-
1677
-
1678 constexpr size_t default_cache_size = 0x1000;
1679
-
-
1683 class cache : public basic_file
-
1684 {
-
1685 protected:
-
1686 explicit cache(_In_ size_t cache_size = default_cache_size) :
-
1687 basic(state_t::fail),
-
1688 m_source(nullptr),
-
1689 m_cache(cache_size),
-
1690 m_offset(0)
-
1691#if SET_FILE_OP_TIMES
-
1692 , m_atime(time_point::min()),
-
1693 m_mtime(time_point::min())
-
1694#endif
-
1695 {}
-
1696
-
1697 void init(_Inout_ basic_file& source)
-
1698 {
-
1699 m_state = source.state();
-
1700 m_source = &source;
-
1701 m_offset = source.tell();
-
1702#if SET_FILE_OP_TIMES
-
1703 m_atime = source.atime();
-
1704 m_mtime = source.mtime();
-
1705#endif
-
1706 }
-
1707
-
1708 void done()
-
1709 {
-
1710 if (m_source) {
-
1711 flush_cache();
-
1712 if (!ok()) _Unlikely_
-
1713 throw std::runtime_error("cache flush failed"); // Data loss occured
-
1714 m_source->seek(m_offset);
-
1715 m_source = nullptr;
-
1716 }
-
1717 }
-
1718
-
1719 public:
-
1720 cache(_Inout_ basic_file& source, _In_ size_t cache_size = default_cache_size) :
-
1721 basic(source.state()),
-
1722 m_source(&source),
-
1723 m_cache(cache_size),
-
1724 m_offset(source.tell())
-
1725#if SET_FILE_OP_TIMES
-
1726 , m_atime(source.atime()),
-
1727 m_mtime(source.mtime())
-
1728#endif
-
1729 {}
-
1730
-
1731 virtual ~cache() noexcept(false)
-
1732 {
-
1733 if (m_source) {
-
1734 flush_cache();
-
1735 if (!ok()) _Unlikely_
-
1736 throw std::runtime_error("cache flush failed"); // Data loss occured
-
1737 m_source->seek(m_offset);
-
1738 }
-
1739 }
-
1740
-
-
1741 virtual _Success_(return != 0 || length == 0) size_t read(
-
1742 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
1743 {
-
1744 assert(data || !length);
-
1745#if SET_FILE_OP_TIMES
-
1746 m_atime = time_point::now();
-
1747#endif
-
1748 for (size_t to_read = length;;) {
-
1749 if (m_cache.status != cache_t::cache_t::status_t::empty) {
-
1750 if (m_cache.region.contains(m_offset)) {
-
1751 size_t remaining_cache = static_cast<size_t>(m_cache.region.end - m_offset);
-
1752 if (to_read <= remaining_cache) {
-
1753 memcpy(data, m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), to_read);
-
1754 m_offset += to_read;
-
1755 m_state = state_t::ok;
-
1756 return length;
-
1757 }
-
1758 memcpy(data, m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), remaining_cache);
-
1759 reinterpret_cast<uint8_t*&>(data) += remaining_cache;
-
1760 to_read -= remaining_cache;
-
1761 m_offset += remaining_cache;
-
1762 }
-
1763 flush_cache();
-
1764 if (!ok()) _Unlikely_ {
-
1765 if (to_read < length)
-
1766 m_state = state_t::ok;
-
1767 return length - to_read;
-
1768 }
-
1769 }
-
1770 {
-
1771 fpos_t end_max = m_offset + to_read;
-
1772 if (m_offset / m_cache.capacity < end_max / m_cache.capacity) {
-
1773 // Read spans multiple cache blocks. Bypass cache to the last block.
-
1774 m_source->seek(m_offset);
-
1775 if (!m_source->ok()) _Unlikely_ {
-
1776 m_state = to_read < length ? state_t::ok : state_t::fail;
-
1777 return length - to_read;
-
1778 }
-
1779 size_t num_read = m_source->read(data, to_read - static_cast<size_t>(end_max % m_cache.capacity));
-
1780 m_offset += num_read;
-
1781 to_read -= num_read;
-
1782 if (!to_read) {
-
1783 m_state = state_t::ok;
-
1784 return length;
-
1785 }
-
1786 reinterpret_cast<uint8_t*&>(data) += num_read;
-
1787 m_state = m_source->state();
-
1788 if (!ok()) {
-
1789 if (to_read < length)
-
1790 m_state = state_t::ok;
-
1791 return length - to_read;
-
1792 }
-
1793 }
-
1794 }
-
1795 load_cache(m_offset);
-
1796 if (!ok() || m_cache.region.end <= m_offset) _Unlikely_ {
-
1797 m_state = to_read < length ? state_t::ok : state_t::fail;
-
1798 return length - to_read;
-
1799 }
-
1800 }
-
1801 }
+
1680 constexpr size_t default_cache_size = 0x1000;
+
1681
+
+
1685 class cache : public basic_file
+
1686 {
+
1687 protected:
+
1688 explicit cache(_In_ size_t cache_size = default_cache_size) :
+
1689 basic(state_t::fail),
+
1690 m_source(nullptr),
+
1691 m_cache(cache_size),
+
1692 m_offset(0)
+
1693#if SET_FILE_OP_TIMES
+
1694 , m_atime(time_point::min()),
+
1695 m_mtime(time_point::min())
+
1696#endif
+
1697 {}
+
1698
+
1699 void init(_Inout_ basic_file& source)
+
1700 {
+
1701 m_state = source.state();
+
1702 m_source = &source;
+
1703 m_offset = source.tell();
+
1704#if SET_FILE_OP_TIMES
+
1705 m_atime = source.atime();
+
1706 m_mtime = source.mtime();
+
1707#endif
+
1708 }
+
1709
+
1710 void done()
+
1711 {
+
1712 if (m_source) {
+
1713 flush_cache();
+
1714 if (!ok()) _Unlikely_
+
1715 throw std::runtime_error("cache flush failed"); // Data loss occured
+
1716 m_source->seek(m_offset);
+
1717 m_source = nullptr;
+
1718 }
+
1719 }
+
1720
+
1721 public:
+
1722 cache(_Inout_ basic_file& source, _In_ size_t cache_size = default_cache_size) :
+
1723 basic(source.state()),
+
1724 m_source(&source),
+
1725 m_cache(cache_size),
+
1726 m_offset(source.tell())
+
1727#if SET_FILE_OP_TIMES
+
1728 , m_atime(source.atime()),
+
1729 m_mtime(source.mtime())
+
1730#endif
+
1731 {}
+
1732
+
1733 virtual ~cache() noexcept(false)
+
1734 {
+
1735 if (m_source) {
+
1736 flush_cache();
+
1737 if (!ok()) _Unlikely_
+
1738 throw std::runtime_error("cache flush failed"); // Data loss occured
+
1739 m_source->seek(m_offset);
+
1740 }
+
1741 }
+
1742
+
+
1743 virtual _Success_(return != 0 || length == 0) size_t read(
+
1744 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
1745 {
+
1746 assert(data || !length);
+
1747#if SET_FILE_OP_TIMES
+
1748 m_atime = time_point::now();
+
1749#endif
+
1750 for (size_t to_read = length;;) {
+
1751 if (m_cache.status != cache_t::cache_t::status_t::empty) {
+
1752 if (m_cache.region.contains(m_offset)) {
+
1753 size_t remaining_cache = static_cast<size_t>(m_cache.region.end - m_offset);
+
1754 if (to_read <= remaining_cache) {
+
1755 memcpy(data, m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), to_read);
+
1756 m_offset += to_read;
+
1757 m_state = state_t::ok;
+
1758 return length;
+
1759 }
+
1760 memcpy(data, m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), remaining_cache);
+
1761 reinterpret_cast<uint8_t*&>(data) += remaining_cache;
+
1762 to_read -= remaining_cache;
+
1763 m_offset += remaining_cache;
+
1764 }
+
1765 flush_cache();
+
1766 if (!ok()) _Unlikely_ {
+
1767 if (to_read < length)
+
1768 m_state = state_t::ok;
+
1769 return length - to_read;
+
1770 }
+
1771 }
+
1772 {
+
1773 fpos_t end_max = m_offset + to_read;
+
1774 if (m_offset / m_cache.capacity < end_max / m_cache.capacity) {
+
1775 // Read spans multiple cache blocks. Bypass cache to the last block.
+
1776 m_source->seek(m_offset);
+
1777 if (!m_source->ok()) _Unlikely_ {
+
1778 m_state = to_read < length ? state_t::ok : state_t::fail;
+
1779 return length - to_read;
+
1780 }
+
1781 size_t num_read = m_source->read(data, to_read - static_cast<size_t>(end_max % m_cache.capacity));
+
1782 m_offset += num_read;
+
1783 to_read -= num_read;
+
1784 if (!to_read) {
+
1785 m_state = state_t::ok;
+
1786 return length;
+
1787 }
+
1788 reinterpret_cast<uint8_t*&>(data) += num_read;
+
1789 m_state = m_source->state();
+
1790 if (!ok()) {
+
1791 if (to_read < length)
+
1792 m_state = state_t::ok;
+
1793 return length - to_read;
+
1794 }
+
1795 }
+
1796 }
+
1797 load_cache(m_offset);
+
1798 if (!ok() || m_cache.region.end <= m_offset) _Unlikely_ {
+
1799 m_state = to_read < length ? state_t::ok : state_t::fail;
+
1800 return length - to_read;
+
1801 }
+
1802 }
+
1803 }
-
1802
-
-
1803 virtual _Success_(return != 0) size_t write(
-
1804 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
1805 {
-
1806 assert(data || !length);
-
1807#if SET_FILE_OP_TIMES
-
1808 m_atime = m_mtime = time_point::now();
-
1809#endif
-
1810 for (size_t to_write = length;;) {
-
1811 if (m_cache.status != cache_t::cache_t::status_t::empty) {
-
1812 fpos_t end_max = m_cache.region.start + m_cache.capacity;
-
1813 if (m_cache.region.start <= m_offset && m_offset < end_max) {
-
1814 size_t remaining_cache = static_cast<size_t>(end_max - m_offset);
-
1815 if (to_write <= remaining_cache) {
-
1816 memcpy(m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), data, to_write);
-
1817 m_offset += to_write;
-
1818 m_cache.status = cache_t::cache_t::status_t::dirty;
-
1819 m_cache.region.end = std::max(m_cache.region.end, m_offset);
-
1820 m_state = state_t::ok;
-
1821 return length;
-
1822 }
-
1823 memcpy(m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), data, remaining_cache);
-
1824 reinterpret_cast<const uint8_t*&>(data) += remaining_cache;
-
1825 to_write -= remaining_cache;
-
1826 m_offset += remaining_cache;
-
1827 m_cache.status = cache_t::cache_t::status_t::dirty;
-
1828 m_cache.region.end = end_max;
-
1829 }
-
1830 flush_cache();
-
1831 if (!ok()) _Unlikely_
-
1832 return length - to_write;
-
1833 }
-
1834 {
-
1835 fpos_t end_max = m_offset + to_write;
-
1836 if (m_offset / m_cache.capacity < end_max / m_cache.capacity) {
-
1837 // Write spans multiple cache blocks. Bypass cache to the last block.
-
1838 m_source->seek(m_offset);
-
1839 if (!ok()) _Unlikely_
-
1840 return length - to_write;
-
1841 size_t num_written = m_source->write(data, to_write - static_cast<size_t>(end_max % m_cache.capacity));
-
1842 m_offset += num_written;
-
1843 m_state = m_source->state();
-
1844 to_write -= num_written;
-
1845 if (!to_write || !ok())
-
1846 return length - to_write;
-
1847 reinterpret_cast<const uint8_t*&>(data) += num_written;
-
1848 }
-
1849 }
-
1850 load_cache(m_offset);
-
1851 if (!ok()) _Unlikely_
-
1852 return length - to_write;
-
1853 }
-
1854 }
+
1804
+
+
1805 virtual _Success_(return != 0) size_t write(
+
1806 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
1807 {
+
1808 assert(data || !length);
+
1809#if SET_FILE_OP_TIMES
+
1810 m_atime = m_mtime = time_point::now();
+
1811#endif
+
1812 for (size_t to_write = length;;) {
+
1813 if (m_cache.status != cache_t::cache_t::status_t::empty) {
+
1814 fpos_t end_max = m_cache.region.start + m_cache.capacity;
+
1815 if (m_cache.region.start <= m_offset && m_offset < end_max) {
+
1816 size_t remaining_cache = static_cast<size_t>(end_max - m_offset);
+
1817 if (to_write <= remaining_cache) {
+
1818 memcpy(m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), data, to_write);
+
1819 m_offset += to_write;
+
1820 m_cache.status = cache_t::cache_t::status_t::dirty;
+
1821 m_cache.region.end = std::max(m_cache.region.end, m_offset);
+
1822 m_state = state_t::ok;
+
1823 return length;
+
1824 }
+
1825 memcpy(m_cache.data + static_cast<size_t>(m_offset - m_cache.region.start), data, remaining_cache);
+
1826 reinterpret_cast<const uint8_t*&>(data) += remaining_cache;
+
1827 to_write -= remaining_cache;
+
1828 m_offset += remaining_cache;
+
1829 m_cache.status = cache_t::cache_t::status_t::dirty;
+
1830 m_cache.region.end = end_max;
+
1831 }
+
1832 flush_cache();
+
1833 if (!ok()) _Unlikely_
+
1834 return length - to_write;
+
1835 }
+
1836 {
+
1837 fpos_t end_max = m_offset + to_write;
+
1838 if (m_offset / m_cache.capacity < end_max / m_cache.capacity) {
+
1839 // Write spans multiple cache blocks. Bypass cache to the last block.
+
1840 m_source->seek(m_offset);
+
1841 if (!ok()) _Unlikely_
+
1842 return length - to_write;
+
1843 size_t num_written = m_source->write(data, to_write - static_cast<size_t>(end_max % m_cache.capacity));
+
1844 m_offset += num_written;
+
1845 m_state = m_source->state();
+
1846 to_write -= num_written;
+
1847 if (!to_write || !ok())
+
1848 return length - to_write;
+
1849 reinterpret_cast<const uint8_t*&>(data) += num_written;
+
1850 }
+
1851 }
+
1852 load_cache(m_offset);
+
1853 if (!ok()) _Unlikely_
+
1854 return length - to_write;
+
1855 }
+
1856 }
-
1855
-
-
1856 virtual void close()
-
1857 {
-
1858 invalidate_cache();
-
1859 if (!ok()) _Unlikely_
-
1860 throw std::runtime_error("cache flush failed"); // Data loss occured
-
1861 m_source->close();
-
1862 m_state = m_source->state();
-
1863 }
+
1857
+
+
1858 virtual void close()
+
1859 {
+
1860 invalidate_cache();
+
1861 if (!ok()) _Unlikely_
+
1862 throw std::runtime_error("cache flush failed"); // Data loss occured
+
1863 m_source->close();
+
1864 m_state = m_source->state();
+
1865 }
-
1864
-
-
1865 virtual void flush()
-
1866 {
-
1867#if SET_FILE_OP_TIMES
-
1868 m_atime = m_mtime = time_point::min();
-
1869#endif
-
1870 flush_cache();
-
1871 if (!ok()) _Unlikely_
-
1872 return;
-
1873 m_source->flush();
-
1874 }
+
1866
+
+
1867 virtual void flush()
+
1868 {
+
1869#if SET_FILE_OP_TIMES
+
1870 m_atime = m_mtime = time_point::min();
+
1871#endif
+
1872 flush_cache();
+
1873 if (!ok()) _Unlikely_
+
1874 return;
+
1875 m_source->flush();
+
1876 }
-
1875
-
-
1876 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
1877 {
-
1878 m_state = state_t::ok;
-
1879 switch (how) {
-
1880 case seek_t::beg:
-
1881 return m_offset = offset;
-
1882 case seek_t::cur:
-
1883 return m_offset += offset;
-
1884 case seek_t::end:
-
1885 return m_offset = size() + offset;
-
1886 default:
-
1887 throw std::invalid_argument("unknown seek origin");
-
1888 }
-
1889 }
+
1877
+
+
1878 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
1879 {
+
1880 m_state = state_t::ok;
+
1881 switch (how) {
+
1882 case seek_t::beg:
+
1883 return m_offset = offset;
+
1884 case seek_t::cur:
+
1885 return m_offset += offset;
+
1886 case seek_t::end:
+
1887 return m_offset = size() + offset;
+
1888 default:
+
1889 throw std::invalid_argument("unknown seek origin");
+
1890 }
+
1891 }
-
1890
-
-
1891 virtual fpos_t tell() const
-
1892 {
-
1893 return m_offset;
-
1894 }
+
1892
+
+
1893 virtual fpos_t tell() const
+
1894 {
+
1895 return m_offset;
+
1896 }
-
1895
-
-
1896 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
-
1897 {
-
1898 m_source->lock(offset, length);
-
1899 m_state = m_source->state();
-
1900 }
+
1897
+
+
1898 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
+
1899 {
+
1900 m_source->lock(offset, length);
+
1901 m_state = m_source->state();
+
1902 }
-
1901
-
-
1902 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
-
1903 {
-
1904 m_source->unlock(offset, length);
-
1905 m_state = m_source->state();
-
1906 }
+
1903
+
+
1904 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
+
1905 {
+
1906 m_source->unlock(offset, length);
+
1907 m_state = m_source->state();
+
1908 }
-
1907
-
-
1908 virtual fsize_t size()
-
1909 {
-
1910 return m_cache.status != cache_t::cache_t::status_t::empty ?
-
1911 std::max(m_source->size(), m_cache.region.end) :
-
1912 m_source->size();
-
1913 }
+
1909
+
+
1910 virtual fsize_t size()
+
1911 {
+
1912 return m_cache.status != cache_t::cache_t::status_t::empty ?
+
1913 std::max(m_source->size(), m_cache.region.end) :
+
1914 m_source->size();
+
1915 }
-
1914
-
-
1915 virtual void truncate()
-
1916 {
-
1917#if SET_FILE_OP_TIMES
-
1918 m_atime = m_mtime = time_point::now();
-
1919#endif
-
1920 m_source->seek(m_offset);
-
1921 if (m_cache.region.end <= m_offset) {
-
1922 // Truncation does not affect cache.
-
1923 }
-
1924 else if (m_cache.region.start <= m_offset) {
-
1925 // Truncation truncates cache.
-
1926 m_cache.region.end = m_offset;
-
1927 }
-
1928 else {
-
1929 // Truncation invalidates cache.
-
1930 m_cache.status = cache_t::cache_t::status_t::empty;
-
1931 }
-
1932 m_source->truncate();
-
1933 m_state = m_source->state();
-
1934 }
+
1916
+
+
1917 virtual void truncate()
+
1918 {
+
1919#if SET_FILE_OP_TIMES
+
1920 m_atime = m_mtime = time_point::now();
+
1921#endif
+
1922 m_source->seek(m_offset);
+
1923 if (m_cache.region.end <= m_offset) {
+
1924 // Truncation does not affect cache.
+
1925 }
+
1926 else if (m_cache.region.start <= m_offset) {
+
1927 // Truncation truncates cache.
+
1928 m_cache.region.end = m_offset;
+
1929 }
+
1930 else {
+
1931 // Truncation invalidates cache.
+
1932 m_cache.status = cache_t::cache_t::status_t::empty;
+
1933 }
+
1934 m_source->truncate();
+
1935 m_state = m_source->state();
+
1936 }
-
1935
-
-
1936 virtual time_point ctime() const
-
1937 {
-
1938 return m_source->ctime();
-
1939 }
+
1937
+
+
1938 virtual time_point ctime() const
+
1939 {
+
1940 return m_source->ctime();
+
1941 }
-
1940
-
-
1941 virtual time_point atime() const
-
1942 {
-
1943#if SET_FILE_OP_TIMES
-
1944 return std::max(m_atime, m_source->atime());
-
1945#else
-
1946 return m_source->atime();
-
1947#endif
-
1948 }
+
1942
+
+
1943 virtual time_point atime() const
+
1944 {
+
1945#if SET_FILE_OP_TIMES
+
1946 return std::max(m_atime, m_source->atime());
+
1947#else
+
1948 return m_source->atime();
+
1949#endif
+
1950 }
-
1949
-
-
1950 virtual time_point mtime() const
-
1951 {
-
1952#if SET_FILE_OP_TIMES
-
1953 return std::max(m_mtime, m_source->mtime());
-
1954#else
-
1955 return m_source->mtime();
-
1956#endif
-
1957 }
+
1951
+
+
1952 virtual time_point mtime() const
+
1953 {
+
1954#if SET_FILE_OP_TIMES
+
1955 return std::max(m_mtime, m_source->mtime());
+
1956#else
+
1957 return m_source->mtime();
+
1958#endif
+
1959 }
-
1958
-
-
1959 virtual void set_ctime(time_point date)
-
1960 {
-
1961 m_source->set_ctime(date);
-
1962 }
+
1960
+
+
1961 virtual void set_ctime(time_point date)
+
1962 {
+
1963 m_source->set_ctime(date);
+
1964 }
-
1963
-
-
1964 virtual void set_atime(time_point date)
-
1965 {
-
1966#if SET_FILE_OP_TIMES
-
1967 m_atime = date;
-
1968#endif
-
1969 m_source->set_atime(date);
-
1970 }
+
1965
+
+
1966 virtual void set_atime(time_point date)
+
1967 {
+
1968#if SET_FILE_OP_TIMES
+
1969 m_atime = date;
+
1970#endif
+
1971 m_source->set_atime(date);
+
1972 }
-
1971
-
-
1972 virtual void set_mtime(time_point date)
-
1973 {
-
1974#if SET_FILE_OP_TIMES
-
1975 m_mtime = date;
-
1976#endif
-
1977 m_source->set_mtime(date);
-
1978 }
+
1973
+
+
1974 virtual void set_mtime(time_point date)
+
1975 {
+
1976#if SET_FILE_OP_TIMES
+
1977 m_mtime = date;
+
1978#endif
+
1979 m_source->set_mtime(date);
+
1980 }
-
1979
-
1980 protected:
-
1981 void flush_cache()
-
1982 {
-
1983 if (m_cache.status != cache_t::cache_t::status_t::dirty)
-
1984 m_state = state_t::ok;
-
1985 else if (!m_cache.region.empty()) {
-
1986 write_cache();
-
1987 if (ok())
-
1988 m_cache.status = cache_t::cache_t::status_t::loaded;
-
1989 }
-
1990 else {
-
1991 m_state = state_t::ok;
-
1992 m_cache.status = cache_t::cache_t::status_t::loaded;
-
1993 }
-
1994 }
-
1995
-
1996 void invalidate_cache()
-
1997 {
-
1998 if (m_cache.status == cache_t::cache_t::status_t::dirty && !m_cache.region.empty()) {
-
1999 write_cache();
-
2000 if (!ok()) _Unlikely_
-
2001 return;
-
2002 } else
-
2003 m_state = state_t::ok;
-
2004 m_cache.status = cache_t::cache_t::status_t::empty;
-
2005 }
-
2006
-
2007 void load_cache(_In_ fpos_t start)
-
2008 {
-
2009 assert(m_cache.status != cache_t::cache_t::status_t::dirty);
-
2010 start -= start % m_cache.capacity; // Align to cache block size.
-
2011 m_source->seek(m_cache.region.start = start);
-
2012 if (m_source->ok()) {
-
2013 m_cache.region.end = start + m_source->read(m_cache.data, m_cache.capacity);
-
2014 m_cache.status = cache_t::cache_t::status_t::loaded;
-
2015 m_state = state_t::ok; // Regardless the read failure, we still might have cached some data.
-
2016 }
-
2017 else
-
2018 m_state = state_t::fail;
-
2019 }
-
2020
-
2021 void write_cache()
-
2022 {
-
2023 assert(m_cache.status == cache_t::cache_t::status_t::dirty);
-
2024 m_source->seek(m_cache.region.start);
-
2025 m_source->write(m_cache.data, static_cast<size_t>(m_cache.region.size()));
-
2026 m_state = m_source->state();
-
2027 }
-
2028
-
2029 basic_file* m_source;
-
-
2030 struct cache_t {
-
2031 uint8_t* data;
-
2032 size_t capacity;
-
2033 enum class status_t {
-
2034 empty = 0,
-
2035 loaded,
-
2036 dirty,
-
2037 } status;
- -
2039
-
2040 cache_t(_In_ size_t _capacity) :
-
2041 data(new uint8_t[_capacity]),
-
2042 capacity(_capacity),
-
2043 status(status_t::empty),
-
2044 region(0)
-
2045 {}
-
2046
-
2047 ~cache_t()
-
2048 {
-
2049 delete[] data;
-
2050 }
-
2051 } m_cache;
+
1981
+
1982 protected:
+
1983 void flush_cache()
+
1984 {
+
1985 if (m_cache.status != cache_t::cache_t::status_t::dirty)
+
1986 m_state = state_t::ok;
+
1987 else if (!m_cache.region.empty()) {
+
1988 write_cache();
+
1989 if (ok())
+
1990 m_cache.status = cache_t::cache_t::status_t::loaded;
+
1991 }
+
1992 else {
+
1993 m_state = state_t::ok;
+
1994 m_cache.status = cache_t::cache_t::status_t::loaded;
+
1995 }
+
1996 }
+
1997
+
1998 void invalidate_cache()
+
1999 {
+
2000 if (m_cache.status == cache_t::cache_t::status_t::dirty && !m_cache.region.empty()) {
+
2001 write_cache();
+
2002 if (!ok()) _Unlikely_
+
2003 return;
+
2004 } else
+
2005 m_state = state_t::ok;
+
2006 m_cache.status = cache_t::cache_t::status_t::empty;
+
2007 }
+
2008
+
2009 void load_cache(_In_ fpos_t start)
+
2010 {
+
2011 assert(m_cache.status != cache_t::cache_t::status_t::dirty);
+
2012 start -= start % m_cache.capacity; // Align to cache block size.
+
2013 m_source->seek(m_cache.region.start = start);
+
2014 if (m_source->ok()) {
+
2015 m_cache.region.end = start + m_source->read(m_cache.data, m_cache.capacity);
+
2016 m_cache.status = cache_t::cache_t::status_t::loaded;
+
2017 m_state = state_t::ok; // Regardless the read failure, we still might have cached some data.
+
2018 }
+
2019 else
+
2020 m_state = state_t::fail;
+
2021 }
+
2022
+
2023 void write_cache()
+
2024 {
+
2025 assert(m_cache.status == cache_t::cache_t::status_t::dirty);
+
2026 m_source->seek(m_cache.region.start);
+
2027 m_source->write(m_cache.data, static_cast<size_t>(m_cache.region.size()));
+
2028 m_state = m_source->state();
+
2029 }
+
2030
+
2031 basic_file* m_source;
+
+
2032 struct cache_t {
+
2033 uint8_t* data;
+
2034 size_t capacity;
+
2035 enum class status_t {
+
2036 empty = 0,
+
2037 loaded,
+
2038 dirty,
+
2039 } status;
+ +
2041
+
2042 cache_t(_In_ size_t _capacity) :
+
2043 data(new uint8_t[_capacity]),
+
2044 capacity(_capacity),
+
2045 status(status_t::empty),
+
2046 region(0)
+
2047 {}
+
2048
+
2049 ~cache_t()
+
2050 {
+
2051 delete[] data;
+
2052 }
+
2053 } m_cache;
-
2052 fpos_t m_offset;
-
2053#if SET_FILE_OP_TIMES
-
2054 time_point
-
2055 m_atime,
-
2056 m_mtime;
-
2057#endif
-
2058 };
+
2054 fpos_t m_offset;
+
2055#if SET_FILE_OP_TIMES
+
2056 time_point
+
2057 m_atime,
+
2058 m_mtime;
+
2059#endif
+
2060 };
-
2059
-
-
2063 class basic_sys : virtual public basic, public sys_object
-
2064 {
-
2065 public:
-
2066 basic_sys(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok) :
-
2067 basic(state),
-
2068 sys_object(h)
-
2069 {}
-
2070
-
-
2071 virtual _Success_(return != 0 || length == 0) size_t read(
-
2072 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
2073 {
-
2074 assert(data || !length);
-
2075 // Windows Server 2003 and Windows XP: Pipe write operations across a network are limited in size per write.
-
2076 // The amount varies per platform. For x86 platforms it's 63.97 MB. For x64 platforms it's 31.97 MB. For Itanium
-
2077 // it's 63.95 MB. For more information regarding pipes, see the Remarks section.
-
2078 size_t
-
2079#if defined(_WIN64)
-
2080 block_size = 0x1F80000;
-
2081#elif defined(_WIN32)
-
2082 block_size = 0x3f00000;
-
2083#else
-
2084 block_size = SSIZE_MAX;
-
2085#endif
-
2086 for (size_t to_read = length;;) {
-
2087#ifdef _WIN32
-
2088 // ReadFile() might raise exception (e.g. STATUS_FILE_BAD_FORMAT/0xE0000002).
-
2089 BOOL succeeded;
-
2090 DWORD num_read;
-
2091 __try { succeeded = ReadFile(m_h, data, static_cast<DWORD>(std::min<size_t>(to_read, block_size)), &num_read, nullptr); }
-
2092 __except (EXCEPTION_EXECUTE_HANDLER) { succeeded = FALSE; SetLastError(ERROR_UNHANDLED_EXCEPTION); num_read = 0; }
-
2093 if (!succeeded && GetLastError() == ERROR_NO_SYSTEM_RESOURCES && block_size > default_block_size) _Unlikely_ {
-
2094 // Error "Insufficient system resources exist to complete the requested service." occurs
-
2095 // ocasionally, when attempting to read too much data at once (e.g. over \\TSClient).
-
2096 block_size = default_block_size;
-
2097 continue;
-
2098 }
-
2099 if (!succeeded) _Unlikely_
-
2100#else
-
2101 ssize_t num_read = ::read(m_h, data, static_cast<ssize_t>(std::min<size_t>(to_read, block_size)));
-
2102 if (num_read < 0) _Unlikely_
-
2103#endif
-
2104 {
-
2105 m_state = to_read < length ? state_t::ok : state_t::fail;
-
2106 return length - to_read;
-
2107 }
-
2108 if (!num_read) _Unlikely_ {
-
2109 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
-
2110 return length - to_read;
-
2111 }
-
2112 to_read -= num_read;
-
2113 if (!to_read) {
-
2114 m_state = state_t::ok;
-
2115 return length;
-
2116 }
-
2117 reinterpret_cast<uint8_t*&>(data) += num_read;
-
2118 }
-
2119 }
+
2061
+
+
2065 class basic_sys : virtual public basic, public sys_object
+
2066 {
+
2067 public:
+
2068 basic_sys(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok) :
+
2069 basic(state),
+
2070 sys_object(h)
+
2071 {}
+
2072
+
+
2073 virtual _Success_(return != 0 || length == 0) size_t read(
+
2074 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
2075 {
+
2076 assert(data || !length);
+
2077 // Windows Server 2003 and Windows XP: Pipe write operations across a network are limited in size per write.
+
2078 // The amount varies per platform. For x86 platforms it's 63.97 MB. For x64 platforms it's 31.97 MB. For Itanium
+
2079 // it's 63.95 MB. For more information regarding pipes, see the Remarks section.
+
2080 size_t
+
2081#if defined(_WIN64)
+
2082 block_size = 0x1F80000;
+
2083#elif defined(_WIN32)
+
2084 block_size = 0x3f00000;
+
2085#else
+
2086 block_size = SSIZE_MAX;
+
2087#endif
+
2088 for (size_t to_read = length;;) {
+
2089#ifdef _WIN32
+
2090 // ReadFile() might raise exception (e.g. STATUS_FILE_BAD_FORMAT/0xE0000002).
+
2091 BOOL succeeded;
+
2092 DWORD num_read;
+
2093 __try { succeeded = ReadFile(m_h, data, static_cast<DWORD>(std::min<size_t>(to_read, block_size)), &num_read, nullptr); }
+
2094 __except (EXCEPTION_EXECUTE_HANDLER) { succeeded = FALSE; SetLastError(ERROR_UNHANDLED_EXCEPTION); num_read = 0; }
+
2095 if (!succeeded && GetLastError() == ERROR_NO_SYSTEM_RESOURCES && block_size > default_block_size) _Unlikely_ {
+
2096 // Error "Insufficient system resources exist to complete the requested service." occurs
+
2097 // ocasionally, when attempting to read too much data at once (e.g. over \\TSClient).
+
2098 block_size = default_block_size;
+
2099 continue;
+
2100 }
+
2101 if (!succeeded) _Unlikely_
+
2102#else
+
2103 ssize_t num_read = ::read(m_h, data, static_cast<ssize_t>(std::min<size_t>(to_read, block_size)));
+
2104 if (num_read < 0) _Unlikely_
+
2105#endif
+
2106 {
+
2107 m_state = to_read < length ? state_t::ok : state_t::fail;
+
2108 return length - to_read;
+
2109 }
+
2110 if (!num_read) _Unlikely_ {
+
2111 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
+
2112 return length - to_read;
+
2113 }
+
2114 to_read -= num_read;
+
2115 if (!to_read) {
+
2116 m_state = state_t::ok;
+
2117 return length;
+
2118 }
+
2119 reinterpret_cast<uint8_t*&>(data) += num_read;
+
2120 }
+
2121 }
-
2120
-
-
2121 virtual _Success_(return != 0) size_t write(
-
2122 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
2123 {
-
2124 // Windows Server 2003 and Windows XP: Pipe write operations across a network are limited in size per write.
-
2125 // The amount varies per platform. For x86 platforms it's 63.97 MB. For x64 platforms it's 31.97 MB. For Itanium
-
2126 // it's 63.95 MB. For more information regarding pipes, see the Remarks section.
-
2127 constexpr size_t
-
2128#if defined(_WIN64)
-
2129 block_size = 0x1F80000;
-
2130#elif defined(_WIN32)
-
2131 block_size = 0x3f00000;
-
2132#else
-
2133 block_size = SSIZE_MAX;
-
2134#endif
-
2135 for (size_t to_write = length;;) {
-
2136#ifdef _WIN32
-
2137 // ReadFile() might raise an exception. Be cautious with WriteFile() too.
-
2138 BOOL succeeded;
-
2139 DWORD num_written;
-
2140 __try { succeeded = WriteFile(m_h, data, static_cast<DWORD>(std::min<size_t>(to_write, block_size)), &num_written, nullptr); }
-
2141 __except (EXCEPTION_EXECUTE_HANDLER) { succeeded = FALSE; SetLastError(ERROR_UNHANDLED_EXCEPTION); num_written = 0; }
-
2142 to_write -= num_written;
-
2143 if (!to_write) {
-
2144 m_state = state_t::ok;
-
2145 return length;
-
2146 }
-
2147 reinterpret_cast<const uint8_t*&>(data) += num_written;
-
2148 if (!succeeded) _Unlikely_ {
-
2149 m_state = state_t::fail;
-
2150 return length - to_write;
-
2151 }
-
2152#else
-
2153 ssize_t num_written = ::write(m_h, data, static_cast<ssize_t>(std::min<size_t>(to_write, block_size)));
-
2154 if (num_written < 0) _Unlikely_ {
-
2155 m_state = state_t::fail;
-
2156 return length - to_write;
-
2157 }
-
2158 to_write -= num_written;
-
2159 if (!to_write) {
-
2160 m_state = state_t::ok;
-
2161 return length;
-
2162 }
-
2163 reinterpret_cast<const uint8_t*&>(data) += num_written;
-
2164#endif
-
2165 }
-
2166 }
+
2122
+
+
2123 virtual _Success_(return != 0) size_t write(
+
2124 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
2125 {
+
2126 // Windows Server 2003 and Windows XP: Pipe write operations across a network are limited in size per write.
+
2127 // The amount varies per platform. For x86 platforms it's 63.97 MB. For x64 platforms it's 31.97 MB. For Itanium
+
2128 // it's 63.95 MB. For more information regarding pipes, see the Remarks section.
+
2129 constexpr size_t
+
2130#if defined(_WIN64)
+
2131 block_size = 0x1F80000;
+
2132#elif defined(_WIN32)
+
2133 block_size = 0x3f00000;
+
2134#else
+
2135 block_size = SSIZE_MAX;
+
2136#endif
+
2137 for (size_t to_write = length;;) {
+
2138#ifdef _WIN32
+
2139 // ReadFile() might raise an exception. Be cautious with WriteFile() too.
+
2140 BOOL succeeded;
+
2141 DWORD num_written;
+
2142 __try { succeeded = WriteFile(m_h, data, static_cast<DWORD>(std::min<size_t>(to_write, block_size)), &num_written, nullptr); }
+
2143 __except (EXCEPTION_EXECUTE_HANDLER) { succeeded = FALSE; SetLastError(ERROR_UNHANDLED_EXCEPTION); num_written = 0; }
+
2144 to_write -= num_written;
+
2145 if (!to_write) {
+
2146 m_state = state_t::ok;
+
2147 return length;
+
2148 }
+
2149 reinterpret_cast<const uint8_t*&>(data) += num_written;
+
2150 if (!succeeded) _Unlikely_ {
+
2151 m_state = state_t::fail;
+
2152 return length - to_write;
+
2153 }
+
2154#else
+
2155 ssize_t num_written = ::write(m_h, data, static_cast<ssize_t>(std::min<size_t>(to_write, block_size)));
+
2156 if (num_written < 0) _Unlikely_ {
+
2157 m_state = state_t::fail;
+
2158 return length - to_write;
+
2159 }
+
2160 to_write -= num_written;
+
2161 if (!to_write) {
+
2162 m_state = state_t::ok;
+
2163 return length;
+
2164 }
+
2165 reinterpret_cast<const uint8_t*&>(data) += num_written;
+
2166#endif
+
2167 }
+
2168 }
-
2167
-
-
2168 virtual void close()
-
2169 {
-
2170 try {
- -
2172 m_state = state_t::ok;
-
2173 }
-
2174 catch (...) {
-
2175 m_state = state_t::fail;
-
2176 }
-
2177 }
+
2169
+
+
2170 virtual void close()
+
2171 {
+
2172 try {
+ +
2174 m_state = state_t::ok;
+
2175 }
+
2176 catch (...) {
+
2177 m_state = state_t::fail;
+
2178 }
+
2179 }
-
2178
-
-
2179 virtual void flush()
-
2180 {
-
2181#ifdef _WIN32
-
2182 m_state = FlushFileBuffers(m_h) ? state_t::ok : state_t::fail;
-
2183#else
-
2184 m_state = fsync(m_h) >= 0 ? state_t::ok : state_t::fail;
-
2185#endif
-
2186 }
+
2180
+
+
2181 virtual void flush()
+
2182 {
+
2183#ifdef _WIN32
+
2184 m_state = FlushFileBuffers(m_h) ? state_t::ok : state_t::fail;
+
2185#else
+
2186 m_state = fsync(m_h) >= 0 ? state_t::ok : state_t::fail;
+
2187#endif
+
2188 }
-
2187 };
+
2189 };
-
2188
-
-
2192 class buffered_sys : public buffer
-
2193 {
-
2194 public:
-
2195 buffered_sys(_In_opt_ sys_handle h = invalid_handle, size_t read_buffer_size = default_buffer_size, size_t write_buffer_size = default_buffer_size) :
-
2196 buffer(read_buffer_size, write_buffer_size),
-
2197 m_source(h)
-
2198 {
-
2199 init(m_source);
-
2200 }
-
2201
-
2202 virtual ~buffered_sys()
-
2203 {
-
2204 done();
-
2205 }
-
2206
-
2207 protected:
-
2208 basic_sys m_source;
-
2209 };
+
2190
+
+
2194 class buffered_sys : public buffer
+
2195 {
+
2196 public:
+
2197 buffered_sys(_In_opt_ sys_handle h = invalid_handle, size_t read_buffer_size = default_buffer_size, size_t write_buffer_size = default_buffer_size) :
+
2198 buffer(read_buffer_size, write_buffer_size),
+
2199 m_source(h)
+
2200 {
+
2201 init(m_source);
+
2202 }
+
2203
+
2204 virtual ~buffered_sys()
+
2205 {
+
2206 done();
+
2207 }
+
2208
+
2209 protected:
+
2210 basic_sys m_source;
+
2211 };
-
2210
-
2211#ifdef _WIN32
-
2215 class sequential_stream : public basic
-
2216 {
-
2217 public:
-
2218 sequential_stream(_In_ ISequentialStream* source) : m_source(source)
-
2219 {
-
2220 m_source->AddRef();
-
2221 }
-
2222
-
2223 virtual ~sequential_stream()
-
2224 {
-
2225 m_source->Release();
-
2226 }
-
2227
-
2228 virtual _Success_(return != 0 || length == 0) size_t read(
-
2229 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
2230 {
-
2231 assert(data || !length);
-
2232 for (size_t to_read = length;;) {
-
2233 HRESULT hr;
-
2234 ULONG num_read = 0;
-
2235 __try { hr = m_source->Read(data, (ULONG)std::min<size_t>(to_read, ULONG_MAX), &num_read); }
-
2236 __except (EXCEPTION_EXECUTE_HANDLER) { hr = E_FAIL; }
-
2237 if (FAILED(hr)) _Unlikely_ {
-
2238 m_state = to_read < length ? state_t::ok : state_t::fail;
-
2239 return length - to_read;
-
2240 }
-
2241 to_read -= num_read;
-
2242 if (hr == S_FALSE) _Unlikely_ {
-
2243 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
-
2244 return length - to_read;
-
2245 }
-
2246 if (!to_read) {
-
2247 m_state = state_t::ok;
-
2248 return length;
-
2249 }
-
2250 reinterpret_cast<uint8_t*&>(data) += num_read;
-
2251 }
-
2252 }
-
2253
-
2254 virtual _Success_(return != 0) size_t write(
-
2255 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
2256 {
-
2257 assert(data || !length);
-
2258 for (size_t to_write = length;;) {
-
2259 HRESULT hr;
-
2260 ULONG num_written = 0;
-
2261 __try { hr = m_source->Write(data, static_cast<ULONG>(std::min<size_t>(to_write, ULONG_MAX)), &num_written); }
-
2262 __except (EXCEPTION_EXECUTE_HANDLER) { hr = E_FAIL; }
-
2263 // In abscence of documentation whether num_written gets set when FAILED(hr) (i.e. partially succesful writes),
-
2264 // assume write failed completely.
-
2265 if (FAILED(hr)) _Unlikely_ {
-
2266 m_state = state_t::fail;
-
2267 return length - to_write;
-
2268 }
-
2269 to_write -= num_written;
-
2270 if (!to_write) {
-
2271 m_state = state_t::ok;
-
2272 return length;
-
2273 }
-
2274 reinterpret_cast<const uint8_t*&>(data) += num_written;
-
2275 }
-
2276 }
-
2277
-
2278 protected:
-
2279 ISequentialStream* m_source;
-
2280 };
-
2281
-
2285 class asp : public basic
-
2286 {
-
2287 public:
-
2288 asp(_In_opt_ IRequest* request, _In_opt_ IResponse* response) :
-
2289 m_request(request),
-
2290 m_response(response)
-
2291 {
-
2292 if (m_request)
-
2293 m_request->AddRef();
-
2294 if (m_response)
-
2295 m_response->AddRef();
-
2296 }
-
2297
-
2298 virtual ~asp()
-
2299 {
-
2300 if (m_request)
-
2301 m_request->Release();
-
2302 if (m_response)
-
2303 m_response->Release();
-
2304 }
-
2305
-
2306 virtual _Success_(return != 0 || length == 0) size_t read(
-
2307 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
2308 {
-
2309 assert(data || !length);
-
2310 if (!m_request) _Unlikely_ {
-
2311 m_state = state_t::fail;
-
2312 return 0;
-
2313 }
-
2314 for (size_t to_read = length;;) {
-
2315 VARIANT var_amount, var_data;
-
2316 V_VT(&var_amount) = VT_I4;
-
2317 V_I4(&var_amount) = (LONG)std::min<size_t>(to_read, LONG_MAX);
-
2318 V_VT(&var_data) = VT_EMPTY;
-
2319 HRESULT hr = [&]() {
-
2320 __try { return m_request->BinaryRead(&var_amount, &var_data); }
-
2321 __except (EXCEPTION_EXECUTE_HANDLER) { return E_FAIL; }
-
2322 }();
-
2323 if (FAILED(hr)) _Unlikely_ {
-
2324 m_state = to_read < length ? state_t::ok : state_t::fail;
-
2325 return length - to_read;
-
2326 }
-
2327 assert(V_VT(&var_amount) == VT_I4);
-
2328 assert(V_VT(&var_data) == (VT_ARRAY | VT_UI1));
-
2329 std::unique_ptr<SAFEARRAY, SafeArrayDestroy_delete> sa(V_ARRAY(&var_data));
-
2330 if (!V_I4(&var_amount)) _Unlikely_ {
-
2331 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
-
2332 return length - to_read;
-
2333 }
-
2334 safearray_accessor<uint8_t> a(sa.get());
-
2335 memcpy(data, a.data(), V_I4(&var_amount));
-
2336 to_read -= V_I4(&var_amount);
-
2337 if (!to_read) {
-
2338 m_state = state_t::ok;
-
2339 return length;
-
2340 }
-
2341 reinterpret_cast<uint8_t*&>(data) += V_I4(&var_amount);
-
2342 }
-
2343 }
-
2344
-
2345 virtual _Success_(return != 0) size_t write(
-
2346 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
2347 {
-
2348 if (!m_response) {
-
2349 m_state = state_t::fail;
-
2350 return 0;
-
2351 }
-
2352 for (size_t to_write = length;;) {
-
2353 UINT num_written = static_cast<UINT>(std::min<size_t>(to_write, UINT_MAX));
-
2354 std::unique_ptr<OLECHAR, SysFreeString_delete> bstr_data(SysAllocStringByteLen(reinterpret_cast<LPCSTR>(data), num_written));
-
2355 VARIANT var_data;
-
2356 V_VT(&var_data) = VT_BSTR;
-
2357 V_BSTR(&var_data) = bstr_data.get();
-
2358 HRESULT hr = [&]() {
-
2359 __try { return m_response->BinaryWrite(var_data); }
-
2360 __except (EXCEPTION_EXECUTE_HANDLER) { return E_FAIL; }
-
2361 }();
-
2362 if (FAILED(hr)) _Unlikely_ {
-
2363 m_state = state_t::fail;
-
2364 return length - to_write;
-
2365 }
-
2366 to_write -= num_written;
-
2367 if (!to_write) {
-
2368 m_state = state_t::ok;
-
2369 return length;
-
2370 }
-
2371 reinterpret_cast<const uint8_t*&>(data) += num_written;
-
2372 }
-
2373 }
-
2374
-
2375 virtual void close()
-
2376 {
-
2377 if (m_response) {
-
2378 __try { m_response->End(); }
-
2379 __except (EXCEPTION_EXECUTE_HANDLER) {}
-
2380 }
-
2381 m_state = state_t::ok;
-
2382 }
-
2383
-
2384 virtual void flush()
-
2385 {
-
2386 if (m_response) {
-
2387 HRESULT hr;
-
2388 __try { hr = m_response->Flush(); }
-
2389 __except (EXCEPTION_EXECUTE_HANDLER) { hr = E_FAIL; }
-
2390 m_state = SUCCEEDED(hr) ? state_t::ok : state_t::fail;
-
2391 }
-
2392 }
-
2393
-
2394 protected:
-
2395 IRequest* m_request;
-
2396 IResponse* m_response;
-
2397 };
-
2398#endif
-
2399
-
2403 enum mode_t
-
2404 {
-
2405 mode_for_reading = 1 << 0,
-
2406 mode_for_writing = 1 << 1,
-
2407 mode_for_chmod = 1 << 2,
-
2408 mode_create = 1 << 3,
-
2409 mode_preserve_existing = mode_create | (1 << 4),
-
2410 mode_append = 1 << 5,
-
2411 mode_text = 0,
-
2412 mode_binary = 1 << 6,
-
2413
-
2414 share_none = 0,
-
2415 share_reading = 1 << 7,
-
2416 share_writing = 1 << 8,
-
2417 share_deleting = 1 << 9,
-
2418 share_all = share_reading | share_writing | share_deleting, // Allow others all operations on our file
-
2419
-
2420 inherit_handle = 1 << 10,
+
2212
+
2213#ifdef _WIN32
+
2217 class sequential_stream : public basic
+
2218 {
+
2219 public:
+
2220 sequential_stream(_In_ ISequentialStream* source) : m_source(source)
+
2221 {
+
2222 m_source->AddRef();
+
2223 }
+
2224
+
2225 virtual ~sequential_stream()
+
2226 {
+
2227 m_source->Release();
+
2228 }
+
2229
+
2230 virtual _Success_(return != 0 || length == 0) size_t read(
+
2231 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
2232 {
+
2233 assert(data || !length);
+
2234 for (size_t to_read = length;;) {
+
2235 HRESULT hr;
+
2236 ULONG num_read = 0;
+
2237 __try { hr = m_source->Read(data, (ULONG)std::min<size_t>(to_read, ULONG_MAX), &num_read); }
+
2238 __except (EXCEPTION_EXECUTE_HANDLER) { hr = E_FAIL; }
+
2239 if (FAILED(hr)) _Unlikely_ {
+
2240 m_state = to_read < length ? state_t::ok : state_t::fail;
+
2241 return length - to_read;
+
2242 }
+
2243 to_read -= num_read;
+
2244 if (hr == S_FALSE) _Unlikely_ {
+
2245 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
+
2246 return length - to_read;
+
2247 }
+
2248 if (!to_read) {
+
2249 m_state = state_t::ok;
+
2250 return length;
+
2251 }
+
2252 reinterpret_cast<uint8_t*&>(data) += num_read;
+
2253 }
+
2254 }
+
2255
+
2256 virtual _Success_(return != 0) size_t write(
+
2257 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
2258 {
+
2259 assert(data || !length);
+
2260 for (size_t to_write = length;;) {
+
2261 HRESULT hr;
+
2262 ULONG num_written = 0;
+
2263 __try { hr = m_source->Write(data, static_cast<ULONG>(std::min<size_t>(to_write, ULONG_MAX)), &num_written); }
+
2264 __except (EXCEPTION_EXECUTE_HANDLER) { hr = E_FAIL; }
+
2265 // In abscence of documentation whether num_written gets set when FAILED(hr) (i.e. partially succesful writes),
+
2266 // assume write failed completely.
+
2267 if (FAILED(hr)) _Unlikely_ {
+
2268 m_state = state_t::fail;
+
2269 return length - to_write;
+
2270 }
+
2271 to_write -= num_written;
+
2272 if (!to_write) {
+
2273 m_state = state_t::ok;
+
2274 return length;
+
2275 }
+
2276 reinterpret_cast<const uint8_t*&>(data) += num_written;
+
2277 }
+
2278 }
+
2279
+
2280 protected:
+
2281 ISequentialStream* m_source;
+
2282 };
+
2283
+
2287 class asp : public basic
+
2288 {
+
2289 public:
+
2290 asp(_In_opt_ IRequest* request, _In_opt_ IResponse* response) :
+
2291 m_request(request),
+
2292 m_response(response)
+
2293 {
+
2294 if (m_request)
+
2295 m_request->AddRef();
+
2296 if (m_response)
+
2297 m_response->AddRef();
+
2298 }
+
2299
+
2300 virtual ~asp()
+
2301 {
+
2302 if (m_request)
+
2303 m_request->Release();
+
2304 if (m_response)
+
2305 m_response->Release();
+
2306 }
+
2307
+
2308 virtual _Success_(return != 0 || length == 0) size_t read(
+
2309 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
2310 {
+
2311 assert(data || !length);
+
2312 if (!m_request) _Unlikely_ {
+
2313 m_state = state_t::fail;
+
2314 return 0;
+
2315 }
+
2316 for (size_t to_read = length;;) {
+
2317 VARIANT var_amount, var_data;
+
2318 V_VT(&var_amount) = VT_I4;
+
2319 V_I4(&var_amount) = (LONG)std::min<size_t>(to_read, LONG_MAX);
+
2320 V_VT(&var_data) = VT_EMPTY;
+
2321 HRESULT hr = [&]() {
+
2322 __try { return m_request->BinaryRead(&var_amount, &var_data); }
+
2323 __except (EXCEPTION_EXECUTE_HANDLER) { return E_FAIL; }
+
2324 }();
+
2325 if (FAILED(hr)) _Unlikely_ {
+
2326 m_state = to_read < length ? state_t::ok : state_t::fail;
+
2327 return length - to_read;
+
2328 }
+
2329 assert(V_VT(&var_amount) == VT_I4);
+
2330 assert(V_VT(&var_data) == (VT_ARRAY | VT_UI1));
+
2331 std::unique_ptr<SAFEARRAY, SafeArrayDestroy_delete> sa(V_ARRAY(&var_data));
+
2332 if (!V_I4(&var_amount)) _Unlikely_ {
+
2333 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
+
2334 return length - to_read;
+
2335 }
+
2336 safearray_accessor<uint8_t> a(sa.get());
+
2337 memcpy(data, a.data(), V_I4(&var_amount));
+
2338 to_read -= V_I4(&var_amount);
+
2339 if (!to_read) {
+
2340 m_state = state_t::ok;
+
2341 return length;
+
2342 }
+
2343 reinterpret_cast<uint8_t*&>(data) += V_I4(&var_amount);
+
2344 }
+
2345 }
+
2346
+
2347 virtual _Success_(return != 0) size_t write(
+
2348 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
2349 {
+
2350 if (!m_response) {
+
2351 m_state = state_t::fail;
+
2352 return 0;
+
2353 }
+
2354 for (size_t to_write = length;;) {
+
2355 UINT num_written = static_cast<UINT>(std::min<size_t>(to_write, UINT_MAX));
+
2356 std::unique_ptr<OLECHAR, SysFreeString_delete> bstr_data(SysAllocStringByteLen(reinterpret_cast<LPCSTR>(data), num_written));
+
2357 VARIANT var_data;
+
2358 V_VT(&var_data) = VT_BSTR;
+
2359 V_BSTR(&var_data) = bstr_data.get();
+
2360 HRESULT hr = [&]() {
+
2361 __try { return m_response->BinaryWrite(var_data); }
+
2362 __except (EXCEPTION_EXECUTE_HANDLER) { return E_FAIL; }
+
2363 }();
+
2364 if (FAILED(hr)) _Unlikely_ {
+
2365 m_state = state_t::fail;
+
2366 return length - to_write;
+
2367 }
+
2368 to_write -= num_written;
+
2369 if (!to_write) {
+
2370 m_state = state_t::ok;
+
2371 return length;
+
2372 }
+
2373 reinterpret_cast<const uint8_t*&>(data) += num_written;
+
2374 }
+
2375 }
+
2376
+
2377 virtual void close()
+
2378 {
+
2379 if (m_response) {
+
2380 __try { m_response->End(); }
+
2381 __except (EXCEPTION_EXECUTE_HANDLER) {}
+
2382 }
+
2383 m_state = state_t::ok;
+
2384 }
+
2385
+
2386 virtual void flush()
+
2387 {
+
2388 if (m_response) {
+
2389 HRESULT hr;
+
2390 __try { hr = m_response->Flush(); }
+
2391 __except (EXCEPTION_EXECUTE_HANDLER) { hr = E_FAIL; }
+
2392 m_state = SUCCEEDED(hr) ? state_t::ok : state_t::fail;
+
2393 }
+
2394 }
+
2395
+
2396 protected:
+
2397 IRequest* m_request;
+
2398 IResponse* m_response;
+
2399 };
+
2400#endif
+
2401
+
2405 enum mode_t
+
2406 {
+
2407 mode_for_reading = 1 << 0,
+
2408 mode_for_writing = 1 << 1,
+
2409 mode_for_chmod = 1 << 2,
+
2410 mode_create = 1 << 3,
+
2411 mode_preserve_existing = mode_create | (1 << 4),
+
2412 mode_append = 1 << 5,
+
2413 mode_text = 0,
+
2414 mode_binary = 1 << 6,
+
2415
+
2416 share_none = 0,
+
2417 share_reading = 1 << 7,
+
2418 share_writing = 1 << 8,
+
2419 share_deleting = 1 << 9,
+
2420 share_all = share_reading | share_writing | share_deleting, // Allow others all operations on our file
2421
-
2422 hint_write_thru = 1 << 11,
-
2423 hint_no_buffering = 1 << 12,
-
2424 hint_random_access = 1 << 13,
-
2425 hint_sequential_access = 1 << 14,
-
2426 };
-
2427
-
2428#pragma warning(push)
-
2429#pragma warning(disable: 4250)
-
-
2433 class file : virtual public basic_file, virtual public basic_sys
-
2434 {
-
2435 public:
-
2436 file(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok) : basic_sys(h, state) {}
-
2437
-
-
2444 file(_In_z_ const schar_t* filename, _In_ int mode)
-
2445 {
-
2446 open(filename, mode);
-
2447 }
+
2422 inherit_handle = 1 << 10,
+
2423
+
2424 hint_write_thru = 1 << 11,
+
2425 hint_no_buffering = 1 << 12,
+
2426 hint_random_access = 1 << 13,
+
2427 hint_sequential_access = 1 << 14,
+
2428 };
+
2429
+
2430#pragma warning(push)
+
2431#pragma warning(disable: 4250)
+
+
2435 class file : virtual public basic_file, virtual public basic_sys
+
2436 {
+
2437 public:
+
2438 file(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok) : basic_sys(h, state) {}
+
2439
+
+
2446 file(_In_z_ const schar_t* filename, _In_ int mode)
+
2447 {
+
2448 open(filename, mode);
+
2449 }
-
2448
-
-
2455 void open(_In_z_ const schar_t* filename, _In_ int mode)
-
2456 {
-
2457 if (m_h != invalid_handle)
-
2458 close();
-
2459
-
2460#ifdef _WIN32
-
2461 DWORD dwDesiredAccess = 0;
-
2462 if (mode & mode_for_reading) dwDesiredAccess |= GENERIC_READ;
-
2463 if (mode & mode_for_writing) dwDesiredAccess |= GENERIC_WRITE;
-
2464 if (mode & mode_for_chmod) dwDesiredAccess |= FILE_WRITE_ATTRIBUTES;
-
2465
-
2466 DWORD dwShareMode = 0;
-
2467 if (mode & share_reading) dwShareMode |= FILE_SHARE_READ;
-
2468 if (mode & share_writing) dwShareMode |= FILE_SHARE_WRITE;
-
2469 if (mode & share_deleting) dwShareMode |= FILE_SHARE_DELETE;
-
2470
-
2471 SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES) };
-
2472 sa.bInheritHandle = mode & inherit_handle ? true : false;
-
2473
-
2474 DWORD dwCreationDisposition;
-
2475 switch (mode & mode_preserve_existing) {
-
2476 case mode_create: dwCreationDisposition = CREATE_ALWAYS; break;
-
2477 case mode_preserve_existing: dwCreationDisposition = OPEN_ALWAYS; break;
-
2478 case 0: dwCreationDisposition = OPEN_EXISTING; break;
-
2479 default: throw std::invalid_argument("invalid mode");
-
2480 }
-
2481
-
2482 DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
-
2483 if (mode & hint_write_thru) dwFlagsAndAttributes |= FILE_FLAG_WRITE_THROUGH;
-
2484 if (mode & hint_no_buffering) dwFlagsAndAttributes |= FILE_FLAG_NO_BUFFERING;
-
2485 if (mode & hint_random_access) dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
-
2486 if (mode & hint_sequential_access) dwFlagsAndAttributes |= FILE_FLAG_SEQUENTIAL_SCAN;
-
2487
-
2488 m_h = CreateFile(filename, dwDesiredAccess, dwShareMode, &sa, dwCreationDisposition, dwFlagsAndAttributes, nullptr);
-
2489#else
-
2490 int flags = 0;
-
2491 switch (mode & (mode_for_reading | mode_for_writing)) {
-
2492 case mode_for_reading: flags |= O_RDONLY; break;
-
2493 case mode_for_writing: flags |= O_WRONLY; break;
-
2494 case mode_for_reading | mode_for_writing: flags |= O_RDWR; break;
-
2495 }
-
2496 if (mode & mode_create) flags |= mode & mode_preserve_existing ? O_CREAT : (O_CREAT | O_EXCL);
-
2497 if (mode & hint_write_thru) flags |= O_DSYNC;
-
2498#ifndef __APPLE__
-
2499 if (mode & hint_no_buffering) flags |= O_RSYNC;
-
2500#endif
-
2501
-
2502 m_h = ::open(filename, flags, DEFFILEMODE);
-
2503#endif
-
2504 if (m_h != invalid_handle) {
-
2505 m_state = state_t::ok;
-
2506 if (mode & mode_append)
-
2507 seek(0, seek_t::end);
-
2508 }
-
2509 else
-
2510 m_state = state_t::fail;
-
2511 }
+
2450
+
+
2457 void open(_In_z_ const schar_t* filename, _In_ int mode)
+
2458 {
+
2459 if (m_h != invalid_handle)
+
2460 close();
+
2461
+
2462#ifdef _WIN32
+
2463 DWORD dwDesiredAccess = 0;
+
2464 if (mode & mode_for_reading) dwDesiredAccess |= GENERIC_READ;
+
2465 if (mode & mode_for_writing) dwDesiredAccess |= GENERIC_WRITE;
+
2466 if (mode & mode_for_chmod) dwDesiredAccess |= FILE_WRITE_ATTRIBUTES;
+
2467
+
2468 DWORD dwShareMode = 0;
+
2469 if (mode & share_reading) dwShareMode |= FILE_SHARE_READ;
+
2470 if (mode & share_writing) dwShareMode |= FILE_SHARE_WRITE;
+
2471 if (mode & share_deleting) dwShareMode |= FILE_SHARE_DELETE;
+
2472
+
2473 SECURITY_ATTRIBUTES sa = { sizeof(SECURITY_ATTRIBUTES) };
+
2474 sa.bInheritHandle = mode & inherit_handle ? true : false;
+
2475
+
2476 DWORD dwCreationDisposition;
+
2477 switch (mode & mode_preserve_existing) {
+
2478 case mode_create: dwCreationDisposition = CREATE_ALWAYS; break;
+
2479 case mode_preserve_existing: dwCreationDisposition = OPEN_ALWAYS; break;
+
2480 case 0: dwCreationDisposition = OPEN_EXISTING; break;
+
2481 default: throw std::invalid_argument("invalid mode");
+
2482 }
+
2483
+
2484 DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
+
2485 if (mode & hint_write_thru) dwFlagsAndAttributes |= FILE_FLAG_WRITE_THROUGH;
+
2486 if (mode & hint_no_buffering) dwFlagsAndAttributes |= FILE_FLAG_NO_BUFFERING;
+
2487 if (mode & hint_random_access) dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
+
2488 if (mode & hint_sequential_access) dwFlagsAndAttributes |= FILE_FLAG_SEQUENTIAL_SCAN;
+
2489
+
2490 m_h = CreateFile(filename, dwDesiredAccess, dwShareMode, &sa, dwCreationDisposition, dwFlagsAndAttributes, nullptr);
+
2491#else
+
2492 int flags = 0;
+
2493 switch (mode & (mode_for_reading | mode_for_writing)) {
+
2494 case mode_for_reading: flags |= O_RDONLY; break;
+
2495 case mode_for_writing: flags |= O_WRONLY; break;
+
2496 case mode_for_reading | mode_for_writing: flags |= O_RDWR; break;
+
2497 }
+
2498 if (mode & mode_create) flags |= mode & mode_preserve_existing ? O_CREAT : (O_CREAT | O_EXCL);
+
2499 if (mode & hint_write_thru) flags |= O_DSYNC;
+
2500#ifndef __APPLE__
+
2501 if (mode & hint_no_buffering) flags |= O_RSYNC;
+
2502#endif
+
2503
+
2504 m_h = ::open(filename, flags, DEFFILEMODE);
+
2505#endif
+
2506 if (m_h != invalid_handle) {
+
2507 m_state = state_t::ok;
+
2508 if (mode & mode_append)
+
2509 seek(0, seek_t::end);
+
2510 }
+
2511 else
+
2512 m_state = state_t::fail;
+
2513 }
-
2512
-
-
2513 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
2514 {
-
2515#ifdef _WIN32
-
2516 LARGE_INTEGER li;
-
2517 li.QuadPart = offset;
-
2518 li.LowPart = SetFilePointer(m_h, li.LowPart, &li.HighPart, static_cast<DWORD>(how));
-
2519 if (li.LowPart != 0xFFFFFFFF || GetLastError() == NO_ERROR) {
-
2520 m_state = state_t::ok;
-
2521 return li.QuadPart;
-
2522 }
-
2523#else
-
2524 off64_t result = lseek64(m_h, offset, static_cast<int>(how));
-
2525 if (result >= 0) {
-
2526 m_state = state_t::ok;
-
2527 return result;
-
2528 }
-
2529#endif
-
2530 m_state = state_t::fail;
-
2531 return fpos_max;
-
2532 }
+
2514
+
+
2515 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
2516 {
+
2517#ifdef _WIN32
+
2518 LARGE_INTEGER li;
+
2519 li.QuadPart = offset;
+
2520 li.LowPart = SetFilePointer(m_h, li.LowPart, &li.HighPart, static_cast<DWORD>(how));
+
2521 if (li.LowPart != 0xFFFFFFFF || GetLastError() == NO_ERROR) {
+
2522 m_state = state_t::ok;
+
2523 return li.QuadPart;
+
2524 }
+
2525#else
+
2526 off64_t result = lseek64(m_h, offset, static_cast<int>(how));
+
2527 if (result >= 0) {
+
2528 m_state = state_t::ok;
+
2529 return result;
+
2530 }
+
2531#endif
+
2532 m_state = state_t::fail;
+
2533 return fpos_max;
+
2534 }
-
2533
-
-
2534 virtual fpos_t tell() const
-
2535 {
-
2536 if (m_h != invalid_handle) {
-
2537#ifdef _WIN32
-
2538 LARGE_INTEGER li;
-
2539 li.QuadPart = 0;
-
2540 li.LowPart = SetFilePointer(m_h, 0, &li.HighPart, FILE_CURRENT);
-
2541 if (li.LowPart != 0xFFFFFFFF || GetLastError() == NO_ERROR)
-
2542 return li.QuadPart;
-
2543#else
-
2544 off64_t result = lseek64(m_h, 0, SEEK_CUR);
-
2545 if (result >= 0)
-
2546 return result;
-
2547#endif
-
2548 }
-
2549 return fpos_max;
-
2550 }
+
2535
+
+
2536 virtual fpos_t tell() const
+
2537 {
+
2538 if (m_h != invalid_handle) {
+
2539#ifdef _WIN32
+
2540 LARGE_INTEGER li;
+
2541 li.QuadPart = 0;
+
2542 li.LowPart = SetFilePointer(m_h, 0, &li.HighPart, FILE_CURRENT);
+
2543 if (li.LowPart != 0xFFFFFFFF || GetLastError() == NO_ERROR)
+
2544 return li.QuadPart;
+
2545#else
+
2546 off64_t result = lseek64(m_h, 0, SEEK_CUR);
+
2547 if (result >= 0)
+
2548 return result;
+
2549#endif
+
2550 }
+
2551 return fpos_max;
+
2552 }
-
2551
-
-
2552 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
-
2553 {
-
2554#ifdef _WIN32
-
2555 LARGE_INTEGER liOffset;
-
2556 LARGE_INTEGER liSize;
-
2557 liOffset.QuadPart = offset;
-
2558 liSize.QuadPart = length;
-
2559 if (LockFile(m_h, liOffset.LowPart, liOffset.HighPart, liSize.LowPart, liSize.HighPart)) {
-
2560 m_state = state_t::ok;
-
2561 return;
-
2562 }
-
2563#else
-
2564 off64_t orig = lseek64(m_h, 0, SEEK_CUR);
-
2565 if (orig >= 0) {
-
2566 m_state = lseek64(m_h, offset, SEEK_SET) >= 0 && lockf64(m_h, F_LOCK, length) >= 0 ? state_t::ok : state_t::fail;
-
2567 lseek64(m_h, orig, SEEK_SET);
-
2568 m_state = state_t::ok;
-
2569 return;
-
2570 }
-
2571#endif
-
2572 m_state = state_t::fail;
-
2573 }
+
2553
+
+
2554 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
+
2555 {
+
2556#ifdef _WIN32
+
2557 LARGE_INTEGER liOffset;
+
2558 LARGE_INTEGER liSize;
+
2559 liOffset.QuadPart = offset;
+
2560 liSize.QuadPart = length;
+
2561 if (LockFile(m_h, liOffset.LowPart, liOffset.HighPart, liSize.LowPart, liSize.HighPart)) {
+
2562 m_state = state_t::ok;
+
2563 return;
+
2564 }
+
2565#else
+
2566 off64_t orig = lseek64(m_h, 0, SEEK_CUR);
+
2567 if (orig >= 0) {
+
2568 m_state = lseek64(m_h, offset, SEEK_SET) >= 0 && lockf64(m_h, F_LOCK, length) >= 0 ? state_t::ok : state_t::fail;
+
2569 lseek64(m_h, orig, SEEK_SET);
+
2570 m_state = state_t::ok;
+
2571 return;
+
2572 }
+
2573#endif
+
2574 m_state = state_t::fail;
+
2575 }
-
2574
-
-
2575 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
-
2576 {
-
2577#ifdef _WIN32
-
2578 LARGE_INTEGER liOffset;
-
2579 LARGE_INTEGER liSize;
-
2580 liOffset.QuadPart = offset;
-
2581 liSize.QuadPart = length;
-
2582 if (UnlockFile(m_h, liOffset.LowPart, liOffset.HighPart, liSize.LowPart, liSize.HighPart)) {
-
2583 m_state = state_t::ok;
-
2584 return;
-
2585 }
-
2586#else
-
2587 off64_t orig = lseek64(m_h, 0, SEEK_CUR);
-
2588 if (orig >= 0) {
-
2589 if (lseek64(m_h, offset, SEEK_SET) >= 0 && lockf64(m_h, F_ULOCK, length) >= 0) {
-
2590 lseek64(m_h, orig, SEEK_SET);
-
2591 m_state = state_t::ok;
-
2592 return;
-
2593 }
-
2594 lseek64(m_h, orig, SEEK_SET);
-
2595 }
-
2596#endif
-
2597 m_state = state_t::fail;
-
2598 }
+
2576
+
+
2577 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
+
2578 {
+
2579#ifdef _WIN32
+
2580 LARGE_INTEGER liOffset;
+
2581 LARGE_INTEGER liSize;
+
2582 liOffset.QuadPart = offset;
+
2583 liSize.QuadPart = length;
+
2584 if (UnlockFile(m_h, liOffset.LowPart, liOffset.HighPart, liSize.LowPart, liSize.HighPart)) {
+
2585 m_state = state_t::ok;
+
2586 return;
+
2587 }
+
2588#else
+
2589 off64_t orig = lseek64(m_h, 0, SEEK_CUR);
+
2590 if (orig >= 0) {
+
2591 if (lseek64(m_h, offset, SEEK_SET) >= 0 && lockf64(m_h, F_ULOCK, length) >= 0) {
+
2592 lseek64(m_h, orig, SEEK_SET);
+
2593 m_state = state_t::ok;
+
2594 return;
+
2595 }
+
2596 lseek64(m_h, orig, SEEK_SET);
+
2597 }
+
2598#endif
+
2599 m_state = state_t::fail;
+
2600 }
-
2599
-
-
2600 virtual fsize_t size()
-
2601 {
-
2602#ifdef _WIN32
-
2603 LARGE_INTEGER li;
-
2604 li.LowPart = GetFileSize(m_h, (LPDWORD)&li.HighPart);
-
2605 if (li.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR)
-
2606 li.QuadPart = -1;
-
2607 return li.QuadPart;
-
2608#else
-
2609 off64_t length = -1, orig = lseek64(m_h, 0, SEEK_CUR);
-
2610 if (orig >= 0) {
-
2611 length = lseek64(m_h, 0, SEEK_END);
-
2612 lseek64(m_h, orig, SEEK_SET);
-
2613 }
-
2614 return length;
-
2615#endif
-
2616 }
+
2601
+
+
2602 virtual fsize_t size()
+
2603 {
+
2604#ifdef _WIN32
+
2605 LARGE_INTEGER li;
+
2606 li.LowPart = GetFileSize(m_h, (LPDWORD)&li.HighPart);
+
2607 if (li.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR)
+
2608 li.QuadPart = -1;
+
2609 return li.QuadPart;
+
2610#else
+
2611 off64_t length = -1, orig = lseek64(m_h, 0, SEEK_CUR);
+
2612 if (orig >= 0) {
+
2613 length = lseek64(m_h, 0, SEEK_END);
+
2614 lseek64(m_h, orig, SEEK_SET);
+
2615 }
+
2616 return length;
+
2617#endif
+
2618 }
-
2617
-
-
2618 virtual void truncate()
-
2619 {
-
2620#ifdef _WIN32
-
2621 if (SetEndOfFile(m_h)) {
-
2622 m_state = state_t::ok;
-
2623 return;
-
2624 }
-
2625#else
-
2626 off64_t length = lseek64(m_h, 0, SEEK_CUR);
-
2627 if (length >= 0 && ftruncate64(m_h, length) >= 0) {
-
2628 m_state = state_t::ok;
-
2629 return;
-
2630 }
-
2631#endif
-
2632 m_state = state_t::fail;
-
2633 }
+
2619
+
+
2620 virtual void truncate()
+
2621 {
+
2622#ifdef _WIN32
+
2623 if (SetEndOfFile(m_h)) {
+
2624 m_state = state_t::ok;
+
2625 return;
+
2626 }
+
2627#else
+
2628 off64_t length = lseek64(m_h, 0, SEEK_CUR);
+
2629 if (length >= 0 && ftruncate64(m_h, length) >= 0) {
+
2630 m_state = state_t::ok;
+
2631 return;
+
2632 }
+
2633#endif
+
2634 m_state = state_t::fail;
+
2635 }
-
2634
-
2635#ifdef _WIN32
-
2636 static inline time_point ft2tp(_In_ const FILETIME& ft)
-
2637 {
-
2638#if _HAS_CXX20
-
2639 uint64_t t = (static_cast<int64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
-
2640#else
-
2641 uint64_t t = ((static_cast<int64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime) - 116444736000000000ll;
-
2642#endif
-
2643 return time_point(time_point::duration(t));
-
2644 }
-
2645
-
2646 static inline void tp2ft(_In_ time_point tp, _Out_ FILETIME& ft)
-
2647 {
-
2648#if _HAS_CXX20
-
2649 uint64_t t = tp.time_since_epoch().count();
-
2650#else
-
2651 uint64_t t = tp.time_since_epoch().count() + 116444736000000000ll;
-
2652#endif
-
2653 ft.dwHighDateTime = static_cast<DWORD>((t >> 32) & 0xffffffff);
-
2654 ft.dwLowDateTime = static_cast<DWORD>(t & 0xffffffff);
-
2655 }
-
2656#endif
-
2657
-
-
2658 virtual time_point ctime() const
-
2659 {
-
2660#ifdef _WIN32
-
2661 FILETIME ft;
-
2662 if (GetFileTime(m_h, &ft, nullptr, nullptr))
-
2663 return ft2tp(ft);
-
2664#endif
-
2665 return time_point::min();
-
2666 }
+
2636
+
2637#ifdef _WIN32
+
2638 static inline time_point ft2tp(_In_ const FILETIME& ft)
+
2639 {
+
2640#if _HAS_CXX20
+
2641 uint64_t t = (static_cast<int64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+
2642#else
+
2643 uint64_t t = ((static_cast<int64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime) - 116444736000000000ll;
+
2644#endif
+
2645 return time_point(time_point::duration(t));
+
2646 }
+
2647
+
2648 static inline void tp2ft(_In_ time_point tp, _Out_ FILETIME& ft)
+
2649 {
+
2650#if _HAS_CXX20
+
2651 uint64_t t = tp.time_since_epoch().count();
+
2652#else
+
2653 uint64_t t = tp.time_since_epoch().count() + 116444736000000000ll;
+
2654#endif
+
2655 ft.dwHighDateTime = static_cast<DWORD>((t >> 32) & 0xffffffff);
+
2656 ft.dwLowDateTime = static_cast<DWORD>(t & 0xffffffff);
+
2657 }
+
2658#endif
+
2659
+
+
2660 virtual time_point ctime() const
+
2661 {
+
2662#ifdef _WIN32
+
2663 FILETIME ft;
+
2664 if (GetFileTime(m_h, &ft, nullptr, nullptr))
+
2665 return ft2tp(ft);
+
2666#endif
+
2667 return time_point::min();
+
2668 }
-
2667
-
-
2668 virtual time_point atime() const
-
2669 {
-
2670#ifdef _WIN32
-
2671 FILETIME ft;
-
2672 if (GetFileTime(m_h, nullptr, &ft, nullptr))
-
2673 return ft2tp(ft);
-
2674#else
-
2675 struct stat buf;
-
2676 if (fstat(m_h, &buf) >= 0)
-
2677 return clock::from_time_t(buf.st_atime);
-
2678#endif
-
2679 return time_point::min();
-
2680 }
+
2669
+
+
2670 virtual time_point atime() const
+
2671 {
+
2672#ifdef _WIN32
+
2673 FILETIME ft;
+
2674 if (GetFileTime(m_h, nullptr, &ft, nullptr))
+
2675 return ft2tp(ft);
+
2676#else
+
2677 struct stat buf;
+
2678 if (fstat(m_h, &buf) >= 0)
+
2679 return clock::from_time_t(buf.st_atime);
+
2680#endif
+
2681 return time_point::min();
+
2682 }
-
2681
-
-
2682 virtual time_point mtime() const
-
2683 {
-
2684#ifdef _WIN32
-
2685 FILETIME ft;
-
2686 if (GetFileTime(m_h, nullptr, nullptr, &ft))
-
2687 return ft2tp(ft);
-
2688#else
-
2689 struct stat buf;
-
2690 if (fstat(m_h, &buf) >= 0)
-
2691 return clock::from_time_t(buf.st_mtime);
-
2692#endif
-
2693 return time_point::min();
-
2694 }
+
2683
+
+
2684 virtual time_point mtime() const
+
2685 {
+
2686#ifdef _WIN32
+
2687 FILETIME ft;
+
2688 if (GetFileTime(m_h, nullptr, nullptr, &ft))
+
2689 return ft2tp(ft);
+
2690#else
+
2691 struct stat buf;
+
2692 if (fstat(m_h, &buf) >= 0)
+
2693 return clock::from_time_t(buf.st_mtime);
+
2694#endif
+
2695 return time_point::min();
+
2696 }
-
2695
-
-
2696 virtual void set_ctime(time_point date)
-
2697 {
-
2698 assert(m_h != invalid_handle);
-
2699#ifdef _WIN32
-
2700 FILETIME ft;
-
2701 tp2ft(date, ft);
-
2702 if (SetFileTime(m_h, &ft, nullptr, nullptr))
-
2703 return;
-
2704#endif
-
2705 throw std::runtime_error("failed to set file ctime");
-
2706 }
+
2697
+
+
2698 virtual void set_ctime(time_point date)
+
2699 {
+
2700 assert(m_h != invalid_handle);
+
2701#ifdef _WIN32
+
2702 FILETIME ft;
+
2703 tp2ft(date, ft);
+
2704 if (SetFileTime(m_h, &ft, nullptr, nullptr))
+
2705 return;
+
2706#endif
+
2707 throw std::runtime_error("failed to set file ctime");
+
2708 }
-
2707
-
-
2708 virtual void set_atime(time_point date)
-
2709 {
-
2710 assert(m_h != invalid_handle);
-
2711#ifdef _WIN32
-
2712 FILETIME ft;
-
2713 tp2ft(date, ft);
-
2714 if (SetFileTime(m_h, nullptr, &ft, nullptr))
-
2715 return;
-
2716#else
-
2717 struct timespec ts[2] = {
-
2718 { date.time_since_epoch().count(), 0 },
-
2719 { 0, UTIME_OMIT },
-
2720 };
-
2721 if (futimens(m_h, ts) >= 0)
-
2722 return;
-
2723#endif
-
2724 throw std::runtime_error("failed to set file atime");
-
2725 }
+
2709
+
+
2710 virtual void set_atime(time_point date)
+
2711 {
+
2712 assert(m_h != invalid_handle);
+
2713#ifdef _WIN32
+
2714 FILETIME ft;
+
2715 tp2ft(date, ft);
+
2716 if (SetFileTime(m_h, nullptr, &ft, nullptr))
+
2717 return;
+
2718#else
+
2719 struct timespec ts[2] = {
+
2720 { date.time_since_epoch().count(), 0 },
+
2721 { 0, UTIME_OMIT },
+
2722 };
+
2723 if (futimens(m_h, ts) >= 0)
+
2724 return;
+
2725#endif
+
2726 throw std::runtime_error("failed to set file atime");
+
2727 }
-
2726
-
-
2727 virtual void set_mtime(time_point date)
-
2728 {
-
2729#ifdef _WIN32
-
2730 FILETIME ft;
-
2731 tp2ft(date, ft);
-
2732 if (SetFileTime(m_h, nullptr, nullptr, &ft))
-
2733 return;
-
2734#else
-
2735 struct timespec ts[2] = {
-
2736 { 0, UTIME_OMIT },
-
2737 { date.time_since_epoch().count(), 0 },
-
2738 };
-
2739 if (futimens(m_h, ts) >= 0)
-
2740 return;
-
2741#endif
-
2742 throw std::runtime_error("failed to set file mtime");
-
2743 }
+
2728
+
+
2729 virtual void set_mtime(time_point date)
+
2730 {
+
2731#ifdef _WIN32
+
2732 FILETIME ft;
+
2733 tp2ft(date, ft);
+
2734 if (SetFileTime(m_h, nullptr, nullptr, &ft))
+
2735 return;
+
2736#else
+
2737 struct timespec ts[2] = {
+
2738 { 0, UTIME_OMIT },
+
2739 { date.time_since_epoch().count(), 0 },
+
2740 };
+
2741 if (futimens(m_h, ts) >= 0)
+
2742 return;
+
2743#endif
+
2744 throw std::runtime_error("failed to set file mtime");
+
2745 }
-
2744 };
+
2746 };
-
2745#pragma warning(pop)
-
2746
-
-
2750 class cached_file : public cache
-
2751 {
-
2752 public:
-
2753 cached_file(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok, _In_ size_t cache_size = default_cache_size) :
-
2754 cache(cache_size),
-
2755 m_source(h, state)
-
2756 {
-
2757 init(m_source);
-
2758 }
-
2759
-
-
2767 cached_file(_In_z_ const schar_t* filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) :
-
2768 cache(cache_size),
-
2769 m_source(filename, mode & mode_for_writing ? mode | mode_for_reading : mode)
-
2770 {
-
2771 init(m_source);
-
2772 }
+
2747#pragma warning(pop)
+
2748
+
+
2752 class cached_file : public cache
+
2753 {
+
2754 public:
+
2755 cached_file(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok, _In_ size_t cache_size = default_cache_size) :
+
2756 cache(cache_size),
+
2757 m_source(h, state)
+
2758 {
+
2759 init(m_source);
+
2760 }
+
2761
+
+
2769 cached_file(_In_z_ const schar_t* filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) :
+
2770 cache(cache_size),
+
2771 m_source(filename, mode & mode_for_writing ? mode | mode_for_reading : mode)
+
2772 {
+
2773 init(m_source);
+
2774 }
-
2773
-
2774 virtual ~cached_file()
-
2775 {
-
2776 done();
-
2777 }
-
2778
-
-
2785 void open(_In_z_ const schar_t* filename, _In_ int mode)
-
2786 {
-
2787 invalidate_cache();
-
2788 if (!ok()) _Unlikely_{
-
2789 m_state = state_t::fail;
-
2790 return;
-
2791 }
-
2792 m_source.open(filename, mode & mode_for_writing ? mode | mode_for_reading : mode);
-
2793 if (m_source.ok()) {
-
2794#if SET_FILE_OP_TIMES
-
2795 m_atime = m_source.atime();
-
2796 m_mtime = m_source.mtime();
-
2797#endif
-
2798 m_offset = m_source.tell();
-
2799 m_state = state_t::ok;
-
2800 return;
-
2801 }
-
2802 m_state = state_t::fail;
-
2803 }
+
2775
+
2776 virtual ~cached_file()
+
2777 {
+
2778 done();
+
2779 }
+
2780
+
+
2787 void open(_In_z_ const schar_t* filename, _In_ int mode)
+
2788 {
+
2789 invalidate_cache();
+
2790 if (!ok()) _Unlikely_{
+
2791 m_state = state_t::fail;
+
2792 return;
+
2793 }
+
2794 m_source.open(filename, mode & mode_for_writing ? mode | mode_for_reading : mode);
+
2795 if (m_source.ok()) {
+
2796#if SET_FILE_OP_TIMES
+
2797 m_atime = m_source.atime();
+
2798 m_mtime = m_source.mtime();
+
2799#endif
+
2800 m_offset = m_source.tell();
+
2801 m_state = state_t::ok;
+
2802 return;
+
2803 }
+
2804 m_state = state_t::fail;
+
2805 }
-
2804
-
2805 protected:
-
2806 file m_source;
-
2807 };
+
2806
+
2807 protected:
+
2808 file m_source;
+
2809 };
-
2808
-
- -
2813 {
-
2814 public:
-
2815 memory_file(_In_ state_t state = state_t::ok) :
-
2816 basic(state),
-
2817 m_data(nullptr),
-
2818 m_offset(0),
-
2819 m_size(0),
-
2820 m_reserved(0),
-
2821 m_manage(true)
-
2822 {
-
2823#if SET_FILE_OP_TIMES
-
2824 m_ctime = m_atime = m_mtime = time_point::now();
-
2825#endif
-
2826 }
-
2827
-
-
2834 memory_file(_In_ size_t size, _In_ state_t state = state_t::ok) :
-
2835 basic(state),
-
2836 m_data(reinterpret_cast<uint8_t*>(malloc(size))),
-
2837 m_offset(0),
-
2838 m_size(0),
- -
2840 m_manage(true)
-
2841 {
-
2842 if (!m_data)
-
2843 throw std::bad_alloc();
-
2844#if SET_FILE_OP_TIMES
-
2845 m_ctime = m_atime = m_mtime = time_point::now();
-
2846#endif
-
2847 }
+
2810
+
+ +
2815 {
+
2816 public:
+
2817 memory_file(_In_ state_t state = state_t::ok) :
+
2818 basic(state),
+
2819 m_data(nullptr),
+
2820 m_offset(0),
+
2821 m_size(0),
+
2822 m_reserved(0),
+
2823 m_manage(true)
+
2824 {
+
2825#if SET_FILE_OP_TIMES
+
2826 m_ctime = m_atime = m_mtime = time_point::now();
+
2827#endif
+
2828 }
+
2829
+
+
2836 memory_file(_In_ size_t size, _In_ state_t state = state_t::ok) :
+
2837 basic(state),
+
2838 m_data(reinterpret_cast<uint8_t*>(malloc(size))),
+
2839 m_offset(0),
+
2840 m_size(0),
+ +
2842 m_manage(true)
+
2843 {
+
2844 if (!m_data)
+
2845 throw std::bad_alloc();
+
2846#if SET_FILE_OP_TIMES
+
2847 m_ctime = m_atime = m_mtime = time_point::now();
+
2848#endif
+
2849 }
-
2848
-
-
2858 memory_file(_Inout_ void* data, _In_ size_t size, _In_ size_t reserved, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
-
2859 basic(state),
-
2860 m_data(reinterpret_cast<uint8_t*>(data)),
-
2861 m_offset(0),
-
2862 m_size(size),
-
2863 m_reserved(reserved),
-
2864 m_manage(manage)
-
2865 {
-
2866 assert(data || !size);
-
2867 assert(reserved >= size);
-
2868#if SET_FILE_OP_TIMES
-
2869 m_ctime = m_atime = m_mtime = time_point::now();
-
2870#endif
-
2871 }
+
2850
+
+
2860 memory_file(_Inout_ void* data, _In_ size_t size, _In_ size_t reserved, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
+
2861 basic(state),
+
2862 m_data(reinterpret_cast<uint8_t*>(data)),
+
2863 m_offset(0),
+
2864 m_size(size),
+
2865 m_reserved(reserved),
+
2866 m_manage(manage)
+
2867 {
+
2868 assert(data || !size);
+
2869 assert(reserved >= size);
+
2870#if SET_FILE_OP_TIMES
+
2871 m_ctime = m_atime = m_mtime = time_point::now();
+
2872#endif
+
2873 }
-
2872
-
-
2881 memory_file(_Inout_ void* data, _In_ size_t size, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
-
2882 memory_file(data, size, size, manage, state)
-
2883 {}
+
2874
+
+
2883 memory_file(_Inout_ void* data, _In_ size_t size, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
+
2884 memory_file(data, size, size, manage, state)
+
2885 {}
-
2884
-
-
2891 memory_file(_In_z_ const schar_t* filename, _In_ int mode) : memory_file()
-
2892 {
-
2893 load(filename, mode);
-
2894 }
+
2886
+
+
2893 memory_file(_In_z_ const schar_t* filename, _In_ int mode) : memory_file()
+
2894 {
+
2895 load(filename, mode);
+
2896 }
-
2895
-
2896 virtual ~memory_file()
-
2897 {
-
2898 if (m_manage && m_data)
-
2899 free(m_data);
-
2900 }
-
2901
-
-
2908 void reserve(_In_ size_t required, _In_ bool tight = false) noexcept
-
2909 {
-
2910 if (required <= m_reserved && (!tight || required >= m_reserved)) {
-
2911 m_state = state_t::ok;
-
2912 return;
-
2913 }
-
2914 if (!m_manage) {
-
2915 m_state = state_t::fail;
-
2916 return;
-
2917 }
-
2918 size_t reserved = tight ? required : ((required + required / 4 + (default_block_size - 1)) / default_block_size) * default_block_size;
-
2919 auto data = reinterpret_cast<uint8_t*>(realloc(m_data, reserved));
-
2920 if (!data && reserved) _Unlikely_ {
-
2921 m_state = state_t::fail;
-
2922 return;
-
2923 }
-
2924 m_data = data;
-
2925 if (reserved < m_size)
-
2926 m_size = reserved;
-
2927 m_reserved = reserved;
-
2928 m_state = state_t::ok;
-
2929 }
+
2897
+
2898 virtual ~memory_file()
+
2899 {
+
2900 if (m_manage && m_data)
+
2901 free(m_data);
+
2902 }
+
2903
+
+
2910 void reserve(_In_ size_t required, _In_ bool tight = false) noexcept
+
2911 {
+
2912 if (required <= m_reserved && (!tight || required >= m_reserved)) {
+
2913 m_state = state_t::ok;
+
2914 return;
+
2915 }
+
2916 if (!m_manage) {
+
2917 m_state = state_t::fail;
+
2918 return;
+
2919 }
+
2920 size_t reserved = tight ? required : ((required + required / 4 + (default_block_size - 1)) / default_block_size) * default_block_size;
+
2921 auto data = reinterpret_cast<uint8_t*>(realloc(m_data, reserved));
+
2922 if (!data && reserved) _Unlikely_ {
+
2923 m_state = state_t::fail;
+
2924 return;
+
2925 }
+
2926 m_data = data;
+
2927 if (reserved < m_size)
+
2928 m_size = reserved;
+
2929 m_reserved = reserved;
+
2930 m_state = state_t::ok;
+
2931 }
-
2930
-
-
2937 void load(_In_z_ const schar_t* filename, _In_ int mode)
-
2938 {
-
2939 file f(filename, (mode & ~hint_random_access) | mode_for_reading | hint_sequential_access);
-
2940 if (!f.ok()) {
-
2941 m_state = state_t::fail;
-
2942 return;
-
2943 }
-
2944 fsize_t size = f.size();
-
2945 if (size > SIZE_MAX) {
-
2946 m_state = state_t::fail;
-
2947 return;
-
2948 }
-
2949 reserve(static_cast<size_t>(size), true);
-
2950 if (!ok()) _Unlikely_ {
-
2951 return;
-
2952 }
-
2953 m_offset = m_size = 0;
-
2954 write_stream(f);
-
2955 if (ok())
-
2956 m_offset = 0;
-
2957#if SET_FILE_OP_TIMES
-
2958 m_ctime = f.ctime();
-
2959 m_atime = f.atime();
-
2960 m_mtime = f.mtime();
-
2961#endif
-
2962 }
+
2932
+
+
2939 void load(_In_z_ const schar_t* filename, _In_ int mode)
+
2940 {
+
2941 file f(filename, (mode & ~hint_random_access) | mode_for_reading | hint_sequential_access);
+
2942 if (!f.ok()) {
+
2943 m_state = state_t::fail;
+
2944 return;
+
2945 }
+
2946 fsize_t size = f.size();
+
2947 if (size > SIZE_MAX) {
+
2948 m_state = state_t::fail;
+
2949 return;
+
2950 }
+
2951 reserve(static_cast<size_t>(size), true);
+
2952 if (!ok()) _Unlikely_ {
+
2953 return;
+
2954 }
+
2955 m_offset = m_size = 0;
+
2956 write_stream(f);
+
2957 if (ok())
+
2958 m_offset = 0;
+
2959#if SET_FILE_OP_TIMES
+
2960 m_ctime = f.ctime();
+
2961 m_atime = f.atime();
+
2962 m_mtime = f.mtime();
+
2963#endif
+
2964 }
-
2963
-
-
2970 void save(_In_z_ const schar_t* filename, _In_ int mode)
-
2971 {
-
2972 file f(filename, (mode & ~hint_random_access) | mode_for_writing | hint_sequential_access);
-
2973 if (!f.ok()) {
-
2974 m_state = state_t::fail;
-
2975 return;
-
2976 }
-
2977 f.write(m_data, m_size);
-
2978 if (!f.ok()) {
-
2979 m_state = state_t::fail;
-
2980 return;
-
2981 }
-
2982 f.truncate();
-
2983#if SET_FILE_OP_TIMES
-
2984 f.set_ctime(m_ctime);
-
2985 f.set_atime(m_atime);
-
2986 f.set_mtime(m_mtime);
-
2987#endif
-
2988 }
+
2965
+
+
2972 void save(_In_z_ const schar_t* filename, _In_ int mode)
+
2973 {
+
2974 file f(filename, (mode & ~hint_random_access) | mode_for_writing | hint_sequential_access);
+
2975 if (!f.ok()) {
+
2976 m_state = state_t::fail;
+
2977 return;
+
2978 }
+
2979 f.write(m_data, m_size);
+
2980 if (!f.ok()) {
+
2981 m_state = state_t::fail;
+
2982 return;
+
2983 }
+
2984 f.truncate();
+
2985#if SET_FILE_OP_TIMES
+
2986 f.set_ctime(m_ctime);
+
2987 f.set_atime(m_atime);
+
2988 f.set_mtime(m_mtime);
+
2989#endif
+
2990 }
-
2989
-
2993 inline const void* data() const { return m_data; }
-
2994
-
-
2995 virtual _Success_(return != 0 || length == 0) size_t read(
-
2996 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
2997 {
-
2998 assert(data || !length);
-
2999#if SET_FILE_OP_TIMES
-
3000 m_atime = time_point::now();
-
3001#endif
-
3002 size_t available = m_size - m_offset;
-
3003 if (length <= available) {
-
3004 memcpy(data, m_data + m_offset, length);
-
3005 m_offset += length;
-
3006 m_state = state_t::ok;
-
3007 return length;
-
3008 }
-
3009 if (length && !available) {
-
3010 m_state = state_t::eof;
-
3011 return 0;
-
3012 }
-
3013 memcpy(data, m_data + m_offset, available);
-
3014 m_offset += available;
-
3015 m_state = state_t::ok;
-
3016 return available;
-
3017 }
+
2991
+
2995 inline const void* data() const { return m_data; }
+
2996
+
+
2997 virtual _Success_(return != 0 || length == 0) size_t read(
+
2998 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
2999 {
+
3000 assert(data || !length);
+
3001#if SET_FILE_OP_TIMES
+
3002 m_atime = time_point::now();
+
3003#endif
+
3004 size_t available = m_size - m_offset;
+
3005 if (length <= available) {
+
3006 memcpy(data, m_data + m_offset, length);
+
3007 m_offset += length;
+
3008 m_state = state_t::ok;
+
3009 return length;
+
3010 }
+
3011 if (length && !available) {
+
3012 m_state = state_t::eof;
+
3013 return 0;
+
3014 }
+
3015 memcpy(data, m_data + m_offset, available);
+
3016 m_offset += available;
+
3017 m_state = state_t::ok;
+
3018 return available;
+
3019 }
-
3018
-
3033 template <class T>
-
- -
3035 {
-
3036#if SET_FILE_OP_TIMES
-
3037 m_atime = time_point::now();
-
3038#endif
-
3039 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
-
3040 data = 0;
-
3041 return *this;
-
3042 }
-
3043 size_t end_offset = m_offset + sizeof(T);
-
3044 if (end_offset <= m_size) {
-
3045 data = LE2HE(*reinterpret_cast<T*>(m_data + m_offset));
-
3046 m_offset = end_offset;
-
3047#if !CHECK_STREAM_STATE
-
3048 m_state = state_t::ok;
-
3049#endif
-
3050 }
-
3051 else {
-
3052 data = 0;
-
3053 m_offset = m_size;
-
3054 m_state = state_t::eof;
-
3055 }
-
3056 return *this;
-
3057 }
+
3020
+
3035 template <class T>
+
+ +
3037 {
+
3038#if SET_FILE_OP_TIMES
+
3039 m_atime = time_point::now();
+
3040#endif
+
3041 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
+
3042 data = 0;
+
3043 return *this;
+
3044 }
+
3045 size_t end_offset = m_offset + sizeof(T);
+
3046 if (end_offset <= m_size) {
+
3047 data = LE2HE(*reinterpret_cast<T*>(m_data + m_offset));
+
3048 m_offset = end_offset;
+
3049#if !CHECK_STREAM_STATE
+
3050 m_state = state_t::ok;
+
3051#endif
+
3052 }
+
3053 else {
+
3054 data = 0;
+
3055 m_offset = m_size;
+
3056 m_state = state_t::eof;
+
3057 }
+
3058 return *this;
+
3059 }
-
3058
-
3073 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
-
3074 memory_file& read_str(_Inout_ std::basic_string<_Elem, _Traits, _Ax>&data)
-
3075 {
-
3076#if SET_FILE_OP_TIMES
-
3077 m_atime = time_point::now();
-
3078#endif
-
3079 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
-
3080 data.clear();
-
3081 return *this;
-
3082 }
-
3083 size_t end_offset = m_offset + sizeof(uint32_t);
-
3084 if (end_offset <= m_size) {
-
3085 uint32_t num_chars = LE2HE(*reinterpret_cast<uint32_t*>(m_data + m_offset));
-
3086 m_offset = end_offset;
-
3087 end_offset = stdex::add(m_offset, stdex::mul(num_chars, sizeof(_Elem)));
-
3088 _Elem* start = reinterpret_cast<_Elem*>(m_data + m_offset);
-
3089 if (end_offset <= m_size) {
-
3090 data.assign(start, start + num_chars);
-
3091 m_offset = end_offset;
-
3092#if !CHECK_STREAM_STATE
-
3093 m_state = state_t::ok;
-
3094#endif
-
3095 return *this;
-
3096 }
-
3097 if (end_offset <= m_size)
-
3098 data.assign(start, reinterpret_cast<_Elem*>(m_data + m_size));
-
3099 }
-
3100 m_offset = m_size;
-
3101 m_state = state_t::eof;
-
3102 return *this;
-
3103 }
+
3060
+
3075 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
+
3076 memory_file& read_str(_Inout_ std::basic_string<_Elem, _Traits, _Ax>&data)
+
3077 {
+
3078#if SET_FILE_OP_TIMES
+
3079 m_atime = time_point::now();
+
3080#endif
+
3081 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
+
3082 data.clear();
+
3083 return *this;
+
3084 }
+
3085 size_t end_offset = m_offset + sizeof(uint32_t);
+
3086 if (end_offset <= m_size) {
+
3087 uint32_t num_chars = LE2HE(*reinterpret_cast<uint32_t*>(m_data + m_offset));
+
3088 m_offset = end_offset;
+
3089 end_offset = stdex::add(m_offset, stdex::mul(num_chars, sizeof(_Elem)));
+
3090 _Elem* start = reinterpret_cast<_Elem*>(m_data + m_offset);
+
3091 if (end_offset <= m_size) {
+
3092 data.assign(start, start + num_chars);
+
3093 m_offset = end_offset;
+
3094#if !CHECK_STREAM_STATE
+
3095 m_state = state_t::ok;
+
3096#endif
+
3097 return *this;
+
3098 }
+
3099 if (end_offset <= m_size)
+
3100 data.assign(start, reinterpret_cast<_Elem*>(m_data + m_size));
+
3101 }
+
3102 m_offset = m_size;
+
3103 m_state = state_t::eof;
+
3104 return *this;
+
3105 }
-
3104
-
-
3105 virtual _Success_(return != 0) size_t write(
-
3106 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
3107 {
-
3108 assert(data || !length);
-
3109#if SET_FILE_OP_TIMES
-
3110 m_atime = m_mtime = time_point::now();
-
3111#endif
-
3112 size_t end_offset = m_offset + length;
-
3113 if (end_offset > m_reserved) {
-
3114 reserve(end_offset);
-
3115 if (!ok()) _Unlikely_
-
3116 return 0;
-
3117 }
-
3118 memcpy(m_data + m_offset, data, length);
-
3119 m_offset = end_offset;
-
3120 if (m_offset > m_size)
-
3121 m_size = m_offset;
-
3122 m_state = state_t::ok;
-
3123 return length;
-
3124 }
+
3106
+
+
3107 virtual _Success_(return != 0) size_t write(
+
3108 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
3109 {
+
3110 assert(data || !length);
+
3111#if SET_FILE_OP_TIMES
+
3112 m_atime = m_mtime = time_point::now();
+
3113#endif
+
3114 size_t end_offset = m_offset + length;
+
3115 if (end_offset > m_reserved) {
+
3116 reserve(end_offset);
+
3117 if (!ok()) _Unlikely_
+
3118 return 0;
+
3119 }
+
3120 memcpy(m_data + m_offset, data, length);
+
3121 m_offset = end_offset;
+
3122 if (m_offset > m_size)
+
3123 m_size = m_offset;
+
3124 m_state = state_t::ok;
+
3125 return length;
+
3126 }
-
3125
-
-
3129 void write_byte(_In_ uint8_t byte, _In_ size_t amount = 1)
-
3130 {
-
3131#if SET_FILE_OP_TIMES
-
3132 m_atime = m_mtime = time_point::now();
-
3133#endif
-
3134 size_t end_offset = m_offset + amount;
-
3135 if (end_offset > m_reserved) {
-
3136 reserve(end_offset);
-
3137 if (!ok()) _Unlikely_
-
3138 return;
-
3139 }
-
3140 memset(m_data + m_offset, byte, amount);
-
3141 m_offset = end_offset;
-
3142 if (m_offset > m_size)
-
3143 m_size = m_offset;
-
3144 m_state = state_t::ok;
-
3145 }
+
3127
+
+
3131 void write_byte(_In_ uint8_t byte, _In_ size_t amount = 1)
+
3132 {
+
3133#if SET_FILE_OP_TIMES
+
3134 m_atime = m_mtime = time_point::now();
+
3135#endif
+
3136 size_t end_offset = m_offset + amount;
+
3137 if (end_offset > m_reserved) {
+
3138 reserve(end_offset);
+
3139 if (!ok()) _Unlikely_
+
3140 return;
+
3141 }
+
3142 memset(m_data + m_offset, byte, amount);
+
3143 m_offset = end_offset;
+
3144 if (m_offset > m_size)
+
3145 m_size = m_offset;
+
3146 m_state = state_t::ok;
+
3147 }
-
3146
-
3161 template <class T>
-
-
3162 inline memory_file& write_data(const T data)
-
3163 {
-
3164#if SET_FILE_OP_TIMES
-
3165 m_atime = m_mtime = time_point::now();
-
3166#endif
-
3167 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
-
3168 return *this;
-
3169 size_t end_offset = m_offset + sizeof(T);
-
3170 if (end_offset > m_reserved) {
-
3171 reserve(end_offset);
-
3172 if (!ok()) _Unlikely_
-
3173 return *this;
-
3174 }
-
3175 (*reinterpret_cast<T*>(m_data + m_offset)) = HE2LE(data);
-
3176 m_offset = end_offset;
-
3177 if (m_offset > m_size)
-
3178 m_size = m_offset;
-
3179#if !CHECK_STREAM_STATE
-
3180 m_state = state_t::ok;
-
3181#endif
-
3182 return *this;
-
3183 }
+
3148
+
3163 template <class T>
+
+
3164 inline memory_file& write_data(const T data)
+
3165 {
+
3166#if SET_FILE_OP_TIMES
+
3167 m_atime = m_mtime = time_point::now();
+
3168#endif
+
3169 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
+
3170 return *this;
+
3171 size_t end_offset = m_offset + sizeof(T);
+
3172 if (end_offset > m_reserved) {
+
3173 reserve(end_offset);
+
3174 if (!ok()) _Unlikely_
+
3175 return *this;
+
3176 }
+
3177 (*reinterpret_cast<T*>(m_data + m_offset)) = HE2LE(data);
+
3178 m_offset = end_offset;
+
3179 if (m_offset > m_size)
+
3180 m_size = m_offset;
+
3181#if !CHECK_STREAM_STATE
+
3182 m_state = state_t::ok;
+
3183#endif
+
3184 return *this;
+
3185 }
-
3184
-
3199 template <class T>
-
-
3200 inline memory_file& write_str(_In_z_ const T * data)
-
3201 {
-
3202#if SET_FILE_OP_TIMES
-
3203 m_atime = m_mtime = time_point::now();
-
3204#endif
-
3205 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
-
3206 return *this;
-
3207 size_t num_chars = stdex::strlen(data);
-
3208 if (num_chars > UINT32_MAX)
-
3209 throw std::invalid_argument("string too long");
-
3210 size_t size_chars = num_chars * sizeof(T);
-
3211 size_t size = sizeof(uint32_t) + size_chars;
-
3212 size_t end_offset = m_offset + size;
-
3213 if (end_offset > m_reserved) {
-
3214 reserve(end_offset);
-
3215 if (!ok()) _Unlikely_
-
3216 return *this;
-
3217 }
-
3218 auto p = m_data + m_offset;
-
3219 *reinterpret_cast<uint32_t*>(p) = HE2LE((uint32_t)num_chars);
-
3220 memcpy(p + sizeof(uint32_t), data, size_chars);
-
3221 m_offset = end_offset;
-
3222 if (m_offset > m_size)
-
3223 m_size = m_offset;
-
3224#if !CHECK_STREAM_STATE
-
3225 m_state = state_t::ok;
-
3226#endif
-
3227 return *this;
-
3228 }
+
3186
+
3201 template <class T>
+
+
3202 inline memory_file& write_str(_In_z_ const T * data)
+
3203 {
+
3204#if SET_FILE_OP_TIMES
+
3205 m_atime = m_mtime = time_point::now();
+
3206#endif
+
3207 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
+
3208 return *this;
+
3209 size_t num_chars = stdex::strlen(data);
+
3210 if (num_chars > UINT32_MAX)
+
3211 throw std::invalid_argument("string too long");
+
3212 size_t size_chars = num_chars * sizeof(T);
+
3213 size_t size = sizeof(uint32_t) + size_chars;
+
3214 size_t end_offset = m_offset + size;
+
3215 if (end_offset > m_reserved) {
+
3216 reserve(end_offset);
+
3217 if (!ok()) _Unlikely_
+
3218 return *this;
+
3219 }
+
3220 auto p = m_data + m_offset;
+
3221 *reinterpret_cast<uint32_t*>(p) = HE2LE((uint32_t)num_chars);
+
3222 memcpy(p + sizeof(uint32_t), data, size_chars);
+
3223 m_offset = end_offset;
+
3224 if (m_offset > m_size)
+
3225 m_size = m_offset;
+
3226#if !CHECK_STREAM_STATE
+
3227 m_state = state_t::ok;
+
3228#endif
+
3229 return *this;
+
3230 }
-
3229
-
-
3235 size_t write_stream(_Inout_ basic & stream, _In_ size_t amount = SIZE_MAX)
-
3236 {
-
3237#if SET_FILE_OP_TIMES
-
3238 m_atime = m_mtime = time_point::now();
-
3239#endif
-
3240 size_t num_read, dst_offset = m_offset, dst_size = m_offset;
-
3241 size_t num_copied = 0, to_write = amount;
-
3242 m_state = state_t::ok;
-
3243 if (amount != SIZE_MAX) {
-
3244 dst_size = stdex::add(dst_size, amount);
-
3245 reserve(dst_size);
-
3246 if (!ok()) _Unlikely_
-
3247 return 0;
-
3248 while (to_write) {
-
3249 num_read = stream.read(m_data + dst_offset, to_write);
-
3250 dst_size = dst_offset += num_read;
-
3251 num_copied += num_read;
-
3252 to_write -= num_read;
-
3253 if (!stream.ok()) {
-
3254 if (stream.state() != state_t::eof)
-
3255 m_state = state_t::fail;
-
3256 break;
-
3257 }
-
3258 };
-
3259 }
-
3260 else {
-
3261 size_t block_size;
-
3262 while (to_write) {
-
3263 block_size = std::min(to_write, default_block_size);
-
3264 dst_size = stdex::add(dst_size, block_size);
-
3265 reserve(dst_size);
-
3266 if (!ok()) _Unlikely_
-
3267 break;
-
3268 num_read = stream.read(m_data + dst_offset, block_size);
-
3269 dst_size = dst_offset += num_read;
-
3270 num_copied += num_read;
-
3271 to_write -= num_read;
-
3272 if (!stream.ok()) {
-
3273 if (stream.state() != state_t::eof)
-
3274 m_state = state_t::fail;
-
3275 break;
-
3276 }
-
3277 };
-
3278 }
-
3279 m_offset = dst_offset;
-
3280 if (m_offset > m_size)
-
3281 m_size = m_offset;
-
3282 return num_copied;
-
3283 }
+
3231
+
+
3237 size_t write_stream(_Inout_ basic & stream, _In_ size_t amount = SIZE_MAX)
+
3238 {
+
3239#if SET_FILE_OP_TIMES
+
3240 m_atime = m_mtime = time_point::now();
+
3241#endif
+
3242 size_t num_read, dst_offset = m_offset, dst_size = m_offset;
+
3243 size_t num_copied = 0, to_write = amount;
+
3244 m_state = state_t::ok;
+
3245 if (amount != SIZE_MAX) {
+
3246 dst_size = stdex::add(dst_size, amount);
+
3247 reserve(dst_size);
+
3248 if (!ok()) _Unlikely_
+
3249 return 0;
+
3250 while (to_write) {
+
3251 num_read = stream.read(m_data + dst_offset, to_write);
+
3252 dst_size = dst_offset += num_read;
+
3253 num_copied += num_read;
+
3254 to_write -= num_read;
+
3255 if (!stream.ok()) {
+
3256 if (stream.state() != state_t::eof)
+
3257 m_state = state_t::fail;
+
3258 break;
+
3259 }
+
3260 };
+
3261 }
+
3262 else {
+
3263 size_t block_size;
+
3264 while (to_write) {
+
3265 block_size = std::min(to_write, default_block_size);
+
3266 dst_size = stdex::add(dst_size, block_size);
+
3267 reserve(dst_size);
+
3268 if (!ok()) _Unlikely_
+
3269 break;
+
3270 num_read = stream.read(m_data + dst_offset, block_size);
+
3271 dst_size = dst_offset += num_read;
+
3272 num_copied += num_read;
+
3273 to_write -= num_read;
+
3274 if (!stream.ok()) {
+
3275 if (stream.state() != state_t::eof)
+
3276 m_state = state_t::fail;
+
3277 break;
+
3278 }
+
3279 };
+
3280 }
+
3281 m_offset = dst_offset;
+
3282 if (m_offset > m_size)
+
3283 m_size = m_offset;
+
3284 return num_copied;
+
3285 }
-
3284
-
-
3285 virtual void close()
-
3286 {
-
3287 if (m_manage && m_data)
-
3288 free(m_data);
-
3289 m_data = nullptr;
-
3290 m_manage = true;
-
3291 m_offset = 0;
-
3292 m_size = m_reserved = 0;
-
3293#if SET_FILE_OP_TIMES
-
3294 m_ctime = m_atime = m_mtime = time_point::min();
-
3295#endif
-
3296 m_state = state_t::ok;
-
3297 }
+
3286
+
+
3287 virtual void close()
+
3288 {
+
3289 if (m_manage && m_data)
+
3290 free(m_data);
+
3291 m_data = nullptr;
+
3292 m_manage = true;
+
3293 m_offset = 0;
+
3294 m_size = m_reserved = 0;
+
3295#if SET_FILE_OP_TIMES
+
3296 m_ctime = m_atime = m_mtime = time_point::min();
+
3297#endif
+
3298 m_state = state_t::ok;
+
3299 }
-
3298
-
-
3299 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
3300 {
-
3301 fpos_t target;
-
3302 switch (how) {
-
3303 case seek_t::beg: target = offset; break;
-
3304 case seek_t::cur: target = static_cast<fpos_t>(m_offset) + offset; break;
-
3305 case seek_t::end: target = static_cast<fpos_t>(m_size) + offset; break;
-
3306 default: throw std::invalid_argument("unknown seek origin");
-
3307 }
-
3308 if (target <= SIZE_MAX) {
-
3309 m_state = state_t::ok;
-
3310 return m_offset = static_cast<size_t>(target);
-
3311 }
-
3312 m_state = state_t::fail;
-
3313 return fpos_max;
-
3314 }
+
3300
+
+
3301 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
3302 {
+
3303 fpos_t target;
+
3304 switch (how) {
+
3305 case seek_t::beg: target = offset; break;
+
3306 case seek_t::cur: target = static_cast<fpos_t>(m_offset) + offset; break;
+
3307 case seek_t::end: target = static_cast<fpos_t>(m_size) + offset; break;
+
3308 default: throw std::invalid_argument("unknown seek origin");
+
3309 }
+
3310 if (target <= SIZE_MAX) {
+
3311 m_state = state_t::ok;
+
3312 return m_offset = static_cast<size_t>(target);
+
3313 }
+
3314 m_state = state_t::fail;
+
3315 return fpos_max;
+
3316 }
-
3315
-
-
3316 virtual fpos_t tell() const
-
3317 {
-
3318 return m_offset;
-
3319 }
+
3317
+
+
3318 virtual fpos_t tell() const
+
3319 {
+
3320 return m_offset;
+
3321 }
-
3320
-
-
3321 virtual fsize_t size()
-
3322 {
-
3323 return m_size;
-
3324 }
+
3322
+
+
3323 virtual fsize_t size()
+
3324 {
+
3325 return m_size;
+
3326 }
-
3325
-
-
3326 virtual void truncate()
-
3327 {
-
3328#if SET_FILE_OP_TIMES
-
3329 m_atime = m_mtime = time_point::now();
-
3330#endif
-
3331 m_size = m_offset;
- -
3333 }
+
3327
+
+
3328 virtual void truncate()
+
3329 {
+
3330#if SET_FILE_OP_TIMES
+
3331 m_atime = m_mtime = time_point::now();
+
3332#endif
+
3333 m_size = m_offset;
+ +
3335 }
-
3334
-
3335#if SET_FILE_OP_TIMES
-
3336 virtual time_point ctime() const
-
3337 {
-
3338 return m_ctime;
-
3339 }
-
3340
-
3341 virtual time_point atime() const
-
3342 {
-
3343 return m_atime;
-
3344 }
-
3345
-
3346 virtual time_point mtime() const
-
3347 {
-
3348 return m_mtime;
-
3349 }
-
3350
-
3351 virtual void set_ctime(time_point date)
-
3352 {
-
3353 m_ctime = date;
-
3354 }
-
3355
-
3356 virtual void set_atime(time_point date)
-
3357 {
-
3358 m_atime = date;
-
3359 }
-
3360
-
3361 virtual void set_mtime(time_point date)
-
3362 {
-
3363 m_mtime = date;
-
3364 }
-
3365#endif
-
3366
-
3367 protected:
-
3375 template <class T>
-
-
3376 inline void set(_In_ fpos_t offset, _In_ const T data)
-
3377 {
-
3378#if SET_FILE_OP_TIMES
-
3379 m_atime = m_mtime = time_point::now();
-
3380#endif
-
3381 assert(offset + sizeof(T) < m_size);
-
3382 (*reinterpret_cast<T*>(m_data + offset)) = HE2LE(data);
-
3383 }
+
3336
+
3337#if SET_FILE_OP_TIMES
+
3338 virtual time_point ctime() const
+
3339 {
+
3340 return m_ctime;
+
3341 }
+
3342
+
3343 virtual time_point atime() const
+
3344 {
+
3345 return m_atime;
+
3346 }
+
3347
+
3348 virtual time_point mtime() const
+
3349 {
+
3350 return m_mtime;
+
3351 }
+
3352
+
3353 virtual void set_ctime(time_point date)
+
3354 {
+
3355 m_ctime = date;
+
3356 }
+
3357
+
3358 virtual void set_atime(time_point date)
+
3359 {
+
3360 m_atime = date;
+
3361 }
+
3362
+
3363 virtual void set_mtime(time_point date)
+
3364 {
+
3365 m_mtime = date;
+
3366 }
+
3367#endif
+
3368
+
3369 protected:
+
3377 template <class T>
+
+
3378 inline void set(_In_ fpos_t offset, _In_ const T data)
+
3379 {
+
3380#if SET_FILE_OP_TIMES
+
3381 m_atime = m_mtime = time_point::now();
+
3382#endif
+
3383 assert(offset + sizeof(T) < m_size);
+
3384 (*reinterpret_cast<T*>(m_data + offset)) = HE2LE(data);
+
3385 }
-
3384
-
3385 public:
-
3386 inline void set(_In_ fpos_t offset, _In_ const int8_t data) { set<int8_t>(offset, data); }
-
3387 inline void set(_In_ fpos_t offset, _In_ const int16_t data) { set<int16_t>(offset, data); }
-
3388 inline void set(_In_ fpos_t offset, _In_ const int32_t data) { set<int32_t>(offset, data); }
-
3389 inline void set(_In_ fpos_t offset, _In_ const int64_t data) { set<int64_t>(offset, data); }
-
3390 inline void set(_In_ fpos_t offset, _In_ const uint8_t data) { set<uint8_t>(offset, data); }
-
3391 inline void set(_In_ fpos_t offset, _In_ const uint16_t data) { set<uint16_t>(offset, data); }
-
3392 inline void set(_In_ fpos_t offset, _In_ const uint32_t data) { set<uint32_t>(offset, data); }
-
3393 inline void set(_In_ fpos_t offset, _In_ const uint64_t data) { set<uint64_t>(offset, data); }
-
3394 inline void set(_In_ fpos_t offset, _In_ const float data) { set<float>(offset, data); }
-
3395 inline void set(_In_ fpos_t offset, _In_ const double data) { set<double>(offset, data); }
-
3396 inline void set(_In_ fpos_t offset, _In_ const char data) { set<char>(offset, data); }
-
3397#ifdef _NATIVE_WCHAR_T_DEFINED
-
3398 inline void set(_In_ fpos_t offset, _In_ const wchar_t data) { set<wchar_t>(offset, data); }
-
3399#endif
-
3400
-
3408 protected:
-
3409 template <class T>
-
-
3410 inline void get(_In_ fpos_t offset, _Out_ T & data)
-
3411 {
-
3412 assert(offset + sizeof(T) < m_size);
-
3413 data = LE2HE(*(T*)(m_data + offset));
-
3414#if SET_FILE_OP_TIMES
-
3415 m_atime = time_point::now();
-
3416#endif
-
3417 }
+
3386
+
3387 public:
+
3388 inline void set(_In_ fpos_t offset, _In_ const int8_t data) { set<int8_t>(offset, data); }
+
3389 inline void set(_In_ fpos_t offset, _In_ const int16_t data) { set<int16_t>(offset, data); }
+
3390 inline void set(_In_ fpos_t offset, _In_ const int32_t data) { set<int32_t>(offset, data); }
+
3391 inline void set(_In_ fpos_t offset, _In_ const int64_t data) { set<int64_t>(offset, data); }
+
3392 inline void set(_In_ fpos_t offset, _In_ const uint8_t data) { set<uint8_t>(offset, data); }
+
3393 inline void set(_In_ fpos_t offset, _In_ const uint16_t data) { set<uint16_t>(offset, data); }
+
3394 inline void set(_In_ fpos_t offset, _In_ const uint32_t data) { set<uint32_t>(offset, data); }
+
3395 inline void set(_In_ fpos_t offset, _In_ const uint64_t data) { set<uint64_t>(offset, data); }
+
3396 inline void set(_In_ fpos_t offset, _In_ const float data) { set<float>(offset, data); }
+
3397 inline void set(_In_ fpos_t offset, _In_ const double data) { set<double>(offset, data); }
+
3398 inline void set(_In_ fpos_t offset, _In_ const char data) { set<char>(offset, data); }
+
3399#ifdef _NATIVE_WCHAR_T_DEFINED
+
3400 inline void set(_In_ fpos_t offset, _In_ const wchar_t data) { set<wchar_t>(offset, data); }
+
3401#endif
+
3402
+
3410 protected:
+
3411 template <class T>
+
+
3412 inline void get(_In_ fpos_t offset, _Out_ T & data)
+
3413 {
+
3414 assert(offset + sizeof(T) < m_size);
+
3415 data = LE2HE(*(T*)(m_data + offset));
+
3416#if SET_FILE_OP_TIMES
+
3417 m_atime = time_point::now();
+
3418#endif
+
3419 }
-
3418
-
3419 public:
-
3420 inline void get(_In_ fpos_t offset, _Out_ int8_t & data) { get<int8_t>(offset, data); }
-
3421 inline void get(_In_ fpos_t offset, _Out_ int16_t & data) { get<int16_t>(offset, data); }
-
3422 inline void get(_In_ fpos_t offset, _Out_ int32_t & data) { get<int32_t>(offset, data); }
-
3423 inline void get(_In_ fpos_t offset, _Out_ int64_t & data) { get<int64_t>(offset, data); }
-
3424 inline void get(_In_ fpos_t offset, _Out_ uint8_t & data) { get<uint8_t>(offset, data); }
-
3425 inline void get(_In_ fpos_t offset, _Out_ uint16_t & data) { get<uint16_t>(offset, data); }
-
3426 inline void get(_In_ fpos_t offset, _Out_ uint32_t & data) { get<uint32_t>(offset, data); }
-
3427 inline void get(_In_ fpos_t offset, _Out_ uint64_t & data) { get<uint64_t>(offset, data); }
-
3428 inline void get(_In_ fpos_t offset, _Out_ float& data) { get<float>(offset, data); }
-
3429 inline void get(_In_ fpos_t offset, _Out_ double& data) { get<double>(offset, data); }
-
3430 inline void get(_In_ fpos_t offset, _Out_ char& data) { get<char>(offset, data); }
-
3431#ifdef _NATIVE_WCHAR_T_DEFINED
-
3432 inline void get(_In_ fpos_t offset, _Out_ wchar_t& data) { get<wchar_t>(offset, data); }
-
3433#endif
-
3434
-
3435 inline memory_file& operator <<(_In_ const int8_t data) { return write_data(data); }
-
3436 inline memory_file& operator >>(_Out_ int8_t & data) { return read_data(data); }
-
3437 inline memory_file& operator <<(_In_ const int16_t data) { return write_data(data); }
-
3438 inline memory_file& operator >>(_Out_ int16_t & data) { return read_data(data); }
-
3439 inline memory_file& operator <<(_In_ const int32_t data) { return write_data(data); }
-
3440 inline memory_file& operator >>(_Out_ int32_t & data) { return read_data(data); }
-
3441 inline memory_file& operator <<(_In_ const int64_t data) { return write_data(data); }
-
3442 inline memory_file& operator >>(_Out_ int64_t & data) { return read_data(data); }
-
3443 inline memory_file& operator <<(_In_ const uint8_t data) { return write_data(data); }
-
3444 inline memory_file& operator >>(_Out_ uint8_t & data) { return read_data(data); }
-
3445 inline memory_file& operator <<(_In_ const uint16_t data) { return write_data(data); }
-
3446 inline memory_file& operator >>(_Out_ uint16_t & data) { return read_data(data); }
-
3447 inline memory_file& operator <<(_In_ const uint32_t data) { return write_data(data); }
-
3448 inline memory_file& operator >>(_Out_ uint32_t & data) { return read_data(data); }
-
3449 inline memory_file& operator <<(_In_ const uint64_t data) { return write_data(data); }
-
3450 inline memory_file& operator >>(_Out_ uint64_t & data) { return read_data(data); }
-
3451 inline memory_file& operator <<(_In_ const float data) { return write_data(data); }
-
3452 inline memory_file& operator >>(_Out_ float& data) { return read_data(data); }
-
3453 inline memory_file& operator <<(_In_ const double data) { return write_data(data); }
-
3454 inline memory_file& operator >>(_Out_ double& data) { return read_data(data); }
-
3455 inline memory_file& operator <<(_In_ const char data) { return write_data(data); }
-
3456 inline memory_file& operator >>(_Out_ char& data) { return read_data(data); }
-
3457#ifdef _NATIVE_WCHAR_T_DEFINED
-
3458 inline memory_file& operator <<(_In_ const wchar_t data) { return write_data(data); }
-
3459 inline memory_file& operator >>(_Out_ wchar_t& data) { return read_data(data); }
-
3460#endif
-
3461 template <class T>
-
3462 inline memory_file& operator <<(_In_ const T * data) { return write_str(data); }
-
3463 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
3464 inline memory_file& operator >>(_Inout_ std::basic_string<_Elem, _Traits, _Ax>&data) { return read_str(data); }
-
3465
-
3466 protected:
-
3467 uint8_t* m_data;
- -
3469 size_t m_offset;
-
3470 size_t m_size;
-
3471 size_t m_reserved;
-
3472#if SET_FILE_OP_TIMES
-
3473 time_point
-
3474 m_ctime,
-
3475 m_atime,
-
3476 m_mtime;
-
3477#endif
-
3478 };
+
3420
+
3421 public:
+
3422 inline void get(_In_ fpos_t offset, _Out_ int8_t & data) { get<int8_t>(offset, data); }
+
3423 inline void get(_In_ fpos_t offset, _Out_ int16_t & data) { get<int16_t>(offset, data); }
+
3424 inline void get(_In_ fpos_t offset, _Out_ int32_t & data) { get<int32_t>(offset, data); }
+
3425 inline void get(_In_ fpos_t offset, _Out_ int64_t & data) { get<int64_t>(offset, data); }
+
3426 inline void get(_In_ fpos_t offset, _Out_ uint8_t & data) { get<uint8_t>(offset, data); }
+
3427 inline void get(_In_ fpos_t offset, _Out_ uint16_t & data) { get<uint16_t>(offset, data); }
+
3428 inline void get(_In_ fpos_t offset, _Out_ uint32_t & data) { get<uint32_t>(offset, data); }
+
3429 inline void get(_In_ fpos_t offset, _Out_ uint64_t & data) { get<uint64_t>(offset, data); }
+
3430 inline void get(_In_ fpos_t offset, _Out_ float& data) { get<float>(offset, data); }
+
3431 inline void get(_In_ fpos_t offset, _Out_ double& data) { get<double>(offset, data); }
+
3432 inline void get(_In_ fpos_t offset, _Out_ char& data) { get<char>(offset, data); }
+
3433#ifdef _NATIVE_WCHAR_T_DEFINED
+
3434 inline void get(_In_ fpos_t offset, _Out_ wchar_t& data) { get<wchar_t>(offset, data); }
+
3435#endif
+
3436
+
3437 inline memory_file& operator <<(_In_ const int8_t data) { return write_data(data); }
+
3438 inline memory_file& operator >>(_Out_ int8_t & data) { return read_data(data); }
+
3439 inline memory_file& operator <<(_In_ const int16_t data) { return write_data(data); }
+
3440 inline memory_file& operator >>(_Out_ int16_t & data) { return read_data(data); }
+
3441 inline memory_file& operator <<(_In_ const int32_t data) { return write_data(data); }
+
3442 inline memory_file& operator >>(_Out_ int32_t & data) { return read_data(data); }
+
3443 inline memory_file& operator <<(_In_ const int64_t data) { return write_data(data); }
+
3444 inline memory_file& operator >>(_Out_ int64_t & data) { return read_data(data); }
+
3445 inline memory_file& operator <<(_In_ const uint8_t data) { return write_data(data); }
+
3446 inline memory_file& operator >>(_Out_ uint8_t & data) { return read_data(data); }
+
3447 inline memory_file& operator <<(_In_ const uint16_t data) { return write_data(data); }
+
3448 inline memory_file& operator >>(_Out_ uint16_t & data) { return read_data(data); }
+
3449 inline memory_file& operator <<(_In_ const uint32_t data) { return write_data(data); }
+
3450 inline memory_file& operator >>(_Out_ uint32_t & data) { return read_data(data); }
+
3451 inline memory_file& operator <<(_In_ const uint64_t data) { return write_data(data); }
+
3452 inline memory_file& operator >>(_Out_ uint64_t & data) { return read_data(data); }
+
3453 inline memory_file& operator <<(_In_ const float data) { return write_data(data); }
+
3454 inline memory_file& operator >>(_Out_ float& data) { return read_data(data); }
+
3455 inline memory_file& operator <<(_In_ const double data) { return write_data(data); }
+
3456 inline memory_file& operator >>(_Out_ double& data) { return read_data(data); }
+
3457 inline memory_file& operator <<(_In_ const char data) { return write_data(data); }
+
3458 inline memory_file& operator >>(_Out_ char& data) { return read_data(data); }
+
3459#ifdef _NATIVE_WCHAR_T_DEFINED
+
3460 inline memory_file& operator <<(_In_ const wchar_t data) { return write_data(data); }
+
3461 inline memory_file& operator >>(_Out_ wchar_t& data) { return read_data(data); }
+
3462#endif
+
3463 template <class T>
+
3464 inline memory_file& operator <<(_In_ const T * data) { return write_str(data); }
+
3465 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
3466 inline memory_file& operator >>(_Inout_ std::basic_string<_Elem, _Traits, _Ax>&data) { return read_str(data); }
+
3467
+
3468 protected:
+
3469 uint8_t* m_data;
+ +
3471 size_t m_offset;
+
3472 size_t m_size;
+
3473 size_t m_reserved;
+
3474#if SET_FILE_OP_TIMES
+
3475 time_point
+
3476 m_ctime,
+
3477 m_atime,
+
3478 m_mtime;
+
3479#endif
+
3480 };
-
3479
-
-
3483 class fifo : public basic {
-
3484 public:
-
3485 fifo() :
-
3486 m_offset(0),
-
3487 m_size(0),
-
3488 m_head(nullptr),
-
3489 m_tail(nullptr)
-
3490 {}
-
3491
-
3492 virtual ~fifo()
-
3493 {
-
3494 while (m_head) {
-
3495 auto p = m_head;
-
3496 m_head = p->next;
-
3497 delete p;
-
3498 }
-
3499 }
-
3500
-
3501#pragma warning(suppress: 6101) // See [2] below
-
-
3502 virtual _Success_(return != 0 || length == 0) size_t read(
-
3503 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
3504 {
-
3505 assert(data || !length);
-
3506 for (size_t to_read = length;;) {
-
3507 if (!m_head) _Unlikely_ {
-
3508 // [1] Code analysis misses length - to_read bytes were written to data in previous loop iterations.
-
3509 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
-
3510 return length - to_read;
-
3511 }
-
3512 size_t remaining = m_head->size - m_offset;
-
3513 if (remaining > to_read) {
-
3514 memcpy(data, m_head->data + m_offset, to_read);
-
3515 m_offset += to_read;
-
3516 m_size -= to_read;
-
3517 m_state = state_t::ok;
-
3518 return length;
-
3519 }
-
3520 memcpy(data, m_head->data + m_offset, remaining);
-
3521 m_offset = 0;
-
3522 m_size -= remaining;
-
3523 reinterpret_cast<uint8_t*&>(data) += remaining;
-
3524 to_read -= remaining;
-
3525 auto p = m_head;
-
3526 m_head = p->next;
-
3527 delete p;
-
3528 }
-
3529 }
+
3481
+
+
3485 class fifo : public basic {
+
3486 public:
+
3487 fifo() :
+
3488 m_offset(0),
+
3489 m_size(0),
+
3490 m_head(nullptr),
+
3491 m_tail(nullptr)
+
3492 {}
+
3493
+
3494 virtual ~fifo()
+
3495 {
+
3496 while (m_head) {
+
3497 auto p = m_head;
+
3498 m_head = p->next;
+
3499 delete p;
+
3500 }
+
3501 }
+
3502
+
3503#pragma warning(suppress: 6101) // See [2] below
+
+
3504 virtual _Success_(return != 0 || length == 0) size_t read(
+
3505 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
3506 {
+
3507 assert(data || !length);
+
3508 for (size_t to_read = length;;) {
+
3509 if (!m_head) _Unlikely_ {
+
3510 // [1] Code analysis misses length - to_read bytes were written to data in previous loop iterations.
+
3511 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
+
3512 return length - to_read;
+
3513 }
+
3514 size_t remaining = m_head->size - m_offset;
+
3515 if (remaining > to_read) {
+
3516 memcpy(data, m_head->data + m_offset, to_read);
+
3517 m_offset += to_read;
+
3518 m_size -= to_read;
+
3519 m_state = state_t::ok;
+
3520 return length;
+
3521 }
+
3522 memcpy(data, m_head->data + m_offset, remaining);
+
3523 m_offset = 0;
+
3524 m_size -= remaining;
+
3525 reinterpret_cast<uint8_t*&>(data) += remaining;
+
3526 to_read -= remaining;
+
3527 auto p = m_head;
+
3528 m_head = p->next;
+
3529 delete p;
+
3530 }
+
3531 }
-
3530
-
-
3531 virtual _Success_(return != 0) size_t write(
-
3532 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
3533 {
-
3534 assert(data || !length);
-
3535 try {
-
3536 std::unique_ptr<node_t> n(reinterpret_cast<node_t*>(new uint8_t[sizeof(node_t) + length]));
-
3537 n->next = nullptr;
-
3538 n->size = length;
-
3539 memcpy(n->data, data, length);
-
3540 m_size += length;
-
3541 if (m_head)
-
3542 m_tail = m_tail->next = n.release();
-
3543 else
-
3544 m_head = m_tail = n.release();
-
3545 m_state = state_t::ok;
-
3546 return length;
-
3547 }
-
3548 catch (const std::bad_alloc&) {
-
3549 m_state = state_t::fail;
-
3550 return 0;
-
3551 }
-
3552 }
+
3532
+
+
3533 virtual _Success_(return != 0) size_t write(
+
3534 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
3535 {
+
3536 assert(data || !length);
+
3537 try {
+
3538 std::unique_ptr<node_t> n(reinterpret_cast<node_t*>(new uint8_t[sizeof(node_t) + length]));
+
3539 n->next = nullptr;
+
3540 n->size = length;
+
3541 memcpy(n->data, data, length);
+
3542 m_size += length;
+
3543 if (m_head)
+
3544 m_tail = m_tail->next = n.release();
+
3545 else
+
3546 m_head = m_tail = n.release();
+
3547 m_state = state_t::ok;
+
3548 return length;
+
3549 }
+
3550 catch (const std::bad_alloc&) {
+
3551 m_state = state_t::fail;
+
3552 return 0;
+
3553 }
+
3554 }
-
3553
-
-
3554 virtual void close()
-
3555 {
-
3556 m_size = m_offset = 0;
-
3557 while (m_head) {
-
3558 auto p = m_head;
-
3559 m_head = p->next;
-
3560 delete p;
-
3561 }
-
3562 m_state = state_t::ok;
-
3563 }
+
3555
+
+
3556 virtual void close()
+
3557 {
+
3558 m_size = m_offset = 0;
+
3559 while (m_head) {
+
3560 auto p = m_head;
+
3561 m_head = p->next;
+
3562 delete p;
+
3563 }
+
3564 m_state = state_t::ok;
+
3565 }
-
3564
-
3568 inline size_t size() const { return m_size; };
-
3569
-
3570 protected:
-
3571 size_t m_offset, m_size;
-
-
3572 struct node_t {
-
3573 node_t* next;
-
3574 size_t size;
-
3575#pragma warning(suppress:4200)
-
3576 uint8_t data[0];
-
3577 } *m_head, * m_tail;
+
3566
+
3570 inline size_t size() const { return m_size; };
+
3571
+
3572 protected:
+
3573 size_t m_offset, m_size;
+
+
3574 struct node_t {
+
3575 node_t* next;
+
3576 size_t size;
+
3577#pragma warning(suppress:4200)
+
3578 uint8_t data[0];
+
3579 } *m_head, * m_tail;
-
3578 };
+
3580 };
-
3579
-
-
3583 class diag_file : public basic_file {
-
3584 public:
-
3585 diag_file(_In_count_(num_files) basic_file* const* files, _In_ size_t num_files) :
-
3586 basic(num_files ? files[0]->state() : state_t::fail),
-
3587 m_files(files, files + num_files)
-
3588 {
-
3589 }
-
3590
-
-
3591 virtual _Success_(return != 0 || length == 0) size_t read(
-
3592 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
3593 {
-
3594 assert(data || !length);
-
3595 if (m_files.empty()) {
-
3596 m_state = state_t::fail;
-
3597 return 0;
-
3598 }
-
3599 size_t result = m_files[0]->read(data, length);
-
3600 _Analysis_assume_(result <= length);
-
3601 m_state = m_files[0]->state();
-
3602 if (length > m_tmp.size())
-
3603 m_tmp.resize(length);
-
3604 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3605 if (m_files[i]->read(m_tmp.data(), length) != result ||
-
3606 memcmp(m_tmp.data(), data, result))
-
3607 throw std::runtime_error("read mismatch");
-
3608 if (m_files[i]->state() != m_state)
-
3609 throw std::runtime_error("state mismatch");
-
3610 }
-
3611 return result;
-
3612 }
+
3581
+
+
3585 class diag_file : public basic_file {
+
3586 public:
+
3587 diag_file(_In_count_(num_files) basic_file* const* files, _In_ size_t num_files) :
+
3588 basic(num_files ? files[0]->state() : state_t::fail),
+
3589 m_files(files, files + num_files)
+
3590 {
+
3591 }
+
3592
+
+
3593 virtual _Success_(return != 0 || length == 0) size_t read(
+
3594 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
3595 {
+
3596 assert(data || !length);
+
3597 if (m_files.empty()) {
+
3598 m_state = state_t::fail;
+
3599 return 0;
+
3600 }
+
3601 size_t result = m_files[0]->read(data, length);
+
3602 _Analysis_assume_(result <= length);
+
3603 m_state = m_files[0]->state();
+
3604 if (length > m_tmp.size())
+
3605 m_tmp.resize(length);
+
3606 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3607 if (m_files[i]->read(m_tmp.data(), length) != result ||
+
3608 memcmp(m_tmp.data(), data, result))
+
3609 throw std::runtime_error("read mismatch");
+
3610 if (m_files[i]->state() != m_state)
+
3611 throw std::runtime_error("state mismatch");
+
3612 }
+
3613 return result;
+
3614 }
-
3613
-
-
3614 virtual _Success_(return != 0) size_t write(
-
3615 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
3616 {
-
3617 if (m_files.empty()) {
-
3618 m_state = state_t::fail;
-
3619 return 0;
-
3620 }
-
3621 size_t result = m_files[0]->write(data, length);
-
3622 m_state = m_files[0]->state();
-
3623 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3624 if (m_files[i]->write(data, length) != result)
-
3625 throw std::runtime_error("write mismatch");
-
3626 if (m_files[i]->state() != m_state)
-
3627 throw std::runtime_error("state mismatch");
-
3628 }
-
3629 return result;
-
3630 }
+
3615
+
+
3616 virtual _Success_(return != 0) size_t write(
+
3617 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
3618 {
+
3619 if (m_files.empty()) {
+
3620 m_state = state_t::fail;
+
3621 return 0;
+
3622 }
+
3623 size_t result = m_files[0]->write(data, length);
+
3624 m_state = m_files[0]->state();
+
3625 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3626 if (m_files[i]->write(data, length) != result)
+
3627 throw std::runtime_error("write mismatch");
+
3628 if (m_files[i]->state() != m_state)
+
3629 throw std::runtime_error("state mismatch");
+
3630 }
+
3631 return result;
+
3632 }
-
3631
-
-
3632 virtual void flush()
-
3633 {
-
3634 if (m_files.empty()) {
-
3635 m_state = state_t::ok;
-
3636 return;
-
3637 }
-
3638 m_files[0]->flush();
-
3639 m_state = m_files[0]->state();
-
3640 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3641 m_files[i]->flush();
-
3642 if (m_files[i]->state() != m_state)
-
3643 throw std::runtime_error("state mismatch");
-
3644 }
-
3645 }
+
3633
+
+
3634 virtual void flush()
+
3635 {
+
3636 if (m_files.empty()) {
+
3637 m_state = state_t::ok;
+
3638 return;
+
3639 }
+
3640 m_files[0]->flush();
+
3641 m_state = m_files[0]->state();
+
3642 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3643 m_files[i]->flush();
+
3644 if (m_files[i]->state() != m_state)
+
3645 throw std::runtime_error("state mismatch");
+
3646 }
+
3647 }
-
3646
-
-
3647 virtual void close()
-
3648 {
-
3649 if (m_files.empty()) {
-
3650 m_state = state_t::ok;
-
3651 return;
-
3652 }
-
3653 m_files[0]->close();
-
3654 m_state = m_files[0]->state();
-
3655 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3656 m_files[i]->close();
-
3657 if (m_files[i]->state() != m_state)
-
3658 throw std::runtime_error("state mismatch");
-
3659 }
-
3660 m_tmp.clear();
-
3661 m_tmp.shrink_to_fit();
-
3662 }
+
3648
+
+
3649 virtual void close()
+
3650 {
+
3651 if (m_files.empty()) {
+
3652 m_state = state_t::ok;
+
3653 return;
+
3654 }
+
3655 m_files[0]->close();
+
3656 m_state = m_files[0]->state();
+
3657 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3658 m_files[i]->close();
+
3659 if (m_files[i]->state() != m_state)
+
3660 throw std::runtime_error("state mismatch");
+
3661 }
+
3662 m_tmp.clear();
+
3663 m_tmp.shrink_to_fit();
+
3664 }
-
3663
-
-
3664 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
3665 {
-
3666 if (m_files.empty()) {
-
3667 m_state = state_t::fail;
-
3668 return fpos_max;
-
3669 }
-
3670 fpos_t result = m_files[0]->seek(offset, how);
-
3671 m_state = m_files[0]->state();
-
3672 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3673 if (m_files[i]->seek(offset, how) != result)
-
3674 throw std::runtime_error("seek mismatch");
-
3675 if (m_files[i]->state() != m_state)
-
3676 throw std::runtime_error("state mismatch");
-
3677 }
-
3678 return result;
-
3679 }
+
3665
+
+
3666 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
3667 {
+
3668 if (m_files.empty()) {
+
3669 m_state = state_t::fail;
+
3670 return fpos_max;
+
3671 }
+
3672 fpos_t result = m_files[0]->seek(offset, how);
+
3673 m_state = m_files[0]->state();
+
3674 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3675 if (m_files[i]->seek(offset, how) != result)
+
3676 throw std::runtime_error("seek mismatch");
+
3677 if (m_files[i]->state() != m_state)
+
3678 throw std::runtime_error("state mismatch");
+
3679 }
+
3680 return result;
+
3681 }
-
3680
-
-
3681 virtual fpos_t tell() const
-
3682 {
-
3683 if (m_files.empty())
-
3684 return fpos_max;
-
3685 fpos_t result = m_files[0]->tell();
-
3686 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3687 if (m_files[i]->tell() != result)
-
3688 throw std::runtime_error("tell mismatch");
-
3689 }
-
3690 return result;
-
3691 }
+
3682
+
+
3683 virtual fpos_t tell() const
+
3684 {
+
3685 if (m_files.empty())
+
3686 return fpos_max;
+
3687 fpos_t result = m_files[0]->tell();
+
3688 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3689 if (m_files[i]->tell() != result)
+
3690 throw std::runtime_error("tell mismatch");
+
3691 }
+
3692 return result;
+
3693 }
-
3692
-
-
3693 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
-
3694 {
-
3695 if (m_files.empty())
-
3696 m_state = state_t::fail;
-
3697 m_files[0]->lock(offset, length);
-
3698 m_state = m_files[0]->state();
-
3699 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3700 m_files[i]->lock(offset, length);
-
3701 if (m_files[i]->state() != m_state)
-
3702 throw std::runtime_error("state mismatch");
-
3703 }
-
3704 }
+
3694
+
+
3695 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
+
3696 {
+
3697 if (m_files.empty())
+
3698 m_state = state_t::fail;
+
3699 m_files[0]->lock(offset, length);
+
3700 m_state = m_files[0]->state();
+
3701 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3702 m_files[i]->lock(offset, length);
+
3703 if (m_files[i]->state() != m_state)
+
3704 throw std::runtime_error("state mismatch");
+
3705 }
+
3706 }
-
3705
-
-
3706 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
-
3707 {
-
3708 if (m_files.empty())
-
3709 m_state = state_t::fail;
-
3710 m_files[0]->unlock(offset, length);
-
3711 m_state = m_files[0]->state();
-
3712 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3713 m_files[i]->unlock(offset, length);
-
3714 if (m_files[i]->state() != m_state)
-
3715 throw std::runtime_error("state mismatch");
-
3716 }
-
3717 }
+
3707
+
+
3708 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
+
3709 {
+
3710 if (m_files.empty())
+
3711 m_state = state_t::fail;
+
3712 m_files[0]->unlock(offset, length);
+
3713 m_state = m_files[0]->state();
+
3714 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3715 m_files[i]->unlock(offset, length);
+
3716 if (m_files[i]->state() != m_state)
+
3717 throw std::runtime_error("state mismatch");
+
3718 }
+
3719 }
-
3718
-
-
3719 virtual fsize_t size()
-
3720 {
-
3721 if (m_files.empty()) {
-
3722 m_state = state_t::fail;
-
3723 return 0;
-
3724 }
-
3725 fsize_t result = m_files[0]->size();
-
3726 m_state = m_files[0]->state();
-
3727 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3728 if (m_files[i]->size() != result)
-
3729 throw std::runtime_error("size mismatch");
-
3730 if (m_files[i]->state() != m_state)
-
3731 throw std::runtime_error("state mismatch");
-
3732 }
-
3733 return result;
-
3734 }
+
3720
+
+
3721 virtual fsize_t size()
+
3722 {
+
3723 if (m_files.empty()) {
+
3724 m_state = state_t::fail;
+
3725 return 0;
+
3726 }
+
3727 fsize_t result = m_files[0]->size();
+
3728 m_state = m_files[0]->state();
+
3729 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3730 if (m_files[i]->size() != result)
+
3731 throw std::runtime_error("size mismatch");
+
3732 if (m_files[i]->state() != m_state)
+
3733 throw std::runtime_error("state mismatch");
+
3734 }
+
3735 return result;
+
3736 }
-
3735
-
-
3736 virtual void truncate()
-
3737 {
-
3738 if (m_files.empty())
-
3739 m_state = state_t::fail;
-
3740 m_files[0]->truncate();
-
3741 m_state = m_files[0]->state();
-
3742 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
3743 m_files[i]->truncate();
-
3744 if (m_files[i]->state() != m_state)
-
3745 throw std::runtime_error("state mismatch");
-
3746 }
-
3747 }
+
3737
+
+
3738 virtual void truncate()
+
3739 {
+
3740 if (m_files.empty())
+
3741 m_state = state_t::fail;
+
3742 m_files[0]->truncate();
+
3743 m_state = m_files[0]->state();
+
3744 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
3745 m_files[i]->truncate();
+
3746 if (m_files[i]->state() != m_state)
+
3747 throw std::runtime_error("state mismatch");
+
3748 }
+
3749 }
-
3748
-
3749 protected:
-
3750 std::vector<basic_file*> m_files;
-
3751 std::vector<uint8_t> m_tmp;
-
3752 };
+
3750
+
3751 protected:
+
3752 std::vector<basic_file*> m_files;
+
3753 std::vector<uint8_t> m_tmp;
+
3754 };
-
3753 }
-
3754}
-
Provides read-ahead stream capability.
Definition stream.hpp:1118
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1132
-
Provides write-back stream capability.
Definition stream.hpp:1186
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1223
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1199
-
Basic seekable stream operations.
Definition stream.hpp:696
-
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:739
-
virtual time_point ctime() const
Returns file creation time.
Definition stream.hpp:786
-
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:755
+
3755 }
+
3756}
+
Provides read-ahead stream capability.
Definition stream.hpp:1120
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1134
+
Provides write-back stream capability.
Definition stream.hpp:1188
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1225
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1201
+
Basic seekable stream operations.
Definition stream.hpp:698
+
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:741
+
virtual time_point ctime() const
Returns file creation time.
Definition stream.hpp:788
+
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:757
virtual void truncate()=0
Sets file size - truncates the remainder of file content from the current file position to the end of...
-
charset_id read_charset(charset_id default_charset=charset_id::system)
Attempts to detect textfile charset based on UTF16 or UTF8 BOM.
Definition stream.hpp:859
-
fpos_t seekbeg(fpos_t offset)
Seeks to absolute file position.
Definition stream.hpp:723
-
virtual std::vector< uint8_t > read_remainder(size_t max_length=SIZE_MAX)
Reads and returns remainder of the stream.
Definition stream.hpp:698
-
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:828
-
fpos_t seekcur(foff_t offset)
Seeks to relative from current file position.
Definition stream.hpp:730
-
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:794
-
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:810
+
charset_id read_charset(charset_id default_charset=charset_id::system)
Attempts to detect textfile charset based on UTF16 or UTF8 BOM.
Definition stream.hpp:861
+
fpos_t seekbeg(fpos_t offset)
Seeks to absolute file position.
Definition stream.hpp:725
+
virtual std::vector< uint8_t > read_remainder(size_t max_length=SIZE_MAX)
Reads and returns remainder of the stream.
Definition stream.hpp:700
+
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:830
+
fpos_t seekcur(foff_t offset)
Seeks to relative from current file position.
Definition stream.hpp:732
+
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:796
+
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:812
virtual fsize_t size()=0
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
-
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:765
+
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:767
virtual fpos_t tell() const =0
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
-
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:802
-
fpos_t seekend(foff_t offset)
Seeks to relative from end file position.
Definition stream.hpp:737
-
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:819
+
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:804
+
fpos_t seekend(foff_t offset)
Seeks to relative from end file position.
Definition stream.hpp:739
+
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:821
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)=0
Seeks to specified relative file position.
-
OS data stream (file, pipe, socket...)
Definition stream.hpp:2064
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:2121
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:2179
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:2071
-
virtual void close()
Closes the stream.
Definition stream.hpp:2168
+
OS data stream (file, pipe, socket...)
Definition stream.hpp:2066
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:2123
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:2181
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:2073
+
virtual void close()
Closes the stream.
Definition stream.hpp:2170
‍UTF-8 byte-order-mark
Definition stream.hpp:76
-
bool ok() const
Returns true if the stream state is clean i.e. previous operation was succesful.
Definition stream.hpp:170
-
size_t write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)
Writes formatted string to the stream.
Definition stream.hpp:600
-
size_t write_array(_In_reads_or_z_opt_(num_chars) const wchar_t *wstr, size_t num_chars, charset_id charset)
Writes array of characters to the stream.
Definition stream.hpp:430
-
state_t state() const
Returns stream state after last operation.
Definition stream.hpp:165
-
basic & read_str(std::basic_string< _Elem, _Traits, _Ax > &data)
Reads length-prefixed string from the stream.
Definition stream.hpp:474
-
size_t write_sprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale,...)
Writes formatted string to the stream.
Definition stream.hpp:586
-
size_t write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)
Writes formatted string to the stream.
Definition stream.hpp:613
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:121
-
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:137
-
virtual void close()
Closes the stream.
Definition stream.hpp:129
-
uint8_t read_byte()
Reads one byte of data.
Definition stream.hpp:205
-
virtual std::vector< uint8_t > read_remainder(size_t max_length=SIZE_MAX)
Reads and returns remainder of the stream.
Definition stream.hpp:179
-
size_t write_sprintf(_Printf_format_string_params_(2) const char *format, locale_t locale,...)
Writes formatted string to the stream.
Definition stream.hpp:572
-
size_t readln_and_attach(std::basic_string< wchar_t, _Traits, _Ax > &wstr, charset_id charset)
Reads stream to the end-of-line or end-of-file and append to str.
Definition stream.hpp:363
-
size_t readln(std::basic_string< char, _Traits, _Ax > &str)
Reads stream to the end-of-line or end-of-file.
Definition stream.hpp:301
-
size_t readln_and_attach(std::basic_string< _Elem, _Traits, _Ax > &str)
Reads stream to the end-of-line or end-of-file and append to str.
Definition stream.hpp:342
-
size_t read_array(_Out_writes_bytes_(size *count) void *array, size_t size, size_t count)
Reads an array of data from the stream.
Definition stream.hpp:378
-
basic & write_str(const T *data)
Writes string to the stream length-prefixed.
Definition stream.hpp:499
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:91
-
size_t readln(std::basic_string< wchar_t, _Traits, _Ax > &wstr)
Reads stream to the end-of-line or end-of-file.
Definition stream.hpp:313
-
void write_charset(charset_id charset)
Writes UTF8 or UTF-16 byte-order-mark.
Definition stream.hpp:559
-
size_t readln(std::basic_string< wchar_t, _Traits, _Ax > &wstr, charset_id charset)
Reads stream to the end-of-line or end-of-file.
Definition stream.hpp:325
-
size_t write_array(const wchar_t *wstr, charset_id charset)
Writes array of characters to the stream.
Definition stream.hpp:409
-
basic & write_data(const T data)
Writes one primitive data type.
Definition stream.hpp:282
-
fsize_t write_stream(basic &stream, fsize_t amount=fsize_max)
Writes content of another stream.
Definition stream.hpp:534
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:109
-
size_t write_array(const std::basic_string< wchar_t, _Traits, _Ax > &wstr, charset_id charset)
Writes array of characters to the stream.
Definition stream.hpp:451
-
size_t write_array(_In_reads_bytes_opt_(size *count) const void *array, size_t size, size_t count)
Writes an array of data to the stream.
Definition stream.hpp:396
-
void write_byte(uint8_t byte, fsize_t amount=1)
Writes a byte of data.
Definition stream.hpp:216
-
basic & read_data(T &data)
Reads one primitive data type.
Definition stream.hpp:254
-
Buffered read/write stream.
Definition stream.hpp:1257
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1367
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1285
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1321
-
Buffered OS data stream (file, pipe, socket...)
Definition stream.hpp:2193
-
Cached file.
Definition stream.hpp:1684
-
virtual time_point ctime() const
Returns file creation time.
Definition stream.hpp:1936
-
fpos_t m_offset
Logical absolute file position.
Definition stream.hpp:2052
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:1915
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1741
-
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:1941
-
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:1908
-
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:1902
-
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:1950
-
virtual void close()
Closes the stream.
Definition stream.hpp:1856
-
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:1972
-
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:1896
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1865
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1803
-
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:1959
-
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:1891
-
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:1964
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:1876
-
Cached file-system file.
Definition stream.hpp:2751
-
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2785
-
cached_file(const schar_t *filename, int mode, size_t cache_size=default_cache_size)
Opens file.
Definition stream.hpp:2767
-
Modifies data on the fly when reading from/writing to a source stream.
Definition stream.hpp:889
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:935
-
virtual void close()
Closes the stream.
Definition stream.hpp:929
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:913
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:921
-
Compares multiple files to perform the same.
Definition stream.hpp:3583
-
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3719
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3736
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:3614
-
virtual void close()
Closes the stream.
Definition stream.hpp:3647
-
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:3693
-
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:3706
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3664
-
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:3681
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:3632
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:3591
-
In-memory FIFO queue.
Definition stream.hpp:3483
-
virtual void close()
Closes the stream.
Definition stream.hpp:3554
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:3531
-
size_t size() const
Returns total size of pending data in the queue.
Definition stream.hpp:3568
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:3502
-
Limits file reading/writing to a predefined window.
Definition stream.hpp:1574
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:1667
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1617
-
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:1630
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:1623
-
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:1662
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1597
-
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:1642
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1583
-
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:1652
-
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:1636
-
virtual void close()
Closes the stream.
Definition stream.hpp:1611
-
File-system file.
Definition stream.hpp:2434
-
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:2682
-
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:2575
-
file(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2444
-
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:2696
-
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:2668
-
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2455
-
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:2727
-
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:2708
-
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:2552
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:2618
-
virtual time_point ctime() const
Returns file creation time.
Definition stream.hpp:2658
-
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:2600
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:2513
-
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:2534
-
Limits reading from/writing to stream to a predefined number of bytes.
Definition stream.hpp:1415
-
fsize_t read_limit
Number of bytes left that may be read from the stream.
Definition stream.hpp:1475
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1423
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1448
-
fsize_t write_limit
Number of bytes left, that can be written to the stream.
Definition stream.hpp:1476
-
In-memory file.
Definition stream.hpp:2813
-
memory_file(const schar_t *filename, int mode)
Loads content from file-system file.
Definition stream.hpp:2891
-
size_t m_size
file size
Definition stream.hpp:3470
-
void get(fpos_t offset, T &data)
Reads data from specified file location This does not move file pointer. It checks for data size asse...
Definition stream.hpp:3410
-
size_t write_stream(basic &stream, size_t amount=SIZE_MAX)
Writes content of another stream.
Definition stream.hpp:3235
-
uint8_t * m_data
file data
Definition stream.hpp:3467
-
memory_file & read_data(T &data)
Reads one primitive data type.
Definition stream.hpp:3034
-
virtual void close()
Closes the stream.
Definition stream.hpp:3285
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:2995
-
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:3316
-
size_t m_reserved
reserved file size
Definition stream.hpp:3471
-
memory_file(size_t size, state_t state=state_t::ok)
Creates an empty file of reserved size.
Definition stream.hpp:2834
-
void reserve(size_t required, bool tight=false) noexcept
Reallocates memory.
Definition stream.hpp:2908
-
memory_file & read_str(std::basic_string< _Elem, _Traits, _Ax > &data)
Reads length-prefixed string from the stream.
Definition stream.hpp:3074
-
void write_byte(uint8_t byte, size_t amount=1)
Writes a byte of data.
Definition stream.hpp:3129
-
void set(fpos_t offset, const T data)
Writes data to specified file location This does not move file pointer nor update file size....
Definition stream.hpp:3376
-
size_t m_offset
file pointer
Definition stream.hpp:3469
-
void save(const schar_t *filename, int mode)
Saves content to a file-system file.
Definition stream.hpp:2970
-
void load(const schar_t *filename, int mode)
Loads content from a file-system file.
Definition stream.hpp:2937
-
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3321
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3299
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3326
-
memory_file & write_data(const T data)
Writes one primitive data type.
Definition stream.hpp:3162
-
memory_file & write_str(const T *data)
Writes string to the stream length-prefixed.
Definition stream.hpp:3200
-
bool m_manage
may reallocate m_data?
Definition stream.hpp:3468
-
memory_file(void *data, size_t size, bool manage=false, state_t state=state_t::ok)
Creates a file based on available data.
Definition stream.hpp:2881
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:3105
-
memory_file(void *data, size_t size, size_t reserved, bool manage=false, state_t state=state_t::ok)
Creates a file based on available data.
Definition stream.hpp:2858
-
const void * data() const
Returns pointer to data.
Definition stream.hpp:2993
-
Definition stream.hpp:1032
+
bool ok() const
Returns true if the stream state is clean i.e. previous operation was succesful.
Definition stream.hpp:172
+
size_t write_vsprintf(_Printf_format_string_params_(2) const char *format, locale_t locale, va_list params)
Writes formatted string to the stream.
Definition stream.hpp:602
+
size_t write_array(_In_reads_or_z_opt_(num_chars) const wchar_t *wstr, size_t num_chars, charset_id charset)
Writes array of characters to the stream.
Definition stream.hpp:432
+
state_t state() const
Returns stream state after last operation.
Definition stream.hpp:167
+
basic & read_str(std::basic_string< _Elem, _Traits, _Ax > &data)
Reads length-prefixed string from the stream.
Definition stream.hpp:476
+
size_t write_sprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale,...)
Writes formatted string to the stream.
Definition stream.hpp:588
+
size_t write_vsprintf(_Printf_format_string_params_(2) const wchar_t *format, locale_t locale, va_list params)
Writes formatted string to the stream.
Definition stream.hpp:615
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:123
+
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:139
+
virtual void close()
Closes the stream.
Definition stream.hpp:131
+
uint8_t read_byte()
Reads one byte of data.
Definition stream.hpp:207
+
virtual std::vector< uint8_t > read_remainder(size_t max_length=SIZE_MAX)
Reads and returns remainder of the stream.
Definition stream.hpp:181
+
size_t write_sprintf(_Printf_format_string_params_(2) const char *format, locale_t locale,...)
Writes formatted string to the stream.
Definition stream.hpp:574
+
size_t readln_and_attach(std::basic_string< wchar_t, _Traits, _Ax > &wstr, charset_id charset)
Reads stream to the end-of-line or end-of-file and append to str.
Definition stream.hpp:365
+
size_t readln(std::basic_string< char, _Traits, _Ax > &str)
Reads stream to the end-of-line or end-of-file.
Definition stream.hpp:303
+
size_t readln_and_attach(std::basic_string< _Elem, _Traits, _Ax > &str)
Reads stream to the end-of-line or end-of-file and append to str.
Definition stream.hpp:344
+
size_t read_array(_Out_writes_bytes_(size *count) void *array, size_t size, size_t count)
Reads an array of data from the stream.
Definition stream.hpp:380
+
basic & write_str(const T *data)
Writes string to the stream length-prefixed.
Definition stream.hpp:501
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:93
+
size_t readln(std::basic_string< wchar_t, _Traits, _Ax > &wstr)
Reads stream to the end-of-line or end-of-file.
Definition stream.hpp:315
+
void write_charset(charset_id charset)
Writes UTF8 or UTF-16 byte-order-mark.
Definition stream.hpp:561
+
size_t readln(std::basic_string< wchar_t, _Traits, _Ax > &wstr, charset_id charset)
Reads stream to the end-of-line or end-of-file.
Definition stream.hpp:327
+
size_t write_array(const wchar_t *wstr, charset_id charset)
Writes array of characters to the stream.
Definition stream.hpp:411
+
basic & write_data(const T data)
Writes one primitive data type.
Definition stream.hpp:284
+
fsize_t write_stream(basic &stream, fsize_t amount=fsize_max)
Writes content of another stream.
Definition stream.hpp:536
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:111
+
size_t write_array(const std::basic_string< wchar_t, _Traits, _Ax > &wstr, charset_id charset)
Writes array of characters to the stream.
Definition stream.hpp:453
+
size_t write_array(_In_reads_bytes_opt_(size *count) const void *array, size_t size, size_t count)
Writes an array of data to the stream.
Definition stream.hpp:398
+
void write_byte(uint8_t byte, fsize_t amount=1)
Writes a byte of data.
Definition stream.hpp:218
+
basic & read_data(T &data)
Reads one primitive data type.
Definition stream.hpp:256
+
Buffered read/write stream.
Definition stream.hpp:1259
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1369
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1287
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1323
+
Buffered OS data stream (file, pipe, socket...)
Definition stream.hpp:2195
+
Cached file.
Definition stream.hpp:1686
+
virtual time_point ctime() const
Returns file creation time.
Definition stream.hpp:1938
+
fpos_t m_offset
Logical absolute file position.
Definition stream.hpp:2054
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:1917
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1743
+
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:1943
+
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:1910
+
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:1904
+
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:1952
+
virtual void close()
Closes the stream.
Definition stream.hpp:1858
+
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:1974
+
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:1898
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1867
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1805
+
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:1961
+
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:1893
+
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:1966
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:1878
+
Cached file-system file.
Definition stream.hpp:2753
+
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2787
+
cached_file(const schar_t *filename, int mode, size_t cache_size=default_cache_size)
Opens file.
Definition stream.hpp:2769
+
Modifies data on the fly when reading from/writing to a source stream.
Definition stream.hpp:891
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:937
+
virtual void close()
Closes the stream.
Definition stream.hpp:931
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:915
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:923
+
Compares multiple files to perform the same.
Definition stream.hpp:3585
+
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3721
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3738
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:3616
+
virtual void close()
Closes the stream.
Definition stream.hpp:3649
+
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:3695
+
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:3708
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3666
+
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:3683
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:3634
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:3593
+
In-memory FIFO queue.
Definition stream.hpp:3485
+
virtual void close()
Closes the stream.
Definition stream.hpp:3556
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:3533
+
size_t size() const
Returns total size of pending data in the queue.
Definition stream.hpp:3570
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:3504
+
Limits file reading/writing to a predefined window.
Definition stream.hpp:1576
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:1669
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1619
+
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:1632
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:1625
+
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:1664
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1599
+
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:1644
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1585
+
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:1654
+
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:1638
+
virtual void close()
Closes the stream.
Definition stream.hpp:1613
+
File-system file.
Definition stream.hpp:2436
+
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:2684
+
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:2577
+
file(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2446
+
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:2698
+
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:2670
+
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2457
+
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:2729
+
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:2710
+
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:2554
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:2620
+
virtual time_point ctime() const
Returns file creation time.
Definition stream.hpp:2660
+
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:2602
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:2515
+
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:2536
+
Limits reading from/writing to stream to a predefined number of bytes.
Definition stream.hpp:1417
+
fsize_t read_limit
Number of bytes left that may be read from the stream.
Definition stream.hpp:1477
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1425
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1450
+
fsize_t write_limit
Number of bytes left, that can be written to the stream.
Definition stream.hpp:1478
+
In-memory file.
Definition stream.hpp:2815
+
memory_file(const schar_t *filename, int mode)
Loads content from file-system file.
Definition stream.hpp:2893
+
size_t m_size
file size
Definition stream.hpp:3472
+
void get(fpos_t offset, T &data)
Reads data from specified file location This does not move file pointer. It checks for data size asse...
Definition stream.hpp:3412
+
size_t write_stream(basic &stream, size_t amount=SIZE_MAX)
Writes content of another stream.
Definition stream.hpp:3237
+
uint8_t * m_data
file data
Definition stream.hpp:3469
+
memory_file & read_data(T &data)
Reads one primitive data type.
Definition stream.hpp:3036
+
virtual void close()
Closes the stream.
Definition stream.hpp:3287
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:2997
+
virtual fpos_t tell() const
Returns absolute file position in file or fpos_max if fails. This method does not update stream state...
Definition stream.hpp:3318
+
size_t m_reserved
reserved file size
Definition stream.hpp:3473
+
memory_file(size_t size, state_t state=state_t::ok)
Creates an empty file of reserved size.
Definition stream.hpp:2836
+
void reserve(size_t required, bool tight=false) noexcept
Reallocates memory.
Definition stream.hpp:2910
+
memory_file & read_str(std::basic_string< _Elem, _Traits, _Ax > &data)
Reads length-prefixed string from the stream.
Definition stream.hpp:3076
+
void write_byte(uint8_t byte, size_t amount=1)
Writes a byte of data.
Definition stream.hpp:3131
+
void set(fpos_t offset, const T data)
Writes data to specified file location This does not move file pointer nor update file size....
Definition stream.hpp:3378
+
size_t m_offset
file pointer
Definition stream.hpp:3471
+
void save(const schar_t *filename, int mode)
Saves content to a file-system file.
Definition stream.hpp:2972
+
void load(const schar_t *filename, int mode)
Loads content from a file-system file.
Definition stream.hpp:2939
+
virtual fsize_t size()
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3323
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3301
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3328
+
memory_file & write_data(const T data)
Writes one primitive data type.
Definition stream.hpp:3164
+
memory_file & write_str(const T *data)
Writes string to the stream length-prefixed.
Definition stream.hpp:3202
+
bool m_manage
may reallocate m_data?
Definition stream.hpp:3470
+
memory_file(void *data, size_t size, bool manage=false, state_t state=state_t::ok)
Creates a file based on available data.
Definition stream.hpp:2883
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:3107
+
memory_file(void *data, size_t size, size_t reserved, bool manage=false, state_t state=state_t::ok)
Creates a file based on available data.
Definition stream.hpp:2860
+
const void * data() const
Returns pointer to data.
Definition stream.hpp:2995
+
Definition stream.hpp:1034
enum stdex::stream::replicator::worker::op_t op
Operation to perform.
-
size_t num_written
Number of bytes written.
Definition stream.hpp:1080
-
size_t length
Byte limit of data to write.
Definition stream.hpp:1079
-
const void * data
Data to write.
Definition stream.hpp:1078
-
Replicates writing of the same data to multiple streams.
Definition stream.hpp:949
-
void push_back(basic *source)
Adds stream on the list.
Definition stream.hpp:968
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1025
-
void remove(basic *source)
Removes stream from the list.
Definition stream.hpp:976
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:993
-
virtual void close()
Closes the stream.
Definition stream.hpp:1020
-
Limits reading from/writing to stream to a predefined window.
Definition stream.hpp:1483
-
fpos_t write_offset
Number of bytes to discard on write.
Definition stream.hpp:1567
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1524
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1491
-
fpos_t read_offset
Number of bytes to skip on read.
Definition stream.hpp:1566
+
size_t num_written
Number of bytes written.
Definition stream.hpp:1082
+
size_t length
Byte limit of data to write.
Definition stream.hpp:1081
+
const void * data
Data to write.
Definition stream.hpp:1080
+
Replicates writing of the same data to multiple streams.
Definition stream.hpp:951
+
void push_back(basic *source)
Adds stream on the list.
Definition stream.hpp:970
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1027
+
void remove(basic *source)
Removes stream from the list.
Definition stream.hpp:978
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:995
+
virtual void close()
Closes the stream.
Definition stream.hpp:1022
+
Limits reading from/writing to stream to a predefined window.
Definition stream.hpp:1485
+
fpos_t write_offset
Number of bytes to discard on write.
Definition stream.hpp:1569
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition stream.hpp:1526
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition stream.hpp:1493
+
fpos_t read_offset
Number of bytes to skip on read.
Definition stream.hpp:1568
Operating system object (file, pipe, anything with an OS handle etc.)
Definition system.hpp:88
virtual void close()
Closes object.
Definition system.hpp:129
Numerical interval.
Definition interval.hpp:18
@@ -3858,14 +3860,14 @@ $(document).ready(function() { init_codefold(0); });
T size() const
Returns interval size.
Definition interval.hpp:47
T end
interval end
Definition interval.hpp:20
T start
interval start
Definition interval.hpp:19
-
Definition stream.hpp:1392
-
Definition stream.hpp:2030
-
interval< fpos_t > region
valid data region
Definition stream.hpp:2038
-
Definition stream.hpp:3572
+
Definition stream.hpp:1394
+
Definition stream.hpp:2032
+
interval< fpos_t > region
valid data region
Definition stream.hpp:2040
+
Definition stream.hpp:3574
diff --git a/string_8hpp_source.html b/string_8hpp_source.html index cd30e9b95..2f38be4b5 100644 --- a/string_8hpp_source.html +++ b/string_8hpp_source.html @@ -348,586 +348,620 @@ $(document).ready(function() { init_codefold(0); });
401 return collate.compare(str1, str1 + count1, str2, str2 + count2);
402 }
403
-
414 template <class T1, class T2>
-
415 inline int strnicmp(
-
416 _In_reads_or_z_opt_(count1) const T1* str1, _In_ size_t count1,
-
417 _In_reads_or_z_opt_(count2) const T2* str2, _In_ size_t count2,
-
418 _In_ const std::locale& locale)
-
419 {
-
420 assert(str1 || !count1);
-
421 assert(str2 || !count2);
-
422 size_t i; T1 a; T2 b;
-
423 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
-
424 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
-
425 for (i = 0; i < count1 && i < count2 && ((a = ctype1.tolower(str1[i])) | (b = ctype2.tolower(str2[i]))); i++) {
-
426 if (a > b) return +1;
-
427 if (a < b) return -1;
-
428 }
-
429 if (i < count1 && str1[i]) return +1;
-
430 if (i < count2 && str2[i]) return -1;
-
431 return 0;
-
432 }
-
433
-
442 template <class T1, class T2>
-
443 inline size_t strstr(
-
444 _In_z_ const T1* str,
-
445 _In_z_ const T2* sample)
-
446 {
-
447 assert(str);
-
448 assert(sample);
-
449 for (size_t offset = 0;; ++offset) {
-
450 for (size_t i = offset, j = 0;; ++i, ++j) {
-
451 if (!sample[j])
-
452 return offset;
-
453 if (!str[i])
-
454 return npos;
-
455 if (str[i] != sample[j])
-
456 break;
-
457 }
-
458 }
-
459 }
-
460
-
470 template <class T1, class T2>
-
471 inline size_t strnstr(
-
472 _In_reads_or_z_opt_(count) const T1* str,
-
473 _In_ size_t count,
-
474 _In_z_ const T2* sample)
-
475 {
-
476 assert(str || !count);
-
477 assert(sample);
-
478 for (size_t offset = 0;; ++offset) {
-
479 for (size_t i = offset, j = 0;; ++i, ++j) {
-
480 if (!sample[j])
-
481 return offset;
-
482 if (i >= count || !str[i])
-
483 return npos;
-
484 if (str[i] != sample[j])
-
485 break;
-
486 }
-
487 }
-
488 }
-
489
-
498 template <class T1, class T2>
-
499 inline size_t stristr(
-
500 _In_z_ const T1* str,
-
501 _In_z_ const T2* sample,
-
502 _In_ const std::locale& locale)
-
503 {
-
504 assert(str);
-
505 assert(sample);
-
506 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
-
507 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
-
508 for (size_t offset = 0;; ++offset) {
-
509 for (size_t i = offset, j = 0;; ++i, ++j) {
-
510 if (!sample[j])
-
511 return offset;
-
512 if (!str[i])
-
513 return npos;
-
514 if (ctype1.tolower(str[i]) != ctype2.tolower(sample[j]))
-
515 break;
-
516 }
-
517 }
-
518 }
-
519
-
529 template <class T1, class T2>
-
530 inline size_t strnistr(
-
531 _In_reads_or_z_opt_(count) const T1* str,
-
532 _In_ size_t count,
-
533 _In_z_ const T2* sample,
-
534 _In_ const std::locale& locale)
-
535 {
-
536 assert(str || !count);
-
537 assert(sample);
-
538 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
-
539 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
-
540 for (size_t offset = 0;; ++offset) {
-
541 for (size_t i = offset, j = 0;; ++i, ++j) {
-
542 if (!sample[j])
-
543 return offset;
-
544 if (i >= count || !str[i])
-
545 return npos;
-
546 if (ctype1.tolower(str[i]) != ctype2.tolower(sample[j]))
-
547 break;
-
548 }
-
549 }
-
550 }
-
551
-
560 template <class T1, class T2>
-
561 inline size_t strcpy(
-
562 _Out_writes_z_(_String_length_(src) + 1) T1* dst,
-
563 _In_z_ const T2* src)
-
564 {
-
565 assert(dst && src);
-
566 for (size_t i = 0; ; ++i) {
-
567 if ((dst[i] = src[i]) == 0)
-
568 return i;
-
569 }
-
570 }
-
571
-
581 template <class T1, class T2>
-
582 inline size_t strncpy(
-
583 _Out_writes_(count) _Post_maybez_ T1* dst,
-
584 _In_reads_or_z_opt_(count) const T2* src, _In_ size_t count)
-
585 {
-
586 assert(dst && src || !count);
-
587 for (size_t i = 0; ; ++i) {
-
588 if (i >= count)
-
589 return i;
-
590 if ((dst[i] = src[i]) == 0)
-
591 return i;
-
592 }
-
593 }
-
594
-
605 template <class T1, class T2>
-
606 inline size_t strncpy(
-
607 _Out_writes_(count_dst) _Post_maybez_ T1* dst, _In_ size_t count_dst,
-
608 _In_reads_or_z_opt_(count_src) const T2* src, _In_ size_t count_src)
-
609 {
-
610 assert(dst || !count_dst);
-
611 assert(src || !count_src);
-
612 for (size_t i = 0; ; ++i)
-
613 {
-
614 if (i > count_dst)
-
615 return i;
-
616 if (i > count_src) {
-
617 dst[i] = 0;
-
618 return i;
-
619 }
-
620 if ((dst[i] = src[i]) == 0)
-
621 return i;
-
622 }
-
623 }
-
624
-
633 template <class T1, class T2>
-
634 inline size_t strcat(
-
635 _In_z_ _Out_writes_z_(_String_length_(dst) + _String_length_(src) + 1) T1* dst,
-
636 _In_z_ const T2* src)
-
637 {
-
638 assert(dst && src);
-
639 for (size_t i = 0, j = stdex::strlen<T1>(dst); ; ++i, ++j) {
-
640 if ((dst[j] = src[i]) == 0)
-
641 return j;
-
642 }
-
643 }
-
644
-
654 template <class T1, class T2>
-
655 inline size_t strncat(
-
656 _Out_writes_(count) _Post_maybez_ T1* dst,
-
657 _In_reads_or_z_opt_(count) const T2* src, _In_ size_t count)
-
658 {
-
659 assert(dst && src || !count);
-
660 for (size_t i = 0, j = stdex::strlen<T1>(dst); ; ++i, ++j) {
-
661 if (i >= count)
-
662 return j;
-
663 if ((dst[j] = src[i]) == 0)
-
664 return j;
-
665 }
-
666 }
-
667
-
678 template <class T1, class T2>
-
679 inline size_t strncat(
-
680 _Out_writes_(count_dst) _Post_maybez_ T1* dst, _In_ size_t count_dst,
-
681 _In_reads_or_z_opt_(count_src) const T2* src, _In_ size_t count_src)
-
682 {
-
683 assert(dst || !count_dst);
-
684 assert(src || !count_src);
-
685 for (size_t i = 0, j = stdex::strnlen<T1>(dst, count_dst); ; ++i, ++j)
-
686 {
-
687 if (j > count_dst)
-
688 return j;
-
689 if (i > count_src) {
-
690 dst[j] = 0;
-
691 return j;
-
692 }
-
693 if ((dst[j] = src[i]) == 0)
-
694 return j;
-
695 }
-
696 }
-
697
-
708 template <class T>
-
709 inline _Check_return_ _Ret_maybenull_z_ T* strdup(_In_opt_z_ const T* str)
-
710 {
-
711 if (!str) _Unlikely_
-
712 return nullptr;
-
713 size_t count = strlen(str) + 1;
-
714 T* dst = new T[count];
-
715 strncpy(dst, count, str, SIZE_MAX);
-
716 return dst;
+
412 template <class T1, class T2>
+
413 inline int stricmp(_In_z_ const T1* str1, _In_z_ const T2* str2, _In_ const std::locale& locale)
+
414 {
+
415 assert(str1);
+
416 assert(str2);
+
417 size_t i; T1 a; T2 b;
+
418 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
+
419 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
+
420 for (i = 0; (a = ctype1.tolower(str1[i])) | (b = ctype2.tolower(str2[i])); i++) {
+
421 if (a > b) return +1;
+
422 if (a < b) return -1;
+
423 }
+
424 if (str1[i]) return +1;
+
425 if (str2[i]) return -1;
+
426 return 0;
+
427 }
+
428
+
438 template <class T1, class T2>
+
439 inline int strnicmp(_In_reads_or_z_opt_(count) const T1* str1, _In_reads_or_z_opt_(count) const T2* str2, _In_ size_t count, _In_ const std::locale& locale)
+
440 {
+
441 assert(str1 || !count);
+
442 assert(str2 || !count);
+
443 size_t i; T1 a; T2 b;
+
444 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
+
445 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
+
446 for (i = 0; i < count && ((a = ctype1.tolower(str1[i])) | (b = ctype2.tolower(str2[i]))); i++) {
+
447 if (a > b) return +1;
+
448 if (a < b) return -1;
+
449 }
+
450 if (i < count && str1[i]) return +1;
+
451 if (i < count && str2[i]) return -1;
+
452 return 0;
+
453 }
+
454
+
465 template <class T1, class T2>
+
466 inline int strnicmp(
+
467 _In_reads_or_z_opt_(count1) const T1* str1, _In_ size_t count1,
+
468 _In_reads_or_z_opt_(count2) const T2* str2, _In_ size_t count2,
+
469 _In_ const std::locale& locale)
+
470 {
+
471 assert(str1 || !count1);
+
472 assert(str2 || !count2);
+
473 size_t i; T1 a; T2 b;
+
474 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
+
475 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
+
476 for (i = 0; i < count1 && i < count2 && ((a = ctype1.tolower(str1[i])) | (b = ctype2.tolower(str2[i]))); i++) {
+
477 if (a > b) return +1;
+
478 if (a < b) return -1;
+
479 }
+
480 if (i < count1 && str1[i]) return +1;
+
481 if (i < count2 && str2[i]) return -1;
+
482 return 0;
+
483 }
+
484
+
493 template <class T1, class T2>
+
494 inline size_t strstr(
+
495 _In_z_ const T1* str,
+
496 _In_z_ const T2* sample)
+
497 {
+
498 assert(str);
+
499 assert(sample);
+
500 for (size_t offset = 0;; ++offset) {
+
501 for (size_t i = offset, j = 0;; ++i, ++j) {
+
502 if (!sample[j])
+
503 return offset;
+
504 if (!str[i])
+
505 return npos;
+
506 if (str[i] != sample[j])
+
507 break;
+
508 }
+
509 }
+
510 }
+
511
+
521 template <class T1, class T2>
+
522 inline size_t strnstr(
+
523 _In_reads_or_z_opt_(count) const T1* str,
+
524 _In_ size_t count,
+
525 _In_z_ const T2* sample)
+
526 {
+
527 assert(str || !count);
+
528 assert(sample);
+
529 for (size_t offset = 0;; ++offset) {
+
530 for (size_t i = offset, j = 0;; ++i, ++j) {
+
531 if (!sample[j])
+
532 return offset;
+
533 if (i >= count || !str[i])
+
534 return npos;
+
535 if (str[i] != sample[j])
+
536 break;
+
537 }
+
538 }
+
539 }
+
540
+
549 template <class T1, class T2>
+
550 inline size_t stristr(
+
551 _In_z_ const T1* str,
+
552 _In_z_ const T2* sample,
+
553 _In_ const std::locale& locale)
+
554 {
+
555 assert(str);
+
556 assert(sample);
+
557 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
+
558 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
+
559 for (size_t offset = 0;; ++offset) {
+
560 for (size_t i = offset, j = 0;; ++i, ++j) {
+
561 if (!sample[j])
+
562 return offset;
+
563 if (!str[i])
+
564 return npos;
+
565 if (ctype1.tolower(str[i]) != ctype2.tolower(sample[j]))
+
566 break;
+
567 }
+
568 }
+
569 }
+
570
+
580 template <class T1, class T2>
+
581 inline size_t strnistr(
+
582 _In_reads_or_z_opt_(count) const T1* str,
+
583 _In_ size_t count,
+
584 _In_z_ const T2* sample,
+
585 _In_ const std::locale& locale)
+
586 {
+
587 assert(str || !count);
+
588 assert(sample);
+
589 const auto& ctype1 = std::use_facet<std::ctype<T1>>(locale);
+
590 const auto& ctype2 = std::use_facet<std::ctype<T2>>(locale);
+
591 for (size_t offset = 0;; ++offset) {
+
592 for (size_t i = offset, j = 0;; ++i, ++j) {
+
593 if (!sample[j])
+
594 return offset;
+
595 if (i >= count || !str[i])
+
596 return npos;
+
597 if (ctype1.tolower(str[i]) != ctype2.tolower(sample[j]))
+
598 break;
+
599 }
+
600 }
+
601 }
+
602
+
611 template <class T1, class T2>
+
612 inline size_t strcpy(
+
613 _Out_writes_z_(_String_length_(src) + 1) T1* dst,
+
614 _In_z_ const T2* src)
+
615 {
+
616 assert(dst && src);
+
617 for (size_t i = 0; ; ++i) {
+
618 if ((dst[i] = src[i]) == 0)
+
619 return i;
+
620 }
+
621 }
+
622
+
632 template <class T1, class T2>
+
633 inline size_t strncpy(
+
634 _Out_writes_(count) _Post_maybez_ T1* dst,
+
635 _In_reads_or_z_opt_(count) const T2* src, _In_ size_t count)
+
636 {
+
637 assert(dst && src || !count);
+
638 for (size_t i = 0; ; ++i) {
+
639 if (i >= count)
+
640 return i;
+
641 if ((dst[i] = src[i]) == 0)
+
642 return i;
+
643 }
+
644 }
+
645
+
656 template <class T1, class T2>
+
657 inline size_t strncpy(
+
658 _Out_writes_(count_dst) _Post_maybez_ T1* dst, _In_ size_t count_dst,
+
659 _In_reads_or_z_opt_(count_src) const T2* src, _In_ size_t count_src)
+
660 {
+
661 assert(dst || !count_dst);
+
662 assert(src || !count_src);
+
663 for (size_t i = 0; ; ++i)
+
664 {
+
665 if (i > count_dst)
+
666 return i;
+
667 if (i > count_src) {
+
668 dst[i] = 0;
+
669 return i;
+
670 }
+
671 if ((dst[i] = src[i]) == 0)
+
672 return i;
+
673 }
+
674 }
+
675
+
684 template <class T1, class T2>
+
685 inline size_t strcat(
+
686 _In_z_ _Out_writes_z_(_String_length_(dst) + _String_length_(src) + 1) T1* dst,
+
687 _In_z_ const T2* src)
+
688 {
+
689 assert(dst && src);
+
690 for (size_t i = 0, j = stdex::strlen<T1>(dst); ; ++i, ++j) {
+
691 if ((dst[j] = src[i]) == 0)
+
692 return j;
+
693 }
+
694 }
+
695
+
705 template <class T1, class T2>
+
706 inline size_t strncat(
+
707 _Out_writes_(count) _Post_maybez_ T1* dst,
+
708 _In_reads_or_z_opt_(count) const T2* src, _In_ size_t count)
+
709 {
+
710 assert(dst && src || !count);
+
711 for (size_t i = 0, j = stdex::strlen<T1>(dst); ; ++i, ++j) {
+
712 if (i >= count)
+
713 return j;
+
714 if ((dst[j] = src[i]) == 0)
+
715 return j;
+
716 }
717 }
718
-
730 template <class T>
-
731 inline _Ret_z_ T* strndup(
-
732 _In_reads_or_z_opt_(count) const T* str,
-
733 _In_ size_t count)
-
734 {
-
735 T* dst = new T[count];
-
736 strncpy(dst, count, str, SIZE_MAX);
-
737 return dst;
-
738 }
-
739
-
749 template <class T>
-
750 inline size_t crlf2nl(_Out_writes_z_(strlen(src)) T* dst, _In_z_ const T* src)
-
751 {
-
752 assert(dst);
-
753 assert(src);
-
754 size_t i, j;
-
755 for (i = j = 0; src[j];) {
-
756 if (src[j] != '\r' || src[j + 1] != '\n')
-
757 dst[i++] = src[j++];
-
758 else {
-
759 dst[i++] = '\n';
-
760 j += 2;
-
761 }
-
762 }
-
763 dst[i] = 0;
-
764 return i;
-
765 }
-
766
-
768 template <class T, class T_bin>
-
769 inline T_bin strtoint(
-
770 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
771 _Out_opt_ size_t* end,
-
772 _In_ int radix,
-
773 _Out_ uint8_t& flags)
-
774 {
-
775 assert(str || !count);
-
776 assert(radix == 0 || 2 <= radix && radix <= 36);
-
777
-
778 size_t i = 0;
-
779 T_bin value = 0, digit,
-
780 max_ui = (T_bin)-1,
-
781 max_ui_pre1, max_ui_pre2;
-
782
-
783 flags = 0;
-
784
-
785 // Skip leading spaces.
-
786 for (;; ++i) {
-
787 if (i >= count || !str[i]) goto error;
-
788 if (!isspace(str[i])) break;
-
789 }
+
729 template <class T1, class T2>
+
730 inline size_t strncat(
+
731 _Out_writes_(count_dst) _Post_maybez_ T1* dst, _In_ size_t count_dst,
+
732 _In_reads_or_z_opt_(count_src) const T2* src, _In_ size_t count_src)
+
733 {
+
734 assert(dst || !count_dst);
+
735 assert(src || !count_src);
+
736 for (size_t i = 0, j = stdex::strnlen<T1>(dst, count_dst); ; ++i, ++j)
+
737 {
+
738 if (j > count_dst)
+
739 return j;
+
740 if (i > count_src) {
+
741 dst[j] = 0;
+
742 return j;
+
743 }
+
744 if ((dst[j] = src[i]) == 0)
+
745 return j;
+
746 }
+
747 }
+
748
+
759 template <class T>
+
760 inline _Check_return_ _Ret_maybenull_z_ T* strdup(_In_opt_z_ const T* str)
+
761 {
+
762 if (!str) _Unlikely_
+
763 return nullptr;
+
764 size_t count = strlen(str) + 1;
+
765 T* dst = new T[count];
+
766 strncpy(dst, count, str, SIZE_MAX);
+
767 return dst;
+
768 }
+
769
+
781 template <class T>
+
782 inline _Ret_z_ T* strndup(
+
783 _In_reads_or_z_opt_(count) const T* str,
+
784 _In_ size_t count)
+
785 {
+
786 T* dst = new T[count];
+
787 strncpy(dst, count, str, SIZE_MAX);
+
788 return dst;
+
789 }
790
-
791 // Read the sign.
-
792 if (str[i] == '+') {
-
793 flags &= ~0x01;
-
794 ++i;
-
795 if (i >= count || !str[i]) goto error;
-
796 }
-
797 else if (str[i] == '-') {
-
798 flags |= 0x01;
-
799 ++i;
-
800 if (i >= count || !str[i]) goto error;
-
801 }
-
802
-
803 if (radix == 16) {
-
804 // On hexadecimal, allow leading 0x.
-
805 if (str[i] == '0' && i + 1 < count && (str[i + 1] == 'x' || str[i + 1] == 'X')) {
-
806 i += 2;
-
807 if (i >= count || !str[i]) goto error;
-
808 }
-
809 }
-
810 else if (!radix) {
-
811 // Autodetect radix.
-
812 if (str[i] == '0') {
-
813 ++i;
-
814 if (i >= count || !str[i]) goto error;
-
815 if (str[i] == 'x' || str[i] == 'X') {
-
816 radix = 16;
-
817 ++i;
-
818 if (i >= count || !str[i]) goto error;
-
819 }
-
820 else
-
821 radix = 8;
-
822 }
-
823 else
-
824 radix = 10;
-
825 }
-
826
-
827 // We have the radix.
-
828 max_ui_pre1 = max_ui / (T_bin)radix;
-
829 max_ui_pre2 = max_ui % (T_bin)radix;
-
830 for (;;) {
-
831 if ('0' <= str[i] && str[i] <= '9')
-
832 digit = (T_bin)str[i] - '0';
-
833 else if ('A' <= str[i] && str[i] <= 'Z')
-
834 digit = (T_bin)str[i] - 'A' + '\x0a';
-
835 else if ('a' <= str[i] && str[i] <= 'z')
-
836 digit = (T_bin)str[i] - 'a' + '\x0a';
-
837 else
-
838 goto error;
-
839 if (digit >= (T_bin)radix)
-
840 goto error;
+
800 template <class T>
+
801 inline size_t crlf2nl(_Out_writes_z_(strlen(src)) T* dst, _In_z_ const T* src)
+
802 {
+
803 assert(dst);
+
804 assert(src);
+
805 size_t i, j;
+
806 for (i = j = 0; src[j];) {
+
807 if (src[j] != '\r' || src[j + 1] != '\n')
+
808 dst[i++] = src[j++];
+
809 else {
+
810 dst[i++] = '\n';
+
811 j += 2;
+
812 }
+
813 }
+
814 dst[i] = 0;
+
815 return i;
+
816 }
+
817
+
819 template <class T, class T_bin>
+
820 inline T_bin strtoint(
+
821 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
822 _Out_opt_ size_t* end,
+
823 _In_ int radix,
+
824 _Out_ uint8_t& flags)
+
825 {
+
826 assert(str || !count);
+
827 assert(radix == 0 || 2 <= radix && radix <= 36);
+
828
+
829 size_t i = 0;
+
830 T_bin value = 0, digit,
+
831 max_ui = (T_bin)-1,
+
832 max_ui_pre1, max_ui_pre2;
+
833
+
834 flags = 0;
+
835
+
836 // Skip leading spaces.
+
837 for (;; ++i) {
+
838 if (i >= count || !str[i]) goto error;
+
839 if (!isspace(str[i])) break;
+
840 }
841
-
842 if (value < max_ui_pre1 || // Multiplication nor addition will not overflow.
-
843 (value == max_ui_pre1 && digit <= max_ui_pre2)) // Small digits will not overflow.
-
844 value = value * (T_bin)radix + digit;
-
845 else {
-
846 // Overflow!
-
847 flags |= 0x02;
-
848 }
-
849
+
842 // Read the sign.
+
843 if (str[i] == '+') {
+
844 flags &= ~0x01;
+
845 ++i;
+
846 if (i >= count || !str[i]) goto error;
+
847 }
+
848 else if (str[i] == '-') {
+
849 flags |= 0x01;
850 ++i;
-
851 if (i >= count || !str[i])
-
852 goto error;
-
853 }
-
854
-
855 error:
-
856 if (end) *end = i;
-
857 return value;
-
858 }
-
860
-
871 template <class T, class T_bin>
-
872 T_bin strtoint(
-
873 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
874 _Out_opt_ size_t* end,
-
875 _In_ int radix)
-
876 {
-
877 uint8_t flags;
-
878 T_bin value;
-
879
-
880 switch (sizeof(T_bin)) {
-
881 case 1:
-
882 value = (T_bin)strtoint<T, uint8_t>(str, count, end, radix, flags);
-
883 if ((flags & 0x01) && (value & 0x80)) {
-
884 // Sign bit is 1 => overflow.
-
885 flags |= 0x02;
-
886 }
-
887 return (flags & 0x02) ?
-
888 (flags & 0x01) ? (T_bin)0x80 : (T_bin)0x7f :
-
889 (flags & 0x01) ? -value : value;
-
890
-
891 case 2:
-
892 value = (T_bin)strtoint<T, uint16_t>(str, count, end, radix, flags);
-
893 if ((flags & 0x01) && (value & 0x8000)) {
-
894 // Sign bit is 1 => overflow.
-
895 flags |= 0x02;
-
896 }
-
897 return (flags & 0x02) ?
-
898 (flags & 0x01) ? (T_bin)0x8000 : (T_bin)0x7fff :
-
899 (flags & 0x01) ? -value : value;
+
851 if (i >= count || !str[i]) goto error;
+
852 }
+
853
+
854 if (radix == 16) {
+
855 // On hexadecimal, allow leading 0x.
+
856 if (str[i] == '0' && i + 1 < count && (str[i + 1] == 'x' || str[i + 1] == 'X')) {
+
857 i += 2;
+
858 if (i >= count || !str[i]) goto error;
+
859 }
+
860 }
+
861 else if (!radix) {
+
862 // Autodetect radix.
+
863 if (str[i] == '0') {
+
864 ++i;
+
865 if (i >= count || !str[i]) goto error;
+
866 if (str[i] == 'x' || str[i] == 'X') {
+
867 radix = 16;
+
868 ++i;
+
869 if (i >= count || !str[i]) goto error;
+
870 }
+
871 else
+
872 radix = 8;
+
873 }
+
874 else
+
875 radix = 10;
+
876 }
+
877
+
878 // We have the radix.
+
879 max_ui_pre1 = max_ui / (T_bin)radix;
+
880 max_ui_pre2 = max_ui % (T_bin)radix;
+
881 for (;;) {
+
882 if ('0' <= str[i] && str[i] <= '9')
+
883 digit = (T_bin)str[i] - '0';
+
884 else if ('A' <= str[i] && str[i] <= 'Z')
+
885 digit = (T_bin)str[i] - 'A' + '\x0a';
+
886 else if ('a' <= str[i] && str[i] <= 'z')
+
887 digit = (T_bin)str[i] - 'a' + '\x0a';
+
888 else
+
889 goto error;
+
890 if (digit >= (T_bin)radix)
+
891 goto error;
+
892
+
893 if (value < max_ui_pre1 || // Multiplication nor addition will not overflow.
+
894 (value == max_ui_pre1 && digit <= max_ui_pre2)) // Small digits will not overflow.
+
895 value = value * (T_bin)radix + digit;
+
896 else {
+
897 // Overflow!
+
898 flags |= 0x02;
+
899 }
900
-
901 case 4:
-
902 value = (T_bin)strtoint<T, uint32_t>(str, count, end, radix, flags);
-
903 if ((flags & 0x01) && (value & 0x80000000)) {
-
904 // Sign bit is 1 => overflow.
-
905 flags |= 0x02;
-
906 }
-
907 return (flags & 0x02) ?
-
908 (flags & 0x01) ? (T_bin)0x80000000 : (T_bin)0x7fffffff :
-
909 (flags & 0x01) ? -value : value;
-
910
-
911 case 8:
-
912 value = (T_bin)strtoint<T, uint64_t>(str, count, end, radix, flags);
-
913 if ((flags & 0x01) && (value & 0x8000000000000000)) {
-
914 // Sign bit is 1 => overflow.
-
915 flags |= 0x02;
-
916 }
-
917 return (flags & 0x02) ?
-
918 (flags & 0x01) ? (T_bin)0x8000000000000000 : (T_bin)0x7fffffffffffffff :
-
919 (flags & 0x01) ? -value : value;
-
920
-
921 default:
-
922 throw std::invalid_argument("Unsupported bit length");
-
923 }
-
924 }
-
925
-
936 template <class T, class T_bin>
-
937 inline T_bin strtouint(
-
938 _In_reads_or_z_opt_(count) const T* str,
-
939 _In_ size_t count,
-
940 _Out_opt_ size_t* end,
-
941 _In_ int radix)
-
942 {
-
943 uint8_t flags;
-
944 T_bin value;
-
945
-
946 switch (sizeof(T_bin)) {
-
947 case 1: value = (T_bin)strtoint<T, uint8_t>(str, count, end, radix, flags); break;
-
948 case 2: value = (T_bin)strtoint<T, uint16_t>(str, count, end, radix, flags); break;
-
949 case 4: value = (T_bin)strtoint<T, uint32_t>(str, count, end, radix, flags); break;
-
950 case 8: value = (T_bin)strtoint<T, uint64_t>(str, count, end, radix, flags); break;
-
951 default: throw std::invalid_argument("Unsupported bit length");
-
952 }
-
953
-
954 return (flags & 0x02) ?
-
955 (flags & 0x01) ? (T_bin)0 : (T_bin)-1 :
-
956 (flags & 0x01) ? ~value : value;
-
957 }
-
958
-
969 template <class T>
-
970 inline int32_t strto32(
-
971 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
972 _Out_opt_ size_t* end,
-
973 _In_ int radix)
-
974 {
-
975 return strtoint<T, int32_t>(str, count, end, radix);
-
976 }
-
977
-
988 template <class T>
-
989 inline int64_t strto64(
-
990 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
901 ++i;
+
902 if (i >= count || !str[i])
+
903 goto error;
+
904 }
+
905
+
906 error:
+
907 if (end) *end = i;
+
908 return value;
+
909 }
+
911
+
922 template <class T, class T_bin>
+
923 T_bin strtoint(
+
924 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
925 _Out_opt_ size_t* end,
+
926 _In_ int radix)
+
927 {
+
928 uint8_t flags;
+
929 T_bin value;
+
930
+
931 switch (sizeof(T_bin)) {
+
932 case 1:
+
933 value = (T_bin)strtoint<T, uint8_t>(str, count, end, radix, flags);
+
934 if ((flags & 0x01) && (value & 0x80)) {
+
935 // Sign bit is 1 => overflow.
+
936 flags |= 0x02;
+
937 }
+
938 return (flags & 0x02) ?
+
939 (flags & 0x01) ? (T_bin)0x80 : (T_bin)0x7f :
+
940 (flags & 0x01) ? -value : value;
+
941
+
942 case 2:
+
943 value = (T_bin)strtoint<T, uint16_t>(str, count, end, radix, flags);
+
944 if ((flags & 0x01) && (value & 0x8000)) {
+
945 // Sign bit is 1 => overflow.
+
946 flags |= 0x02;
+
947 }
+
948 return (flags & 0x02) ?
+
949 (flags & 0x01) ? (T_bin)0x8000 : (T_bin)0x7fff :
+
950 (flags & 0x01) ? -value : value;
+
951
+
952 case 4:
+
953 value = (T_bin)strtoint<T, uint32_t>(str, count, end, radix, flags);
+
954 if ((flags & 0x01) && (value & 0x80000000)) {
+
955 // Sign bit is 1 => overflow.
+
956 flags |= 0x02;
+
957 }
+
958 return (flags & 0x02) ?
+
959 (flags & 0x01) ? (T_bin)0x80000000 : (T_bin)0x7fffffff :
+
960 (flags & 0x01) ? -value : value;
+
961
+
962 case 8:
+
963 value = (T_bin)strtoint<T, uint64_t>(str, count, end, radix, flags);
+
964 if ((flags & 0x01) && (value & 0x8000000000000000)) {
+
965 // Sign bit is 1 => overflow.
+
966 flags |= 0x02;
+
967 }
+
968 return (flags & 0x02) ?
+
969 (flags & 0x01) ? (T_bin)0x8000000000000000 : (T_bin)0x7fffffffffffffff :
+
970 (flags & 0x01) ? -value : value;
+
971
+
972 default:
+
973 throw std::invalid_argument("Unsupported bit length");
+
974 }
+
975 }
+
976
+
987 template <class T, class T_bin>
+
988 inline T_bin strtouint(
+
989 _In_reads_or_z_opt_(count) const T* str,
+
990 _In_ size_t count,
991 _Out_opt_ size_t* end,
992 _In_ int radix)
993 {
-
994 return strtoint<T, int64_t>(str, count, end, radix);
-
995 }
+
994 uint8_t flags;
+
995 T_bin value;
996
-
1008 template <class T>
-
1009 inline intptr_t strtoi(
-
1010 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
1011 _Out_opt_ size_t* end,
-
1012 _In_ int radix)
-
1013 {
-
1014#if defined(_WIN64) || defined(__LP64__)
-
1015 return (intptr_t)strto64(str, count, end, radix);
-
1016#else
-
1017 return (intptr_t)strto32(str, count, end, radix);
-
1018#endif
-
1019 }
-
1020
-
1031 template <class T>
-
1032 inline uint32_t strtou32(
-
1033 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
1034 _Out_opt_ size_t* end,
-
1035 _In_ int radix)
-
1036 {
-
1037 return strtouint<T, uint32_t>(str, count, end, radix);
-
1038 }
-
1039
-
1050 template <class T>
-
1051 inline uint64_t strtou64(
-
1052 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
1053 _Out_opt_ size_t* end,
-
1054 _In_ int radix)
-
1055 {
-
1056 return strtouint<T, uint64_t>(str, count, end, radix);
-
1057 }
-
1058
-
1070 template <class T>
-
1071 inline size_t strtoui(
-
1072 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
-
1073 _Out_opt_ size_t* end,
-
1074 _In_ int radix)
-
1075 {
-
1076#if defined(_WIN64) || defined(__LP64__)
-
1077 return (size_t)strtou64(str, count, end, radix);
-
1078#else
-
1079 return (size_t)strtou32(str, count, end, radix);
-
1080#endif
-
1081 }
-
1082
-
1084 inline int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_params_(2) const char *format, _In_opt_ locale_t locale, _In_ va_list arg)
-
1085 {
-
1086 int r;
-
1087#ifdef _WIN32
-
1088 // Don't use _vsnprintf_s(). It terminates the string even if we want to print to the edge of the buffer.
-
1089#pragma warning(suppress: 4996)
-
1090 r = _vsnprintf_l(str, capacity, format, locale, arg);
-
1091#else
-
1092 r = ::vsnprintf(str, capacity, format, arg);
-
1093#endif
-
1094 if (r == -1 && strnlen(str, capacity) == capacity) {
-
1095 // Buffer overrun. Estimate buffer size for the next iteration.
-
1096 capacity += std::max<size_t>(capacity / 8, 0x80);
-
1097 if (capacity > INT_MAX)
-
1098 throw std::invalid_argument("string too big");
-
1099 return (int)capacity;
-
1100 }
-
1101 return r;
-
1102 }
-
1103
-
1104 inline int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _In_z_ _Printf_format_string_params_(2) const wchar_t *format, _In_opt_ locale_t locale, _In_ va_list arg)
-
1105 {
-
1106 int r;
-
1107
-
1108#ifdef _WIN32
-
1109 // Don't use _vsnwprintf_s(). It terminates the string even if we want to print to the edge of the buffer.
-
1110#pragma warning(suppress: 4996)
-
1111 r = _vsnwprintf_l(str, capacity, format, locale, arg);
-
1112#else
-
1113 r = vswprintf(str, capacity, format, arg);
-
1114#endif
-
1115 if (r == -1 && strnlen(str, capacity) == capacity) {
-
1116 // Buffer overrun. Estimate buffer size for the next iteration.
-
1117 capacity += std::max<size_t>(capacity / 8, 0x80);
-
1118 if (capacity > INT_MAX)
-
1119 throw std::invalid_argument("string too big");
-
1120 return (int)capacity;
-
1121 }
-
1122 return r;
-
1123 }
-
1125
-
1134 template<class _Elem, class _Traits, class _Ax>
-
1135 inline void vappendf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, _In_ va_list arg)
+
997 switch (sizeof(T_bin)) {
+
998 case 1: value = (T_bin)strtoint<T, uint8_t>(str, count, end, radix, flags); break;
+
999 case 2: value = (T_bin)strtoint<T, uint16_t>(str, count, end, radix, flags); break;
+
1000 case 4: value = (T_bin)strtoint<T, uint32_t>(str, count, end, radix, flags); break;
+
1001 case 8: value = (T_bin)strtoint<T, uint64_t>(str, count, end, radix, flags); break;
+
1002 default: throw std::invalid_argument("Unsupported bit length");
+
1003 }
+
1004
+
1005 return (flags & 0x02) ?
+
1006 (flags & 0x01) ? (T_bin)0 : (T_bin)-1 :
+
1007 (flags & 0x01) ? ~value : value;
+
1008 }
+
1009
+
1020 template <class T>
+
1021 inline int32_t strto32(
+
1022 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
1023 _Out_opt_ size_t* end,
+
1024 _In_ int radix)
+
1025 {
+
1026 return strtoint<T, int32_t>(str, count, end, radix);
+
1027 }
+
1028
+
1039 template <class T>
+
1040 inline int64_t strto64(
+
1041 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
1042 _Out_opt_ size_t* end,
+
1043 _In_ int radix)
+
1044 {
+
1045 return strtoint<T, int64_t>(str, count, end, radix);
+
1046 }
+
1047
+
1059 template <class T>
+
1060 inline intptr_t strtoi(
+
1061 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
1062 _Out_opt_ size_t* end,
+
1063 _In_ int radix)
+
1064 {
+
1065#if defined(_WIN64) || defined(__LP64__)
+
1066 return (intptr_t)strto64(str, count, end, radix);
+
1067#else
+
1068 return (intptr_t)strto32(str, count, end, radix);
+
1069#endif
+
1070 }
+
1071
+
1082 template <class T>
+
1083 inline uint32_t strtou32(
+
1084 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
1085 _Out_opt_ size_t* end,
+
1086 _In_ int radix)
+
1087 {
+
1088 return strtouint<T, uint32_t>(str, count, end, radix);
+
1089 }
+
1090
+
1101 template <class T>
+
1102 inline uint64_t strtou64(
+
1103 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
1104 _Out_opt_ size_t* end,
+
1105 _In_ int radix)
+
1106 {
+
1107 return strtouint<T, uint64_t>(str, count, end, radix);
+
1108 }
+
1109
+
1121 template <class T>
+
1122 inline size_t strtoui(
+
1123 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count,
+
1124 _Out_opt_ size_t* end,
+
1125 _In_ int radix)
+
1126 {
+
1127#if defined(_WIN64) || defined(__LP64__)
+
1128 return (size_t)strtou64(str, count, end, radix);
+
1129#else
+
1130 return (size_t)strtou32(str, count, end, radix);
+
1131#endif
+
1132 }
+
1133
+
1135 inline int vsnprintf(_Out_z_cap_(capacity) char *str, _In_ size_t capacity, _In_z_ _Printf_format_string_params_(2) const char *format, _In_opt_ locale_t locale, _In_ va_list arg)
1136 {
-
1137 _Elem buf[1024/sizeof(_Elem)];
-
1138
-
1139 // Try with stack buffer first.
-
1140 int count = vsnprintf(buf, _countof(buf) - 1, format, locale, arg);
-
1141 if (count >= 0) {
-
1142 // Copy from stack.
-
1143 str.append(buf, count);
-
1144 } else {
-
1145 for (size_t capacity = 2*1024/sizeof(_Elem);; capacity *= 2) {
-
1146 // Allocate on heap and retry.
-
1147 auto buf_dyn = std::make_unique<_Elem[]>(capacity);
-
1148 count = vsnprintf(buf_dyn.get(), capacity - 1, format, locale, arg);
-
1149 if (count >= 0) {
-
1150 str.append(buf_dyn.get(), count);
-
1151 break;
-
1152 }
-
1153 }
-
1154 }
-
1155 }
-
1156
-
1164 template<class _Elem, class _Traits, class _Ax>
-
1165 inline void appendf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, ...)
-
1166 {
-
1167 va_list arg;
-
1168 va_start(arg, locale);
-
1169 vappendf(str, format, locale, arg);
-
1170 va_end(arg);
-
1171 }
-
1172
-
1181 template<class _Elem, class _Traits, class _Ax>
-
1182 inline void vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, _In_ va_list arg)
-
1183 {
-
1184 str.clear();
-
1185 vappendf(str, format, locale, arg);
-
1186 }
-
1187
-
1195 template<class _Elem, class _Traits, class _Ax>
-
1196 inline void sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, ...)
-
1197 {
-
1198 va_list arg;
-
1199 va_start(arg, locale);
-
1200 vsprintf(str, format, locale, arg);
-
1201 va_end(arg);
-
1202 }
-
1203
-
1213 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
1214 inline std::basic_string<_Elem, _Traits, _Ax> vsprintf(_In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, _In_ va_list arg)
-
1215 {
-
1216 std::basic_string<_Elem, _Traits, _Ax> str;
-
1217 vappendf(str, format, locale, arg);
-
1218 return str;
-
1219 }
-
1220
-
1229 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
-
1230 inline std::basic_string<_Elem, _Traits, _Ax> sprintf(_In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, ...)
-
1231 {
-
1232 va_list arg;
-
1233 va_start(arg, locale);
-
1234 auto str = vsprintf(format, locale, arg);
-
1235 va_end(arg);
-
1236 return str;
+
1137 int r;
+
1138#ifdef _WIN32
+
1139 // Don't use _vsnprintf_s(). It terminates the string even if we want to print to the edge of the buffer.
+
1140#pragma warning(suppress: 4996)
+
1141 r = _vsnprintf_l(str, capacity, format, locale, arg);
+
1142#else
+
1143 r = ::vsnprintf(str, capacity, format, arg);
+
1144#endif
+
1145 if (r == -1 && strnlen(str, capacity) == capacity) {
+
1146 // Buffer overrun. Estimate buffer size for the next iteration.
+
1147 capacity += std::max<size_t>(capacity / 8, 0x80);
+
1148 if (capacity > INT_MAX)
+
1149 throw std::invalid_argument("string too big");
+
1150 return (int)capacity;
+
1151 }
+
1152 return r;
+
1153 }
+
1154
+
1155 inline int vsnprintf(_Out_z_cap_(capacity) wchar_t *str, _In_ size_t capacity, _In_z_ _Printf_format_string_params_(2) const wchar_t *format, _In_opt_ locale_t locale, _In_ va_list arg)
+
1156 {
+
1157 int r;
+
1158
+
1159#ifdef _WIN32
+
1160 // Don't use _vsnwprintf_s(). It terminates the string even if we want to print to the edge of the buffer.
+
1161#pragma warning(suppress: 4996)
+
1162 r = _vsnwprintf_l(str, capacity, format, locale, arg);
+
1163#else
+
1164 r = vswprintf(str, capacity, format, arg);
+
1165#endif
+
1166 if (r == -1 && strnlen(str, capacity) == capacity) {
+
1167 // Buffer overrun. Estimate buffer size for the next iteration.
+
1168 capacity += std::max<size_t>(capacity / 8, 0x80);
+
1169 if (capacity > INT_MAX)
+
1170 throw std::invalid_argument("string too big");
+
1171 return (int)capacity;
+
1172 }
+
1173 return r;
+
1174 }
+
1176
+
1185 template<class _Elem, class _Traits, class _Ax>
+
1186 inline void vappendf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, _In_ va_list arg)
+
1187 {
+
1188 _Elem buf[1024/sizeof(_Elem)];
+
1189
+
1190 // Try with stack buffer first.
+
1191 int count = vsnprintf(buf, _countof(buf) - 1, format, locale, arg);
+
1192 if (count >= 0) {
+
1193 // Copy from stack.
+
1194 str.append(buf, count);
+
1195 } else {
+
1196 for (size_t capacity = 2*1024/sizeof(_Elem);; capacity *= 2) {
+
1197 // Allocate on heap and retry.
+
1198 auto buf_dyn = std::make_unique<_Elem[]>(capacity);
+
1199 count = vsnprintf(buf_dyn.get(), capacity - 1, format, locale, arg);
+
1200 if (count >= 0) {
+
1201 str.append(buf_dyn.get(), count);
+
1202 break;
+
1203 }
+
1204 }
+
1205 }
+
1206 }
+
1207
+
1215 template<class _Elem, class _Traits, class _Ax>
+
1216 inline void appendf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, ...)
+
1217 {
+
1218 va_list arg;
+
1219 va_start(arg, locale);
+
1220 vappendf(str, format, locale, arg);
+
1221 va_end(arg);
+
1222 }
+
1223
+
1232 template<class _Elem, class _Traits, class _Ax>
+
1233 inline void vsprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, _In_ va_list arg)
+
1234 {
+
1235 str.clear();
+
1236 vappendf(str, format, locale, arg);
1237 }
-
1238}
+
1238
+
1246 template<class _Elem, class _Traits, class _Ax>
+
1247 inline void sprintf(_Inout_ std::basic_string<_Elem, _Traits, _Ax> &str, _In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, ...)
+
1248 {
+
1249 va_list arg;
+
1250 va_start(arg, locale);
+
1251 vsprintf(str, format, locale, arg);
+
1252 va_end(arg);
+
1253 }
+
1254
+
1264 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
1265 inline std::basic_string<_Elem, _Traits, _Ax> vsprintf(_In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, _In_ va_list arg)
+
1266 {
+
1267 std::basic_string<_Elem, _Traits, _Ax> str;
+
1268 vappendf(str, format, locale, arg);
+
1269 return str;
+
1270 }
+
1271
+
1280 template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
+
1281 inline std::basic_string<_Elem, _Traits, _Ax> sprintf(_In_z_ _Printf_format_string_params_(2) const _Elem *format, _In_opt_ locale_t locale, ...)
+
1282 {
+
1283 va_list arg;
+
1284 va_start(arg, locale);
+
1285 auto str = vsprintf(format, locale, arg);
+
1286 va_end(arg);
+
1287 return str;
+
1288 }
+
1289}
Deleter for unique_ptr using free_locale.
Definition string.hpp:56
void operator()(locale_t locale) const
Delete a pointer.
Definition string.hpp:60
diff --git a/structstdex_1_1chrono_1_1aosn__date-members.html b/structstdex_1_1chrono_1_1aosn__date-members.html index ecc9ba829..3accc0462 100644 --- a/structstdex_1_1chrono_1_1aosn__date-members.html +++ b/structstdex_1_1chrono_1_1aosn__date-members.html @@ -96,7 +96,7 @@ $(function() {
diff --git a/structstdex_1_1chrono_1_1aosn__date.html b/structstdex_1_1chrono_1_1aosn__date.html index 6f0e546aa..f21deefd3 100644 --- a/structstdex_1_1chrono_1_1aosn__date.html +++ b/structstdex_1_1chrono_1_1aosn__date.html @@ -152,7 +152,7 @@ static constexpr bool is_s
diff --git a/structstdex_1_1chrono_1_1aosn__timestamp-members.html b/structstdex_1_1chrono_1_1aosn__timestamp-members.html index 5af48b86d..0a322d088 100644 --- a/structstdex_1_1chrono_1_1aosn__timestamp-members.html +++ b/structstdex_1_1chrono_1_1aosn__timestamp-members.html @@ -110,7 +110,7 @@ $(function() {
diff --git a/structstdex_1_1chrono_1_1aosn__timestamp.html b/structstdex_1_1chrono_1_1aosn__timestamp.html index e6bb2ea23..8a08ae6da 100644 --- a/structstdex_1_1chrono_1_1aosn__timestamp.html +++ b/structstdex_1_1chrono_1_1aosn__timestamp.html @@ -197,7 +197,7 @@ static constexpr rep p_wee
diff --git a/structstdex_1_1free__locale__delete-members.html b/structstdex_1_1free__locale__delete-members.html index 5fb0234f7..2b582e8fb 100644 --- a/structstdex_1_1free__locale__delete-members.html +++ b/structstdex_1_1free__locale__delete-members.html @@ -84,7 +84,7 @@ $(function() {
diff --git a/structstdex_1_1free__locale__delete.html b/structstdex_1_1free__locale__delete.html index 0f145c4ce..b20f0ceb1 100644 --- a/structstdex_1_1free__locale__delete.html +++ b/structstdex_1_1free__locale__delete.html @@ -101,7 +101,7 @@ void operator() (local
diff --git a/structstdex_1_1interval-members.html b/structstdex_1_1interval-members.html index f51dc1ae5..9e419145b 100644 --- a/structstdex_1_1interval-members.html +++ b/structstdex_1_1interval-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/structstdex_1_1interval.html b/structstdex_1_1interval.html index ce6c70e00..ee447e6c4 100644 --- a/structstdex_1_1interval.html +++ b/structstdex_1_1interval.html @@ -344,7 +344,7 @@ template<class T >
diff --git a/structstdex_1_1mapping-members.html b/structstdex_1_1mapping-members.html index 263080e3f..99ad59e64 100644 --- a/structstdex_1_1mapping-members.html +++ b/structstdex_1_1mapping-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/structstdex_1_1mapping.html b/structstdex_1_1mapping.html index 3d475b4db..f0c3d59d9 100644 --- a/structstdex_1_1mapping.html +++ b/structstdex_1_1mapping.html @@ -283,7 +283,7 @@ template<class T >
diff --git a/structstdex_1_1no__delete-members.html b/structstdex_1_1no__delete-members.html index 0622a2a10..1100f1e62 100644 --- a/structstdex_1_1no__delete-members.html +++ b/structstdex_1_1no__delete-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structstdex_1_1no__delete.html b/structstdex_1_1no__delete.html index 9b2c854d7..bfd6dda4c 100644 --- a/structstdex_1_1no__delete.html +++ b/structstdex_1_1no__delete.html @@ -105,7 +105,7 @@ struct stdex::no_delete< T >

Noop deleter.

diff --git a/structstdex_1_1no__delete_3_01_t_0f_0e_4-members.html b/structstdex_1_1no__delete_3_01_t_0f_0e_4-members.html index e5c8e5552..da948c011 100644 --- a/structstdex_1_1no__delete_3_01_t_0f_0e_4-members.html +++ b/structstdex_1_1no__delete_3_01_t_0f_0e_4-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structstdex_1_1no__delete_3_01_t_0f_0e_4.html b/structstdex_1_1no__delete_3_01_t_0f_0e_4.html index efb2ab32e..1d348e5dd 100644 --- a/structstdex_1_1no__delete_3_01_t_0f_0e_4.html +++ b/structstdex_1_1no__delete_3_01_t_0f_0e_4.html @@ -106,7 +106,7 @@ struct stdex::no_delete< T[]>

Noop array deleter.

diff --git a/structstdex_1_1parser_1_1http__factor__more-members.html b/structstdex_1_1parser_1_1http__factor__more-members.html index d9598e607..3e6de53a9 100644 --- a/structstdex_1_1parser_1_1http__factor__more-members.html +++ b/structstdex_1_1parser_1_1http__factor__more-members.html @@ -84,7 +84,7 @@ $(function() {
diff --git a/structstdex_1_1parser_1_1http__factor__more.html b/structstdex_1_1parser_1_1http__factor__more.html index 64b815146..9f90447b2 100644 --- a/structstdex_1_1parser_1_1http__factor__more.html +++ b/structstdex_1_1parser_1_1http__factor__more.html @@ -93,7 +93,7 @@ Public Member Functions
diff --git a/structstdex_1_1stream_1_1buffer_1_1buffer__t-members.html b/structstdex_1_1stream_1_1buffer_1_1buffer__t-members.html index 816d75dd0..486673916 100644 --- a/structstdex_1_1stream_1_1buffer_1_1buffer__t-members.html +++ b/structstdex_1_1stream_1_1buffer_1_1buffer__t-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structstdex_1_1stream_1_1buffer_1_1buffer__t.html b/structstdex_1_1stream_1_1buffer_1_1buffer__t.html index 4d509e5c0..46caeebcc 100644 --- a/structstdex_1_1stream_1_1buffer_1_1buffer__t.html +++ b/structstdex_1_1stream_1_1buffer_1_1buffer__t.html @@ -109,7 +109,7 @@ size_t capacity diff --git a/structstdex_1_1stream_1_1cache_1_1cache__t-members.html b/structstdex_1_1stream_1_1cache_1_1cache__t-members.html index ab90fcc2a..9220e1245 100644 --- a/structstdex_1_1stream_1_1cache_1_1cache__t-members.html +++ b/structstdex_1_1stream_1_1cache_1_1cache__t-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/structstdex_1_1stream_1_1cache_1_1cache__t.html b/structstdex_1_1stream_1_1cache_1_1cache__t.html index b9408f850..1a365a1de 100644 --- a/structstdex_1_1stream_1_1cache_1_1cache__t.html +++ b/structstdex_1_1stream_1_1cache_1_1cache__t.html @@ -119,7 +119,7 @@ enum stdex::stream::cache::cache_t::status_t  diff --git a/structstdex_1_1stream_1_1fifo_1_1node__t-members.html b/structstdex_1_1stream_1_1fifo_1_1node__t-members.html index 858bbb4c0..52a2a6a16 100644 --- a/structstdex_1_1stream_1_1fifo_1_1node__t-members.html +++ b/structstdex_1_1stream_1_1fifo_1_1node__t-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structstdex_1_1stream_1_1fifo_1_1node__t.html b/structstdex_1_1stream_1_1fifo_1_1node__t.html index 028b45144..eead32452 100644 --- a/structstdex_1_1stream_1_1fifo_1_1node__t.html +++ b/structstdex_1_1stream_1_1fifo_1_1node__t.html @@ -99,7 +99,7 @@ uint8_t data [0]<
diff --git a/system_8hpp_source.html b/system_8hpp_source.html index c105f3115..ed187fc41 100644 --- a/system_8hpp_source.html +++ b/system_8hpp_source.html @@ -182,7 +182,7 @@ $(document).ready(function() { init_codefold(0); });
117 return *this;
118 }
119
-
120 virtual ~sys_object()
+
120 virtual ~sys_object() noexcept(false)
121 {
122 if (m_h != invalid_handle)
123 close(m_h);
@@ -286,7 +286,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/unicode_8cpp_source.html b/unicode_8cpp_source.html index 33e613673..03b3a7f1c 100644 --- a/unicode_8cpp_source.html +++ b/unicode_8cpp_source.html @@ -174,7 +174,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/unicode_8hpp_source.html b/unicode_8hpp_source.html index 31665fe95..ed44c7e55 100644 --- a/unicode_8hpp_source.html +++ b/unicode_8hpp_source.html @@ -607,7 +607,7 @@ $(document).ready(function() { init_codefold(0); });
diff --git a/vector__queue_8hpp_source.html b/vector__queue_8hpp_source.html index 3d0b5b8d2..5a42eabb9 100644 --- a/vector__queue_8hpp_source.html +++ b/vector__queue_8hpp_source.html @@ -451,7 +451,7 @@ $(document).ready(function() { init_codefold(0); });