diff --git a/_unit_tests_2compat_8hpp_source.html b/_unit_tests_2compat_8hpp_source.html index dc3b52fbf..75416b750 100644 --- a/_unit_tests_2compat_8hpp_source.html +++ b/_unit_tests_2compat_8hpp_source.html @@ -172,7 +172,7 @@ $(function() { codefold.init(0); }); diff --git a/annotated.html b/annotated.html index 68389ac17..ddb3823df 100644 --- a/annotated.html +++ b/annotated.html @@ -289,7 +289,7 @@ $(function() { diff --git a/base64_8hpp_source.html b/base64_8hpp_source.html index f959c0d92..31a83f4f9 100644 --- a/base64_8hpp_source.html +++ b/base64_8hpp_source.html @@ -548,7 +548,7 @@ $(function() { codefold.init(0); }); diff --git a/chrono_8hpp_source.html b/chrono_8hpp_source.html index 9d33a466c..6e5ce2dbf 100644 --- a/chrono_8hpp_source.html +++ b/chrono_8hpp_source.html @@ -447,7 +447,7 @@ $(function() { codefold.init(0); });
398 }
399}
-
stdex::locale
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:69
+
stdex::locale
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:74
stdex::chrono::aosn_date
AOsn date.
Definition chrono.hpp:25
stdex::chrono::aosn_date::from_dmy
static time_point from_dmy(uint8_t day, uint8_t month, int32_t year) noexcept
Returns time point from calendar day, month and year.
Definition chrono.hpp:105
stdex::chrono::aosn_date::to_dmy
static void to_dmy(const time_point tp, uint8_t *day, uint8_t *month, int32_t *year) noexcept
Returns calendar day, month and year from time point.
Definition chrono.hpp:127
@@ -469,7 +469,7 @@ $(function() { codefold.init(0); }); diff --git a/classes.html b/classes.html index a4b951a55..9caacf05c 100644 --- a/classes.html +++ b/classes.html @@ -141,7 +141,7 @@ $(function() { diff --git a/classstdex_1_1aggregate__progress-members.html b/classstdex_1_1aggregate__progress-members.html index b9661c39d..8f1556701 100644 --- a/classstdex_1_1aggregate__progress-members.html +++ b/classstdex_1_1aggregate__progress-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1aggregate__progress.html b/classstdex_1_1aggregate__progress.html index 56f563451..cbb9689ca 100644 --- a/classstdex_1_1aggregate__progress.html +++ b/classstdex_1_1aggregate__progress.html @@ -285,7 +285,7 @@ template<class T > diff --git a/classstdex_1_1aggregate__progress_1_1worker__progress-members.html b/classstdex_1_1aggregate__progress_1_1worker__progress-members.html index dd78fd1a1..834b5f245 100644 --- a/classstdex_1_1aggregate__progress_1_1worker__progress-members.html +++ b/classstdex_1_1aggregate__progress_1_1worker__progress-members.html @@ -92,10 +92,11 @@ $(function() { set_text(const char *msg)stdex::aggregate_progress< T >::worker_progressinlinevirtual show(bool show=true)stdex::aggregate_progress< T >::worker_progressinlinevirtual worker_progress(aggregate_progress< T > &host) (defined in stdex::aggregate_progress< T >::worker_progress)stdex::aggregate_progress< T >::worker_progressinline + ~progress() (defined in stdex::progress< T >)stdex::progress< T >inlinevirtual diff --git a/classstdex_1_1aggregate__progress_1_1worker__progress.html b/classstdex_1_1aggregate__progress_1_1worker__progress.html index 9a3179a12..1042fd3fa 100644 --- a/classstdex_1_1aggregate__progress_1_1worker__progress.html +++ b/classstdex_1_1aggregate__progress_1_1worker__progress.html @@ -328,7 +328,7 @@ template<class T > diff --git a/classstdex_1_1base64__dec-members.html b/classstdex_1_1base64__dec-members.html index 494b8e7f2..477834929 100644 --- a/classstdex_1_1base64__dec-members.html +++ b/classstdex_1_1base64__dec-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1base64__dec.html b/classstdex_1_1base64__dec.html index 9c39612da..ae3c52396 100644 --- a/classstdex_1_1base64__dec.html +++ b/classstdex_1_1base64__dec.html @@ -231,7 +231,7 @@ template<class T_to , class AX , class T_from > diff --git a/classstdex_1_1base64__enc-members.html b/classstdex_1_1base64__enc-members.html index c5aa56c70..00218fc0a 100644 --- a/classstdex_1_1base64__enc-members.html +++ b/classstdex_1_1base64__enc-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1base64__enc.html b/classstdex_1_1base64__enc.html index a0fc2360a..4c42c3f8a 100644 --- a/classstdex_1_1base64__enc.html +++ b/classstdex_1_1base64__enc.html @@ -236,7 +236,7 @@ template<class T , class TR , class AX > diff --git a/classstdex_1_1base64__reader-members.html b/classstdex_1_1base64__reader-members.html index e56112163..67064bbf2 100644 --- a/classstdex_1_1base64__reader-members.html +++ b/classstdex_1_1base64__reader-members.html @@ -163,7 +163,7 @@ $(function() { diff --git a/classstdex_1_1base64__reader.html b/classstdex_1_1base64__reader.html index 68b06d640..216e19c93 100644 --- a/classstdex_1_1base64__reader.html +++ b/classstdex_1_1base64__reader.html @@ -434,7 +434,7 @@ size_t m_num diff --git a/classstdex_1_1base64__writer-members.html b/classstdex_1_1base64__writer-members.html index 767db1731..1d9f4d18f 100644 --- a/classstdex_1_1base64__writer-members.html +++ b/classstdex_1_1base64__writer-members.html @@ -165,7 +165,7 @@ $(function() { diff --git a/classstdex_1_1base64__writer.html b/classstdex_1_1base64__writer.html index 035f17e2f..e195b56e2 100644 --- a/classstdex_1_1base64__writer.html +++ b/classstdex_1_1base64__writer.html @@ -441,7 +441,7 @@ size_t m_num diff --git a/classstdex_1_1basic__hash-members.html b/classstdex_1_1basic__hash-members.html index 05c83ba28..5c4c0ed66 100644 --- a/classstdex_1_1basic__hash-members.html +++ b/classstdex_1_1basic__hash-members.html @@ -89,10 +89,11 @@ $(function() { m_value (defined in stdex::basic_hash< T >)stdex::basic_hash< T >protected operator const T &() conststdex::basic_hash< T >inline size()stdex::basic_hash< T >inlinestatic + ~basic_hash() (defined in stdex::basic_hash< T >)stdex::basic_hash< T >inlinevirtual diff --git a/classstdex_1_1basic__hash.html b/classstdex_1_1basic__hash.html index 55ad32751..ab9eed8f5 100644 --- a/classstdex_1_1basic__hash.html +++ b/classstdex_1_1basic__hash.html @@ -250,7 +250,7 @@ template<class T > diff --git a/classstdex_1_1benchmark-members.html b/classstdex_1_1benchmark-members.html index 038a9f7f8..d0c8abcb0 100644 --- a/classstdex_1_1benchmark-members.html +++ b/classstdex_1_1benchmark-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1benchmark.html b/classstdex_1_1benchmark.html index 7fa927e58..a97991eba 100644 --- a/classstdex_1_1benchmark.html +++ b/classstdex_1_1benchmark.html @@ -150,7 +150,7 @@ std::chrono::time_point< std::chrono::high_resolution_clock >  diff --git a/classstdex_1_1block__hash-members.html b/classstdex_1_1block__hash-members.html index 4bccb319e..f3a8d44df 100644 --- a/classstdex_1_1block__hash-members.html +++ b/classstdex_1_1block__hash-members.html @@ -93,10 +93,11 @@ $(function() { m_value (defined in stdex::basic_hash< T >)stdex::basic_hash< T >protected operator const T &() conststdex::basic_hash< T >inline size()stdex::basic_hash< T >inlinestatic + ~basic_hash() (defined in stdex::basic_hash< T >)stdex::basic_hash< T >inlinevirtual diff --git a/classstdex_1_1block__hash.html b/classstdex_1_1block__hash.html index e7d927f92..8ef89fc69 100644 --- a/classstdex_1_1block__hash.html +++ b/classstdex_1_1block__hash.html @@ -240,7 +240,7 @@ template<class T > diff --git a/classstdex_1_1charset__encoder-members.html b/classstdex_1_1charset__encoder-members.html index c9e56da19..4fb678a18 100644 --- a/classstdex_1_1charset__encoder-members.html +++ b/classstdex_1_1charset__encoder-members.html @@ -104,7 +104,7 @@ $(function() { diff --git a/classstdex_1_1charset__encoder.html b/classstdex_1_1charset__encoder.html index c45a8143c..763ac8ff7 100644 --- a/classstdex_1_1charset__encoder.html +++ b/classstdex_1_1charset__encoder.html @@ -556,7 +556,7 @@ template<class TR_to = std::char_traits<T_to>, class AX_to = std::all diff --git a/classstdex_1_1crc32__hash-members.html b/classstdex_1_1crc32__hash-members.html index cf32ad379..fb9551891 100644 --- a/classstdex_1_1crc32__hash-members.html +++ b/classstdex_1_1crc32__hash-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1crc32__hash.html b/classstdex_1_1crc32__hash.html index 19515e404..96e5d4690 100644 --- a/classstdex_1_1crc32__hash.html +++ b/classstdex_1_1crc32__hash.html @@ -240,7 +240,7 @@ crc32_t m_value diff --git a/classstdex_1_1global__progress-members.html b/classstdex_1_1global__progress-members.html index 098852fff..c9c283bc9 100644 --- a/classstdex_1_1global__progress-members.html +++ b/classstdex_1_1global__progress-members.html @@ -96,10 +96,11 @@ $(function() { set_section_range(T start, T end)stdex::global_progress< T >inline set_text(const char *msg)stdex::global_progress< T >inlinevirtual show(bool show=true)stdex::global_progress< T >inlinevirtual + ~progress() (defined in stdex::progress< T >)stdex::progress< T >inlinevirtual diff --git a/classstdex_1_1global__progress.html b/classstdex_1_1global__progress.html index 170a51c36..9a0517f2e 100644 --- a/classstdex_1_1global__progress.html +++ b/classstdex_1_1global__progress.html @@ -523,7 +523,7 @@ template<class T > diff --git a/classstdex_1_1hex__dec-members.html b/classstdex_1_1hex__dec-members.html index dcea4e4d4..fea8ada13 100644 --- a/classstdex_1_1hex__dec-members.html +++ b/classstdex_1_1hex__dec-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1hex__dec.html b/classstdex_1_1hex__dec.html index 47d407a67..1b733deb3 100644 --- a/classstdex_1_1hex__dec.html +++ b/classstdex_1_1hex__dec.html @@ -213,7 +213,7 @@ template<class T_to , class AX , class T_from > diff --git a/classstdex_1_1hex__enc-members.html b/classstdex_1_1hex__enc-members.html index 8f91cb348..c62d3580b 100644 --- a/classstdex_1_1hex__enc-members.html +++ b/classstdex_1_1hex__enc-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1hex__enc.html b/classstdex_1_1hex__enc.html index fab1a0b65..ef0c3c17e 100644 --- a/classstdex_1_1hex__enc.html +++ b/classstdex_1_1hex__enc.html @@ -191,7 +191,7 @@ template<class T , class TR , class AX > diff --git a/classstdex_1_1html_1_1comment-members.html b/classstdex_1_1html_1_1comment-members.html index aa4ece34d..78099b65f 100644 --- a/classstdex_1_1html_1_1comment-members.html +++ b/classstdex_1_1html_1_1comment-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1comment.html b/classstdex_1_1html_1_1comment.html index a6821bc52..22b0228fe 100644 --- a/classstdex_1_1html_1_1comment.html +++ b/classstdex_1_1html_1_1comment.html @@ -137,7 +137,7 @@ stdex::parser::html_sequence_t  diff --git a/classstdex_1_1html_1_1declaration-members.html b/classstdex_1_1html_1_1declaration-members.html index 8f9f0e60d..dd36bff91 100644 --- a/classstdex_1_1html_1_1declaration-members.html +++ b/classstdex_1_1html_1_1declaration-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1declaration.html b/classstdex_1_1html_1_1declaration.html index b7f3f3a09..41cb63c25 100644 --- a/classstdex_1_1html_1_1declaration.html +++ b/classstdex_1_1html_1_1declaration.html @@ -141,7 +141,7 @@ stdex::parser::html_sequence_t  diff --git a/classstdex_1_1html_1_1document-members.html b/classstdex_1_1html_1_1document-members.html index 6519116ba..a7d941fa8 100644 --- a/classstdex_1_1html_1_1document-members.html +++ b/classstdex_1_1html_1_1document-members.html @@ -109,7 +109,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1document.html b/classstdex_1_1html_1_1document.html index ed5040781..afc570c05 100644 --- a/classstdex_1_1html_1_1document.html +++ b/classstdex_1_1html_1_1document.html @@ -199,7 +199,7 @@ class stdex::html::document< T, TR, AX >

HTML document.

diff --git a/classstdex_1_1html_1_1element-members.html b/classstdex_1_1html_1_1element-members.html index 0be222a92..de752af54 100644 --- a/classstdex_1_1html_1_1element-members.html +++ b/classstdex_1_1html_1_1element-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1element.html b/classstdex_1_1html_1_1element.html index 0c06e57b9..0833107b1 100644 --- a/classstdex_1_1html_1_1element.html +++ b/classstdex_1_1html_1_1element.html @@ -154,7 +154,7 @@ stdex::parser::html_sequence_t  diff --git a/classstdex_1_1html_1_1element__end-members.html b/classstdex_1_1html_1_1element__end-members.html index c47650cfe..281f8ee8c 100644 --- a/classstdex_1_1html_1_1element__end-members.html +++ b/classstdex_1_1html_1_1element__end-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1element__end.html b/classstdex_1_1html_1_1element__end.html index a0575a724..a16695b39 100644 --- a/classstdex_1_1html_1_1element__end.html +++ b/classstdex_1_1html_1_1element__end.html @@ -145,7 +145,7 @@ stdex::parser::html_sequence_t  diff --git a/classstdex_1_1html_1_1element__start-members.html b/classstdex_1_1html_1_1element__start-members.html index 86582e235..10e2c116d 100644 --- a/classstdex_1_1html_1_1element__start-members.html +++ b/classstdex_1_1html_1_1element__start-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1element__start.html b/classstdex_1_1html_1_1element__start.html index 9e3d38d25..5cb2f6f86 100644 --- a/classstdex_1_1html_1_1element__start.html +++ b/classstdex_1_1html_1_1element__start.html @@ -164,7 +164,7 @@ template<class T > diff --git a/classstdex_1_1html_1_1instruction-members.html b/classstdex_1_1html_1_1instruction-members.html index 40a073d8a..40be76e4c 100644 --- a/classstdex_1_1html_1_1instruction-members.html +++ b/classstdex_1_1html_1_1instruction-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1instruction.html b/classstdex_1_1html_1_1instruction.html index b63864e90..765e19eba 100644 --- a/classstdex_1_1html_1_1instruction.html +++ b/classstdex_1_1html_1_1instruction.html @@ -137,7 +137,7 @@ stdex::parser::html_sequence_t  diff --git a/classstdex_1_1html_1_1parser-members.html b/classstdex_1_1html_1_1parser-members.html index 085ee2ef3..8d14225f3 100644 --- a/classstdex_1_1html_1_1parser-members.html +++ b/classstdex_1_1html_1_1parser-members.html @@ -112,7 +112,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1parser.html b/classstdex_1_1html_1_1parser.html index 0403d2fed..83439af34 100644 --- a/classstdex_1_1html_1_1parser.html +++ b/classstdex_1_1html_1_1parser.html @@ -564,7 +564,7 @@ template<class T , class TR , class AX > diff --git a/classstdex_1_1html_1_1sequence-members.html b/classstdex_1_1html_1_1sequence-members.html index 237261b78..2b7811da6 100644 --- a/classstdex_1_1html_1_1sequence-members.html +++ b/classstdex_1_1html_1_1sequence-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1sequence.html b/classstdex_1_1html_1_1sequence.html index 19d64d568..2b13beb58 100644 --- a/classstdex_1_1html_1_1sequence.html +++ b/classstdex_1_1html_1_1sequence.html @@ -132,7 +132,7 @@ stdex::parser::html_sequence_t  diff --git a/classstdex_1_1html_1_1starting__token-members.html b/classstdex_1_1html_1_1starting__token-members.html index 5ade969d4..05869f19b 100644 --- a/classstdex_1_1html_1_1starting__token-members.html +++ b/classstdex_1_1html_1_1starting__token-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1starting__token.html b/classstdex_1_1html_1_1starting__token.html index d3f41dbde..f8deca6da 100644 --- a/classstdex_1_1html_1_1starting__token.html +++ b/classstdex_1_1html_1_1starting__token.html @@ -183,7 +183,7 @@ class stdex::html::starting_token< T, TR, AX >

Token representing

diff --git a/classstdex_1_1html_1_1text__token-members.html b/classstdex_1_1html_1_1text__token-members.html index ff2d98089..d8c6e9f6c 100644 --- a/classstdex_1_1html_1_1text__token-members.html +++ b/classstdex_1_1html_1_1text__token-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1text__token.html b/classstdex_1_1html_1_1text__token.html index 93a1f7ae1..39ca90195 100644 --- a/classstdex_1_1html_1_1text__token.html +++ b/classstdex_1_1html_1_1text__token.html @@ -170,7 +170,7 @@ class stdex::html::text_token< T, TR, AX >

Token representing part

diff --git a/classstdex_1_1html_1_1token-members.html b/classstdex_1_1html_1_1token-members.html index 85cceb583..fca7af4f4 100644 --- a/classstdex_1_1html_1_1token-members.html +++ b/classstdex_1_1html_1_1token-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1token.html b/classstdex_1_1html_1_1token.html index bf1a58496..2584ccfdc 100644 --- a/classstdex_1_1html_1_1token.html +++ b/classstdex_1_1html_1_1token.html @@ -231,7 +231,7 @@ template<class TR = std::char_traits<wchar_t>, class AX = std::alloca diff --git a/classstdex_1_1html_1_1url__token-members.html b/classstdex_1_1html_1_1url__token-members.html index e1e54e27a..99d2e106d 100644 --- a/classstdex_1_1html_1_1url__token-members.html +++ b/classstdex_1_1html_1_1url__token-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1html_1_1url__token.html b/classstdex_1_1html_1_1url__token.html index 8bf7db544..5febb89ef 100644 --- a/classstdex_1_1html_1_1url__token.html +++ b/classstdex_1_1html_1_1url__token.html @@ -165,7 +165,7 @@ class stdex::html::url_token< T, TR, AX >

HTTP token representing

diff --git a/classstdex_1_1idrec_1_1record-members.html b/classstdex_1_1idrec_1_1record-members.html index 52e014d7b..28f2f8030 100644 --- a/classstdex_1_1idrec_1_1record-members.html +++ b/classstdex_1_1idrec_1_1record-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1idrec_1_1record.html b/classstdex_1_1idrec_1_1record.html index d0c30cfac..a193c7156 100644 --- a/classstdex_1_1idrec_1_1record.html +++ b/classstdex_1_1idrec_1_1record.html @@ -764,7 +764,7 @@ template<class T , class T_id , const T_id ID, class T_size , T_size N_align& diff --git a/classstdex_1_1lazy__progress-members.html b/classstdex_1_1lazy__progress-members.html index 0dbce24bf..4bbc5c51f 100644 --- a/classstdex_1_1lazy__progress-members.html +++ b/classstdex_1_1lazy__progress-members.html @@ -94,10 +94,11 @@ $(function() { set_range(T start, T end)stdex::lazy_progress< T >inlinevirtual set_text(const char *msg)stdex::progress< T >inlinevirtual show(bool show=true)stdex::progress< T >inlinevirtual + ~progress() (defined in stdex::progress< T >)stdex::progress< T >inlinevirtual diff --git a/classstdex_1_1lazy__progress.html b/classstdex_1_1lazy__progress.html index 1e769a1d7..de8ab6a73 100644 --- a/classstdex_1_1lazy__progress.html +++ b/classstdex_1_1lazy__progress.html @@ -272,7 +272,7 @@ template<class T > diff --git a/classstdex_1_1locale-members.html b/classstdex_1_1locale-members.html index 34bd6bdfb..6b259f117 100644 --- a/classstdex_1_1locale-members.html +++ b/classstdex_1_1locale-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1locale.html b/classstdex_1_1locale.html index e35e5b105..a881dadeb 100644 --- a/classstdex_1_1locale.html +++ b/classstdex_1_1locale.html @@ -114,7 +114,7 @@ Public Member Functions diff --git a/classstdex_1_1md5__hash-members.html b/classstdex_1_1md5__hash-members.html index 8ca475456..7d530881b 100644 --- a/classstdex_1_1md5__hash-members.html +++ b/classstdex_1_1md5__hash-members.html @@ -92,10 +92,11 @@ $(function() { md5_hash() (defined in stdex::md5_hash)stdex::md5_hashinline operator const T &() conststdex::basic_hash< T >inline size()stdex::basic_hash< T >inlinestatic + ~basic_hash() (defined in stdex::basic_hash< T >)stdex::basic_hash< T >inlinevirtual diff --git a/classstdex_1_1md5__hash.html b/classstdex_1_1md5__hash.html index db2fa62e6..01406629e 100644 --- a/classstdex_1_1md5__hash.html +++ b/classstdex_1_1md5__hash.html @@ -261,7 +261,7 @@ uint32_t m_temp [16] diff --git a/classstdex_1_1parser_1_1basic__angle-members.html b/classstdex_1_1parser_1_1basic__angle-members.html index 677281c86..1fcc85eb3 100644 --- a/classstdex_1_1parser_1_1basic__angle-members.html +++ b/classstdex_1_1parser_1_1basic__angle-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__angle.html b/classstdex_1_1parser_1_1basic__angle.html index d9cf87c64..faf12d2ca 100644 --- a/classstdex_1_1parser_1_1basic__angle.html +++ b/classstdex_1_1parser_1_1basic__angle.html @@ -243,7 +243,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 6fa5c45e3..1925995d1 100644 --- a/classstdex_1_1parser_1_1basic__any__cu-members.html +++ b/classstdex_1_1parser_1_1basic__any__cu-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__any__cu.html b/classstdex_1_1parser_1_1basic__any__cu.html index 9cf026980..875201d3b 100644 --- a/classstdex_1_1parser_1_1basic__any__cu.html +++ b/classstdex_1_1parser_1_1basic__any__cu.html @@ -190,7 +190,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__bol-members.html b/classstdex_1_1parser_1_1basic__bol-members.html index cc53255ce..85ae7e24f 100644 --- a/classstdex_1_1parser_1_1basic__bol-members.html +++ b/classstdex_1_1parser_1_1basic__bol-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__bol.html b/classstdex_1_1parser_1_1basic__bol.html index 07efbc5fe..ebe2ed44c 100644 --- a/classstdex_1_1parser_1_1basic__bol.html +++ b/classstdex_1_1parser_1_1basic__bol.html @@ -197,7 +197,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__branch-members.html b/classstdex_1_1parser_1_1basic__branch-members.html index be30bef39..42b76b971 100644 --- a/classstdex_1_1parser_1_1basic__branch-members.html +++ b/classstdex_1_1parser_1_1basic__branch-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__branch.html b/classstdex_1_1parser_1_1basic__branch.html index c07cf3aed..9d8aa5f10 100644 --- a/classstdex_1_1parser_1_1basic__branch.html +++ b/classstdex_1_1parser_1_1basic__branch.html @@ -248,7 +248,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 88745a4bd..c207ed32f 100644 --- a/classstdex_1_1parser_1_1basic__chemical__formula-members.html +++ b/classstdex_1_1parser_1_1basic__chemical__formula-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__chemical__formula.html b/classstdex_1_1parser_1_1basic__chemical__formula.html index cbd73fec2..fe492cc34 100644 --- a/classstdex_1_1parser_1_1basic__chemical__formula.html +++ b/classstdex_1_1parser_1_1basic__chemical__formula.html @@ -238,7 +238,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 19aa09980..2f73aca4f 100644 --- a/classstdex_1_1parser_1_1basic__creditor__reference-members.html +++ b/classstdex_1_1parser_1_1basic__creditor__reference-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__creditor__reference.html b/classstdex_1_1parser_1_1basic__creditor__reference.html index a68c8b79c..605c536bc 100644 --- a/classstdex_1_1parser_1_1basic__creditor__reference.html +++ b/classstdex_1_1parser_1_1basic__creditor__reference.html @@ -239,7 +239,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__css__cdc-members.html b/classstdex_1_1parser_1_1basic__css__cdc-members.html index 7f6963379..81e2cf1ec 100644 --- a/classstdex_1_1parser_1_1basic__css__cdc-members.html +++ b/classstdex_1_1parser_1_1basic__css__cdc-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__css__cdc.html b/classstdex_1_1parser_1_1basic__css__cdc.html index 5778e783e..02bbc977c 100644 --- a/classstdex_1_1parser_1_1basic__css__cdc.html +++ b/classstdex_1_1parser_1_1basic__css__cdc.html @@ -183,7 +183,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__css__cdo-members.html b/classstdex_1_1parser_1_1basic__css__cdo-members.html index 490aa4295..ba85fca61 100644 --- a/classstdex_1_1parser_1_1basic__css__cdo-members.html +++ b/classstdex_1_1parser_1_1basic__css__cdo-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__css__cdo.html b/classstdex_1_1parser_1_1basic__css__cdo.html index b30bcf4a0..bf931db26 100644 --- a/classstdex_1_1parser_1_1basic__css__cdo.html +++ b/classstdex_1_1parser_1_1basic__css__cdo.html @@ -183,7 +183,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__css__comment-members.html b/classstdex_1_1parser_1_1basic__css__comment-members.html index 490add77e..82e6a87f2 100644 --- a/classstdex_1_1parser_1_1basic__css__comment-members.html +++ b/classstdex_1_1parser_1_1basic__css__comment-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__css__comment.html b/classstdex_1_1parser_1_1basic__css__comment.html index bf4aa5f2f..f98177a1c 100644 --- a/classstdex_1_1parser_1_1basic__css__comment.html +++ b/classstdex_1_1parser_1_1basic__css__comment.html @@ -223,7 +223,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__css__import-members.html b/classstdex_1_1parser_1_1basic__css__import-members.html index 7ed7b9395..e3533e8dd 100644 --- a/classstdex_1_1parser_1_1basic__css__import-members.html +++ b/classstdex_1_1parser_1_1basic__css__import-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__css__import.html b/classstdex_1_1parser_1_1basic__css__import.html index be52fd2a3..6a5030b1e 100644 --- a/classstdex_1_1parser_1_1basic__css__import.html +++ b/classstdex_1_1parser_1_1basic__css__import.html @@ -223,7 +223,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__css__string-members.html b/classstdex_1_1parser_1_1basic__css__string-members.html index faa0f6939..403ee9c2b 100644 --- a/classstdex_1_1parser_1_1basic__css__string-members.html +++ b/classstdex_1_1parser_1_1basic__css__string-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__css__string.html b/classstdex_1_1parser_1_1basic__css__string.html index 344b8c6e3..ec8e341a0 100644 --- a/classstdex_1_1parser_1_1basic__css__string.html +++ b/classstdex_1_1parser_1_1basic__css__string.html @@ -223,7 +223,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__css__uri-members.html b/classstdex_1_1parser_1_1basic__css__uri-members.html index 26b96a916..059117905 100644 --- a/classstdex_1_1parser_1_1basic__css__uri-members.html +++ b/classstdex_1_1parser_1_1basic__css__uri-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__css__uri.html b/classstdex_1_1parser_1_1basic__css__uri.html index 3daec7ee4..a2b8cc4d7 100644 --- a/classstdex_1_1parser_1_1basic__css__uri.html +++ b/classstdex_1_1parser_1_1basic__css__uri.html @@ -223,7 +223,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__cu-members.html b/classstdex_1_1parser_1_1basic__cu-members.html index 646e5b047..26a5cc713 100644 --- a/classstdex_1_1parser_1_1basic__cu-members.html +++ b/classstdex_1_1parser_1_1basic__cu-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__cu.html b/classstdex_1_1parser_1_1basic__cu.html index d5ff9e853..ca1c12ed3 100644 --- a/classstdex_1_1parser_1_1basic__cu.html +++ b/classstdex_1_1parser_1_1basic__cu.html @@ -200,7 +200,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 762167273..58cd8a60c 100644 --- a/classstdex_1_1parser_1_1basic__cu__set-members.html +++ b/classstdex_1_1parser_1_1basic__cu__set-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__cu__set.html b/classstdex_1_1parser_1_1basic__cu__set.html index e6654cbfa..3e4f9e2d4 100644 --- a/classstdex_1_1parser_1_1basic__cu__set.html +++ b/classstdex_1_1parser_1_1basic__cu__set.html @@ -209,7 +209,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__date-members.html b/classstdex_1_1parser_1_1basic__date-members.html index 966fff5e2..b944ba89e 100644 --- a/classstdex_1_1parser_1_1basic__date-members.html +++ b/classstdex_1_1parser_1_1basic__date-members.html @@ -103,7 +103,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__date.html b/classstdex_1_1parser_1_1basic__date.html index 0b532443c..cde934f41 100644 --- a/classstdex_1_1parser_1_1basic__date.html +++ b/classstdex_1_1parser_1_1basic__date.html @@ -251,7 +251,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 2e6cef156..e42adafde 100644 --- a/classstdex_1_1parser_1_1basic__dns__domain__char-members.html +++ b/classstdex_1_1parser_1_1basic__dns__domain__char-members.html @@ -97,7 +97,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 0e468a376..14a82cf2e 100644 --- a/classstdex_1_1parser_1_1basic__dns__domain__char.html +++ b/classstdex_1_1parser_1_1basic__dns__domain__char.html @@ -202,7 +202,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 070aae668..cd3f55bf9 100644 --- a/classstdex_1_1parser_1_1basic__dns__name-members.html +++ b/classstdex_1_1parser_1_1basic__dns__name-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__dns__name.html b/classstdex_1_1parser_1_1basic__dns__name.html index 0e5882734..bc1b2128a 100644 --- a/classstdex_1_1parser_1_1basic__dns__name.html +++ b/classstdex_1_1parser_1_1basic__dns__name.html @@ -204,7 +204,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 3b3c8ed03..12b72809f 100644 --- a/classstdex_1_1parser_1_1basic__email__address-members.html +++ b/classstdex_1_1parser_1_1basic__email__address-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__email__address.html b/classstdex_1_1parser_1_1basic__email__address.html index 3176243fc..06160d414 100644 --- a/classstdex_1_1parser_1_1basic__email__address.html +++ b/classstdex_1_1parser_1_1basic__email__address.html @@ -244,7 +244,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__emoticon-members.html b/classstdex_1_1parser_1_1basic__emoticon-members.html index 1a0b7a0b2..316ab4b12 100644 --- a/classstdex_1_1parser_1_1basic__emoticon-members.html +++ b/classstdex_1_1parser_1_1basic__emoticon-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__emoticon.html b/classstdex_1_1parser_1_1basic__emoticon.html index f8e54307f..bb6a777a5 100644 --- a/classstdex_1_1parser_1_1basic__emoticon.html +++ b/classstdex_1_1parser_1_1basic__emoticon.html @@ -242,7 +242,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__eol-members.html b/classstdex_1_1parser_1_1basic__eol-members.html index 3572c3254..c5a370f10 100644 --- a/classstdex_1_1parser_1_1basic__eol-members.html +++ b/classstdex_1_1parser_1_1basic__eol-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__eol.html b/classstdex_1_1parser_1_1basic__eol.html index d63489376..9e29f9210 100644 --- a/classstdex_1_1parser_1_1basic__eol.html +++ b/classstdex_1_1parser_1_1basic__eol.html @@ -197,7 +197,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__fraction-members.html b/classstdex_1_1parser_1_1basic__fraction-members.html index 0dcf16349..4b728765e 100644 --- a/classstdex_1_1parser_1_1basic__fraction-members.html +++ b/classstdex_1_1parser_1_1basic__fraction-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__fraction.html b/classstdex_1_1parser_1_1basic__fraction.html index af79d4d64..eb4b8ac83 100644 --- a/classstdex_1_1parser_1_1basic__fraction.html +++ b/classstdex_1_1parser_1_1basic__fraction.html @@ -231,7 +231,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__html__declaration__condition__end-members.html b/classstdex_1_1parser_1_1basic__html__declaration__condition__end-members.html index 526828021..3411f49da 100644 --- a/classstdex_1_1parser_1_1basic__html__declaration__condition__end-members.html +++ b/classstdex_1_1parser_1_1basic__html__declaration__condition__end-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__html__declaration__condition__end.html b/classstdex_1_1parser_1_1basic__html__declaration__condition__end.html index 8e299055d..943da1358 100644 --- a/classstdex_1_1parser_1_1basic__html__declaration__condition__end.html +++ b/classstdex_1_1parser_1_1basic__html__declaration__condition__end.html @@ -183,7 +183,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__html__declaration__condition__start-members.html b/classstdex_1_1parser_1_1basic__html__declaration__condition__start-members.html index 3bdf449cd..7f91c1c6b 100644 --- a/classstdex_1_1parser_1_1basic__html__declaration__condition__start-members.html +++ b/classstdex_1_1parser_1_1basic__html__declaration__condition__start-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__html__declaration__condition__start.html b/classstdex_1_1parser_1_1basic__html__declaration__condition__start.html index 30a1d9d6a..379f375a1 100644 --- a/classstdex_1_1parser_1_1basic__html__declaration__condition__start.html +++ b/classstdex_1_1parser_1_1basic__html__declaration__condition__start.html @@ -225,7 +225,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__html__ident-members.html b/classstdex_1_1parser_1_1basic__html__ident-members.html index d30b2b48a..ddbc3725d 100644 --- a/classstdex_1_1parser_1_1basic__html__ident-members.html +++ b/classstdex_1_1parser_1_1basic__html__ident-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__html__ident.html b/classstdex_1_1parser_1_1basic__html__ident.html index b341dac0d..6f840b69a 100644 --- a/classstdex_1_1parser_1_1basic__html__ident.html +++ b/classstdex_1_1parser_1_1basic__html__ident.html @@ -183,7 +183,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__html__tag-members.html b/classstdex_1_1parser_1_1basic__html__tag-members.html index 51eb63684..2ca30fa77 100644 --- a/classstdex_1_1parser_1_1basic__html__tag-members.html +++ b/classstdex_1_1parser_1_1basic__html__tag-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__html__tag.html b/classstdex_1_1parser_1_1basic__html__tag.html index 5fe4d7982..ffc5c7e2b 100644 --- a/classstdex_1_1parser_1_1basic__html__tag.html +++ b/classstdex_1_1parser_1_1basic__html__tag.html @@ -241,7 +241,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__html__value-members.html b/classstdex_1_1parser_1_1basic__html__value-members.html index fb4576f6f..174c4cde4 100644 --- a/classstdex_1_1parser_1_1basic__html__value-members.html +++ b/classstdex_1_1parser_1_1basic__html__value-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__html__value.html b/classstdex_1_1parser_1_1basic__html__value.html index 114b024a6..b078580ab 100644 --- a/classstdex_1_1parser_1_1basic__html__value.html +++ b/classstdex_1_1parser_1_1basic__html__value.html @@ -223,7 +223,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__iban-members.html b/classstdex_1_1parser_1_1basic__iban-members.html index f637ead55..310791473 100644 --- a/classstdex_1_1parser_1_1basic__iban-members.html +++ b/classstdex_1_1parser_1_1basic__iban-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__iban.html b/classstdex_1_1parser_1_1basic__iban.html index 3c26ff7cc..2021af3ca 100644 --- a/classstdex_1_1parser_1_1basic__iban.html +++ b/classstdex_1_1parser_1_1basic__iban.html @@ -243,7 +243,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer-members.html b/classstdex_1_1parser_1_1basic__integer-members.html index f5a2db061..b7c10f556 100644 --- a/classstdex_1_1parser_1_1basic__integer-members.html +++ b/classstdex_1_1parser_1_1basic__integer-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer.html b/classstdex_1_1parser_1_1basic__integer.html index 70ed43bc6..8fcf3e6a1 100644 --- a/classstdex_1_1parser_1_1basic__integer.html +++ b/classstdex_1_1parser_1_1basic__integer.html @@ -184,7 +184,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer10-members.html b/classstdex_1_1parser_1_1basic__integer10-members.html index b74e8ee09..754be8db5 100644 --- a/classstdex_1_1parser_1_1basic__integer10-members.html +++ b/classstdex_1_1parser_1_1basic__integer10-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer10.html b/classstdex_1_1parser_1_1basic__integer10.html index ff811a741..f5c805436 100644 --- a/classstdex_1_1parser_1_1basic__integer10.html +++ b/classstdex_1_1parser_1_1basic__integer10.html @@ -233,7 +233,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer10ts-members.html b/classstdex_1_1parser_1_1basic__integer10ts-members.html index 06b45764b..5baa01555 100644 --- a/classstdex_1_1parser_1_1basic__integer10ts-members.html +++ b/classstdex_1_1parser_1_1basic__integer10ts-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer10ts.html b/classstdex_1_1parser_1_1basic__integer10ts.html index acf731c1e..96e4ac16f 100644 --- a/classstdex_1_1parser_1_1basic__integer10ts.html +++ b/classstdex_1_1parser_1_1basic__integer10ts.html @@ -247,7 +247,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__integer16-members.html b/classstdex_1_1parser_1_1basic__integer16-members.html index e261eea03..cc9b15de4 100644 --- a/classstdex_1_1parser_1_1basic__integer16-members.html +++ b/classstdex_1_1parser_1_1basic__integer16-members.html @@ -113,7 +113,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__integer16.html b/classstdex_1_1parser_1_1basic__integer16.html index 172ebd42b..f856f1a43 100644 --- a/classstdex_1_1parser_1_1basic__integer16.html +++ b/classstdex_1_1parser_1_1basic__integer16.html @@ -251,7 +251,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 1925701c3..38eb683d9 100644 --- a/classstdex_1_1parser_1_1basic__ipv4__address-members.html +++ b/classstdex_1_1parser_1_1basic__ipv4__address-members.html @@ -108,7 +108,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__ipv4__address.html b/classstdex_1_1parser_1_1basic__ipv4__address.html index 949a0f00e..ed952448a 100644 --- a/classstdex_1_1parser_1_1basic__ipv4__address.html +++ b/classstdex_1_1parser_1_1basic__ipv4__address.html @@ -264,7 +264,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 a0fd499b6..42bd1200f 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__address-members.html +++ b/classstdex_1_1parser_1_1basic__ipv6__address-members.html @@ -116,7 +116,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__ipv6__address.html b/classstdex_1_1parser_1_1basic__ipv6__address.html index 2a529fdd2..7fa38f6ad 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__address.html +++ b/classstdex_1_1parser_1_1basic__ipv6__address.html @@ -289,7 +289,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 ad051e013..bd4b9d795 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 @@ -95,7 +95,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 d54d773c8..56a826596 100644 --- a/classstdex_1_1parser_1_1basic__ipv6__scope__id__char.html +++ b/classstdex_1_1parser_1_1basic__ipv6__scope__id__char.html @@ -190,7 +190,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__iterations-members.html b/classstdex_1_1parser_1_1basic__iterations-members.html index f5579a68f..9f18bdfa9 100644 --- a/classstdex_1_1parser_1_1basic__iterations-members.html +++ b/classstdex_1_1parser_1_1basic__iterations-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__iterations.html b/classstdex_1_1parser_1_1basic__iterations.html index aefedd5c5..c165abf27 100644 --- a/classstdex_1_1parser_1_1basic__iterations.html +++ b/classstdex_1_1parser_1_1basic__iterations.html @@ -210,7 +210,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 14ff426c0..155d90338 100644 --- a/classstdex_1_1parser_1_1basic__json__string-members.html +++ b/classstdex_1_1parser_1_1basic__json__string-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__json__string.html b/classstdex_1_1parser_1_1basic__json__string.html index e062ef766..5ed603f44 100644 --- a/classstdex_1_1parser_1_1basic__json__string.html +++ b/classstdex_1_1parser_1_1basic__json__string.html @@ -259,7 +259,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__mime__type-members.html b/classstdex_1_1parser_1_1basic__mime__type-members.html index 1fc34dbca..7bab4f8d8 100644 --- a/classstdex_1_1parser_1_1basic__mime__type-members.html +++ b/classstdex_1_1parser_1_1basic__mime__type-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__mime__type.html b/classstdex_1_1parser_1_1basic__mime__type.html index da99fc1ee..0c8706687 100644 --- a/classstdex_1_1parser_1_1basic__mime__type.html +++ b/classstdex_1_1parser_1_1basic__mime__type.html @@ -231,7 +231,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 42004bc6e..c73cb3753 100644 --- a/classstdex_1_1parser_1_1basic__mixed__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__mixed__numeral-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__mixed__numeral.html b/classstdex_1_1parser_1_1basic__mixed__numeral.html index e74dab1b8..8e45208c3 100644 --- a/classstdex_1_1parser_1_1basic__mixed__numeral.html +++ b/classstdex_1_1parser_1_1basic__mixed__numeral.html @@ -246,7 +246,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 31ce8c9a2..f5c2b0165 100644 --- a/classstdex_1_1parser_1_1basic__monetary__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__monetary__numeral-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__monetary__numeral.html b/classstdex_1_1parser_1_1basic__monetary__numeral.html index ecb3439a0..d9689b53a 100644 --- a/classstdex_1_1parser_1_1basic__monetary__numeral.html +++ b/classstdex_1_1parser_1_1basic__monetary__numeral.html @@ -250,7 +250,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__noop-members.html b/classstdex_1_1parser_1_1basic__noop-members.html index d3eeb75bd..8df650a2c 100644 --- a/classstdex_1_1parser_1_1basic__noop-members.html +++ b/classstdex_1_1parser_1_1basic__noop-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__noop.html b/classstdex_1_1parser_1_1basic__noop.html index 73a19fee6..634649540 100644 --- a/classstdex_1_1parser_1_1basic__noop.html +++ b/classstdex_1_1parser_1_1basic__noop.html @@ -183,7 +183,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__parser-members.html b/classstdex_1_1parser_1_1basic__parser-members.html index afdc94ec7..8c135c55b 100644 --- a/classstdex_1_1parser_1_1basic__parser-members.html +++ b/classstdex_1_1parser_1_1basic__parser-members.html @@ -94,7 +94,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__parser.html b/classstdex_1_1parser_1_1basic__parser.html index b60c7cd06..f7872f480 100644 --- a/classstdex_1_1parser_1_1basic__parser.html +++ b/classstdex_1_1parser_1_1basic__parser.html @@ -251,7 +251,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__permutation-members.html b/classstdex_1_1parser_1_1basic__permutation-members.html index 6e56df19f..f9fcf6280 100644 --- a/classstdex_1_1parser_1_1basic__permutation-members.html +++ b/classstdex_1_1parser_1_1basic__permutation-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__permutation.html b/classstdex_1_1parser_1_1basic__permutation.html index 5ac92484c..b86595a7f 100644 --- a/classstdex_1_1parser_1_1basic__permutation.html +++ b/classstdex_1_1parser_1_1basic__permutation.html @@ -211,7 +211,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 ed3555fc0..59a9584c5 100644 --- a/classstdex_1_1parser_1_1basic__phone__number-members.html +++ b/classstdex_1_1parser_1_1basic__phone__number-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__phone__number.html b/classstdex_1_1parser_1_1basic__phone__number.html index 4e076c08c..4e26dcc82 100644 --- a/classstdex_1_1parser_1_1basic__phone__number.html +++ b/classstdex_1_1parser_1_1basic__phone__number.html @@ -245,7 +245,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 293acc40c..a2c2cfa7e 100644 --- a/classstdex_1_1parser_1_1basic__punct__cu-members.html +++ b/classstdex_1_1parser_1_1basic__punct__cu-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__punct__cu.html b/classstdex_1_1parser_1_1basic__punct__cu.html index 750a2cccb..735369552 100644 --- a/classstdex_1_1parser_1_1basic__punct__cu.html +++ b/classstdex_1_1parser_1_1basic__punct__cu.html @@ -197,7 +197,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 2e7e536c9..040a29d82 100644 --- a/classstdex_1_1parser_1_1basic__roman__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__roman__numeral-members.html @@ -106,7 +106,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__roman__numeral.html b/classstdex_1_1parser_1_1basic__roman__numeral.html index 214f5ef97..80b98ff05 100644 --- a/classstdex_1_1parser_1_1basic__roman__numeral.html +++ b/classstdex_1_1parser_1_1basic__roman__numeral.html @@ -230,7 +230,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 751ca215c..4e6fe7250 100644 --- a/classstdex_1_1parser_1_1basic__scientific__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__scientific__numeral-members.html @@ -106,7 +106,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__scientific__numeral.html b/classstdex_1_1parser_1_1basic__scientific__numeral.html index 27f6289c1..84158ae75 100644 --- a/classstdex_1_1parser_1_1basic__scientific__numeral.html +++ b/classstdex_1_1parser_1_1basic__scientific__numeral.html @@ -266,7 +266,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__score-members.html b/classstdex_1_1parser_1_1basic__score-members.html index fdd3c6efa..0850491e7 100644 --- a/classstdex_1_1parser_1_1basic__score-members.html +++ b/classstdex_1_1parser_1_1basic__score-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__score.html b/classstdex_1_1parser_1_1basic__score.html index 07749255c..76eadd10d 100644 --- a/classstdex_1_1parser_1_1basic__score.html +++ b/classstdex_1_1parser_1_1basic__score.html @@ -235,7 +235,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__sequence-members.html b/classstdex_1_1parser_1_1basic__sequence-members.html index 810b34615..26edc17d9 100644 --- a/classstdex_1_1parser_1_1basic__sequence-members.html +++ b/classstdex_1_1parser_1_1basic__sequence-members.html @@ -100,7 +100,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__sequence.html b/classstdex_1_1parser_1_1basic__sequence.html index 121f87da0..6a40ad01c 100644 --- a/classstdex_1_1parser_1_1basic__sequence.html +++ b/classstdex_1_1parser_1_1basic__sequence.html @@ -208,7 +208,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__set-members.html b/classstdex_1_1parser_1_1basic__set-members.html index 688451ddd..f4f14bcd9 100644 --- a/classstdex_1_1parser_1_1basic__set-members.html +++ b/classstdex_1_1parser_1_1basic__set-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__set.html b/classstdex_1_1parser_1_1basic__set.html index a61286310..b9272922e 100644 --- a/classstdex_1_1parser_1_1basic__set.html +++ b/classstdex_1_1parser_1_1basic__set.html @@ -222,7 +222,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 7ad2bc10e..8d7daba57 100644 --- a/classstdex_1_1parser_1_1basic__si__reference-members.html +++ b/classstdex_1_1parser_1_1basic__si__reference-members.html @@ -105,7 +105,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__si__reference.html b/classstdex_1_1parser_1_1basic__si__reference.html index 075b242e5..aed2135e6 100644 --- a/classstdex_1_1parser_1_1basic__si__reference.html +++ b/classstdex_1_1parser_1_1basic__si__reference.html @@ -264,7 +264,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 3f27d45e6..bc66d4db9 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__delimiter-members.html +++ b/classstdex_1_1parser_1_1basic__si__reference__delimiter-members.html @@ -95,7 +95,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 9fdfb52a3..364c4445a 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__delimiter.html +++ b/classstdex_1_1parser_1_1basic__si__reference__delimiter.html @@ -191,7 +191,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 1956411a7..d69a17788 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__part-members.html +++ b/classstdex_1_1parser_1_1basic__si__reference__part-members.html @@ -95,7 +95,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 110c06a0d..fd29686db 100644 --- a/classstdex_1_1parser_1_1basic__si__reference__part.html +++ b/classstdex_1_1parser_1_1basic__si__reference__part.html @@ -191,7 +191,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 7a358f13f..e3e8ee1a6 100644 --- a/classstdex_1_1parser_1_1basic__signed__numeral-members.html +++ b/classstdex_1_1parser_1_1basic__signed__numeral-members.html @@ -99,7 +99,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__signed__numeral.html b/classstdex_1_1parser_1_1basic__signed__numeral.html index 2049f9590..92c9d3c82 100644 --- a/classstdex_1_1parser_1_1basic__signed__numeral.html +++ b/classstdex_1_1parser_1_1basic__signed__numeral.html @@ -238,7 +238,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 5f395d713..e9f9a55df 100644 --- a/classstdex_1_1parser_1_1basic__space__cu-members.html +++ b/classstdex_1_1parser_1_1basic__space__cu-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__space__cu.html b/classstdex_1_1parser_1_1basic__space__cu.html index 784526635..721c1e115 100644 --- a/classstdex_1_1parser_1_1basic__space__cu.html +++ b/classstdex_1_1parser_1_1basic__space__cu.html @@ -197,7 +197,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 778e65ef6..309d4c4f4 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 @@ -96,7 +96,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 43795a4a9..603c04556 100644 --- a/classstdex_1_1parser_1_1basic__space__or__punct__cu.html +++ b/classstdex_1_1parser_1_1basic__space__or__punct__cu.html @@ -197,7 +197,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__string-members.html b/classstdex_1_1parser_1_1basic__string-members.html index a081413dc..f50a3f821 100644 --- a/classstdex_1_1parser_1_1basic__string-members.html +++ b/classstdex_1_1parser_1_1basic__string-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__string.html b/classstdex_1_1parser_1_1basic__string.html index c4c348d73..88d777f72 100644 --- a/classstdex_1_1parser_1_1basic__string.html +++ b/classstdex_1_1parser_1_1basic__string.html @@ -197,7 +197,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 e64a0b21f..9a55881d6 100644 --- a/classstdex_1_1parser_1_1basic__string__branch-members.html +++ b/classstdex_1_1parser_1_1basic__string__branch-members.html @@ -107,7 +107,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__string__branch.html b/classstdex_1_1parser_1_1basic__string__branch.html index b7a958dbc..57cc67482 100644 --- a/classstdex_1_1parser_1_1basic__string__branch.html +++ b/classstdex_1_1parser_1_1basic__string__branch.html @@ -189,7 +189,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 869eeff74..656924425 100644 --- a/classstdex_1_1parser_1_1basic__time-members.html +++ b/classstdex_1_1parser_1_1basic__time-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__time.html b/classstdex_1_1parser_1_1basic__time.html index 16463e697..39de8b305 100644 --- a/classstdex_1_1parser_1_1basic__time.html +++ b/classstdex_1_1parser_1_1basic__time.html @@ -241,7 +241,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1basic__url-members.html b/classstdex_1_1parser_1_1basic__url-members.html index 8e3d52023..d17109932 100644 --- a/classstdex_1_1parser_1_1basic__url-members.html +++ b/classstdex_1_1parser_1_1basic__url-members.html @@ -111,7 +111,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url.html b/classstdex_1_1parser_1_1basic__url.html index d77ee9e74..d5984bb9e 100644 --- a/classstdex_1_1parser_1_1basic__url.html +++ b/classstdex_1_1parser_1_1basic__url.html @@ -271,7 +271,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 bd7845b91..2da5c8c30 100644 --- a/classstdex_1_1parser_1_1basic__url__password__char-members.html +++ b/classstdex_1_1parser_1_1basic__url__password__char-members.html @@ -95,7 +95,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 e77382c24..116d22075 100644 --- a/classstdex_1_1parser_1_1basic__url__password__char.html +++ b/classstdex_1_1parser_1_1basic__url__password__char.html @@ -190,7 +190,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 f3dd7c393..a29bc7612 100644 --- a/classstdex_1_1parser_1_1basic__url__path-members.html +++ b/classstdex_1_1parser_1_1basic__url__path-members.html @@ -101,7 +101,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1basic__url__path.html b/classstdex_1_1parser_1_1basic__url__path.html index 7e5a87df2..a68cc7d5e 100644 --- a/classstdex_1_1parser_1_1basic__url__path.html +++ b/classstdex_1_1parser_1_1basic__url__path.html @@ -241,7 +241,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 10d352dc5..702b2486d 100644 --- a/classstdex_1_1parser_1_1basic__url__path__char-members.html +++ b/classstdex_1_1parser_1_1basic__url__path__char-members.html @@ -95,7 +95,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 47cf3db30..bcaf0dc16 100644 --- a/classstdex_1_1parser_1_1basic__url__path__char.html +++ b/classstdex_1_1parser_1_1basic__url__path__char.html @@ -190,7 +190,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 0e5ad425e..27f719779 100644 --- a/classstdex_1_1parser_1_1basic__url__username__char-members.html +++ b/classstdex_1_1parser_1_1basic__url__username__char-members.html @@ -95,7 +95,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 ef98459fd..ec7f44d16 100644 --- a/classstdex_1_1parser_1_1basic__url__username__char.html +++ b/classstdex_1_1parser_1_1basic__url__username__char.html @@ -190,7 +190,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1http__agent-members.html b/classstdex_1_1parser_1_1http__agent-members.html index 007229484..a754986da 100644 --- a/classstdex_1_1parser_1_1http__agent-members.html +++ b/classstdex_1_1parser_1_1http__agent-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__agent.html b/classstdex_1_1parser_1_1http__agent.html index 4547601bd..f4db3f0cc 100644 --- a/classstdex_1_1parser_1_1http__agent.html +++ b/classstdex_1_1parser_1_1http__agent.html @@ -184,7 +184,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 82f287f7b..7a94971b0 100644 --- a/classstdex_1_1parser_1_1http__any__type-members.html +++ b/classstdex_1_1parser_1_1http__any__type-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__any__type.html b/classstdex_1_1parser_1_1http__any__type.html index 42a1242db..7d09c6201 100644 --- a/classstdex_1_1parser_1_1http__any__type.html +++ b/classstdex_1_1parser_1_1http__any__type.html @@ -143,7 +143,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 e5fe16b12..b4c0daece 100644 --- a/classstdex_1_1parser_1_1http__asterisk-members.html +++ b/classstdex_1_1parser_1_1http__asterisk-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__asterisk.html b/classstdex_1_1parser_1_1http__asterisk.html index 50c62b048..efaff4da2 100644 --- a/classstdex_1_1parser_1_1http__asterisk.html +++ b/classstdex_1_1parser_1_1http__asterisk.html @@ -143,7 +143,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 bdd107b52..fe3ea8a32 100644 --- a/classstdex_1_1parser_1_1http__cookie-members.html +++ b/classstdex_1_1parser_1_1http__cookie-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__cookie.html b/classstdex_1_1parser_1_1http__cookie.html index d52969f95..df09a2b79 100644 --- a/classstdex_1_1parser_1_1http__cookie.html +++ b/classstdex_1_1parser_1_1http__cookie.html @@ -194,7 +194,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 29e292333..c441151dd 100644 --- a/classstdex_1_1parser_1_1http__cookie__parameter-members.html +++ b/classstdex_1_1parser_1_1http__cookie__parameter-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__cookie__parameter.html b/classstdex_1_1parser_1_1http__cookie__parameter.html index f84590257..b7c3ad3eb 100644 --- a/classstdex_1_1parser_1_1http__cookie__parameter.html +++ b/classstdex_1_1parser_1_1http__cookie__parameter.html @@ -188,7 +188,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 3fd1fc70f..63a5cad5e 100644 --- a/classstdex_1_1parser_1_1http__header-members.html +++ b/classstdex_1_1parser_1_1http__header-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__header.html b/classstdex_1_1parser_1_1http__header.html index 2eea1f341..7e17040e7 100644 --- a/classstdex_1_1parser_1_1http__header.html +++ b/classstdex_1_1parser_1_1http__header.html @@ -188,7 +188,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 89a0f881a..55817f385 100644 --- a/classstdex_1_1parser_1_1http__language-members.html +++ b/classstdex_1_1parser_1_1http__language-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__language.html b/classstdex_1_1parser_1_1http__language.html index 31e4f692f..ed21d40c8 100644 --- a/classstdex_1_1parser_1_1http__language.html +++ b/classstdex_1_1parser_1_1http__language.html @@ -181,7 +181,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 34e1b29c7..ba275bc4d 100644 --- a/classstdex_1_1parser_1_1http__line__break-members.html +++ b/classstdex_1_1parser_1_1http__line__break-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__line__break.html b/classstdex_1_1parser_1_1http__line__break.html index b9e7551a3..6c9917891 100644 --- a/classstdex_1_1parser_1_1http__line__break.html +++ b/classstdex_1_1parser_1_1http__line__break.html @@ -143,7 +143,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 4cd0a11d0..01edaf47c 100644 --- a/classstdex_1_1parser_1_1http__media__range-members.html +++ b/classstdex_1_1parser_1_1http__media__range-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__media__range.html b/classstdex_1_1parser_1_1http__media__range.html index 2cf24722e..75484fa29 100644 --- a/classstdex_1_1parser_1_1http__media__range.html +++ b/classstdex_1_1parser_1_1http__media__range.html @@ -189,7 +189,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 83889036c..a6d62fe4a 100644 --- a/classstdex_1_1parser_1_1http__media__type-members.html +++ b/classstdex_1_1parser_1_1http__media__type-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__media__type.html b/classstdex_1_1parser_1_1http__media__type.html index d14dcf1c7..1527af831 100644 --- a/classstdex_1_1parser_1_1http__media__type.html +++ b/classstdex_1_1parser_1_1http__media__type.html @@ -233,7 +233,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 a897feac8..2e9c774ba 100644 --- a/classstdex_1_1parser_1_1http__parameter-members.html +++ b/classstdex_1_1parser_1_1http__parameter-members.html @@ -91,7 +91,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__parameter.html b/classstdex_1_1parser_1_1http__parameter.html index 49fd668af..467374a9b 100644 --- a/classstdex_1_1parser_1_1http__parameter.html +++ b/classstdex_1_1parser_1_1http__parameter.html @@ -190,7 +190,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 a20b0e64d..c2fcf61d3 100644 --- a/classstdex_1_1parser_1_1http__protocol-members.html +++ b/classstdex_1_1parser_1_1http__protocol-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__protocol.html b/classstdex_1_1parser_1_1http__protocol.html index df58b0fcf..94272960f 100644 --- a/classstdex_1_1parser_1_1http__protocol.html +++ b/classstdex_1_1parser_1_1http__protocol.html @@ -194,7 +194,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 81c1eb497..458c0eb9a 100644 --- a/classstdex_1_1parser_1_1http__quoted__string-members.html +++ b/classstdex_1_1parser_1_1http__quoted__string-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__quoted__string.html b/classstdex_1_1parser_1_1http__quoted__string.html index 45bb9cc01..f6607bd10 100644 --- a/classstdex_1_1parser_1_1http__quoted__string.html +++ b/classstdex_1_1parser_1_1http__quoted__string.html @@ -186,7 +186,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 5c2f64f1a..22d6edaa4 100644 --- a/classstdex_1_1parser_1_1http__request-members.html +++ b/classstdex_1_1parser_1_1http__request-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__request.html b/classstdex_1_1parser_1_1http__request.html index 978aca5fc..6df311d2a 100644 --- a/classstdex_1_1parser_1_1http__request.html +++ b/classstdex_1_1parser_1_1http__request.html @@ -194,7 +194,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 797a76b53..362fbd8a9 100644 --- a/classstdex_1_1parser_1_1http__space-members.html +++ b/classstdex_1_1parser_1_1http__space-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__space.html b/classstdex_1_1parser_1_1http__space.html index 250ae3756..1bb2af7ef 100644 --- a/classstdex_1_1parser_1_1http__space.html +++ b/classstdex_1_1parser_1_1http__space.html @@ -150,7 +150,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 5548ea658..867b67932 100644 --- a/classstdex_1_1parser_1_1http__text__char-members.html +++ b/classstdex_1_1parser_1_1http__text__char-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__text__char.html b/classstdex_1_1parser_1_1http__text__char.html index d5ee4080b..d951c6e36 100644 --- a/classstdex_1_1parser_1_1http__text__char.html +++ b/classstdex_1_1parser_1_1http__text__char.html @@ -150,7 +150,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 13b41d4d8..fad7f6485 100644 --- a/classstdex_1_1parser_1_1http__token-members.html +++ b/classstdex_1_1parser_1_1http__token-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__token.html b/classstdex_1_1parser_1_1http__token.html index 6718c90b6..887008c1f 100644 --- a/classstdex_1_1parser_1_1http__token.html +++ b/classstdex_1_1parser_1_1http__token.html @@ -143,7 +143,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 fdc90607a..188feafa7 100644 --- a/classstdex_1_1parser_1_1http__url-members.html +++ b/classstdex_1_1parser_1_1http__url-members.html @@ -93,7 +93,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url.html b/classstdex_1_1parser_1_1http__url.html index d2dc62387..a33ef1edb 100644 --- a/classstdex_1_1parser_1_1http__url.html +++ b/classstdex_1_1parser_1_1http__url.html @@ -193,7 +193,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 27912c763..e80f49b14 100644 --- a/classstdex_1_1parser_1_1http__url__parameter-members.html +++ b/classstdex_1_1parser_1_1http__url__parameter-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__parameter.html b/classstdex_1_1parser_1_1http__url__parameter.html index 051402a86..3791a3122 100644 --- a/classstdex_1_1parser_1_1http__url__parameter.html +++ b/classstdex_1_1parser_1_1http__url__parameter.html @@ -184,7 +184,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 26261515f..152628c03 100644 --- a/classstdex_1_1parser_1_1http__url__path-members.html +++ b/classstdex_1_1parser_1_1http__url__path-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__path.html b/classstdex_1_1parser_1_1http__url__path.html index a183c48cb..2459420d2 100644 --- a/classstdex_1_1parser_1_1http__url__path.html +++ b/classstdex_1_1parser_1_1http__url__path.html @@ -182,7 +182,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 1920a9006..6e2cdd80c 100644 --- a/classstdex_1_1parser_1_1http__url__path__segment-members.html +++ b/classstdex_1_1parser_1_1http__url__path__segment-members.html @@ -87,7 +87,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 c525d2cd1..c20ac962d 100644 --- a/classstdex_1_1parser_1_1http__url__path__segment.html +++ b/classstdex_1_1parser_1_1http__url__path__segment.html @@ -143,7 +143,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 04f10610e..b0888c424 100644 --- a/classstdex_1_1parser_1_1http__url__port-members.html +++ b/classstdex_1_1parser_1_1http__url__port-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__port.html b/classstdex_1_1parser_1_1http__url__port.html index 89d2188f5..adb268d48 100644 --- a/classstdex_1_1parser_1_1http__url__port.html +++ b/classstdex_1_1parser_1_1http__url__port.html @@ -184,7 +184,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 43d4a0d25..7e1ce697b 100644 --- a/classstdex_1_1parser_1_1http__url__server-members.html +++ b/classstdex_1_1parser_1_1http__url__server-members.html @@ -87,7 +87,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__url__server.html b/classstdex_1_1parser_1_1http__url__server.html index 5f78fd555..934553497 100644 --- a/classstdex_1_1parser_1_1http__url__server.html +++ b/classstdex_1_1parser_1_1http__url__server.html @@ -143,7 +143,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 cf5958a1e..3dd41c2d5 100644 --- a/classstdex_1_1parser_1_1http__value-members.html +++ b/classstdex_1_1parser_1_1http__value-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__value.html b/classstdex_1_1parser_1_1http__value.html index 4bfdd5334..1d4ebd4b9 100644 --- a/classstdex_1_1parser_1_1http__value.html +++ b/classstdex_1_1parser_1_1http__value.html @@ -186,7 +186,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 c0a63ef5d..071e4df3d 100644 --- a/classstdex_1_1parser_1_1http__value__collection-members.html +++ b/classstdex_1_1parser_1_1http__value__collection-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__value__collection.html b/classstdex_1_1parser_1_1http__value__collection.html index 338cb8304..b56ce5226 100644 --- a/classstdex_1_1parser_1_1http__value__collection.html +++ b/classstdex_1_1parser_1_1http__value__collection.html @@ -109,7 +109,7 @@ class stdex::parser::http_value_collection< KEY, T >

Collection of

diff --git a/classstdex_1_1parser_1_1http__weight-members.html b/classstdex_1_1parser_1_1http__weight-members.html index 4f2c369e8..0674ced96 100644 --- a/classstdex_1_1parser_1_1http__weight-members.html +++ b/classstdex_1_1parser_1_1http__weight-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__weight.html b/classstdex_1_1parser_1_1http__weight.html index 570c3a764..00c9bda22 100644 --- a/classstdex_1_1parser_1_1http__weight.html +++ b/classstdex_1_1parser_1_1http__weight.html @@ -185,7 +185,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 4918e219e..2ec5e70c1 100644 --- a/classstdex_1_1parser_1_1http__weighted__value-members.html +++ b/classstdex_1_1parser_1_1http__weighted__value-members.html @@ -92,7 +92,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1http__weighted__value.html b/classstdex_1_1parser_1_1http__weighted__value.html index 2738996c5..e3262291b 100644 --- a/classstdex_1_1parser_1_1http__weighted__value.html +++ b/classstdex_1_1parser_1_1http__weighted__value.html @@ -193,7 +193,7 @@ template<clas diff --git a/classstdex_1_1parser_1_1parser__collection-members.html b/classstdex_1_1parser_1_1parser__collection-members.html index 1882e90e9..9efc4465b 100644 --- a/classstdex_1_1parser_1_1parser__collection-members.html +++ b/classstdex_1_1parser_1_1parser__collection-members.html @@ -98,7 +98,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1parser__collection.html b/classstdex_1_1parser_1_1parser__collection.html index b4b2b326c..37a4313e4 100644 --- a/classstdex_1_1parser_1_1parser__collection.html +++ b/classstdex_1_1parser_1_1parser__collection.html @@ -193,7 +193,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 ef1f0c0ad..be4b8c7ef 100644 --- a/classstdex_1_1parser_1_1sgml__any__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__any__cp-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__any__cp.html b/classstdex_1_1parser_1_1sgml__any__cp.html index 1997a0396..97a251d11 100644 --- a/classstdex_1_1parser_1_1sgml__any__cp.html +++ b/classstdex_1_1parser_1_1sgml__any__cp.html @@ -158,7 +158,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 7402e47e3..5c6bc67bd 100644 --- a/classstdex_1_1parser_1_1sgml__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__cp-members.html @@ -90,7 +90,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__cp.html b/classstdex_1_1parser_1_1sgml__cp.html index 8d7c911e7..e34935e61 100644 --- a/classstdex_1_1parser_1_1sgml__cp.html +++ b/classstdex_1_1parser_1_1sgml__cp.html @@ -160,7 +160,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 9ac3de82d..e28cb1eee 100644 --- a/classstdex_1_1parser_1_1sgml__cp__set-members.html +++ b/classstdex_1_1parser_1_1sgml__cp__set-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__cp__set.html b/classstdex_1_1parser_1_1sgml__cp__set.html index 4bb65cfc3..2fd97e94c 100644 --- a/classstdex_1_1parser_1_1sgml__cp__set.html +++ b/classstdex_1_1parser_1_1sgml__cp__set.html @@ -172,7 +172,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 33fa8cd88..7ad4e107b 100644 --- a/classstdex_1_1parser_1_1sgml__dns__domain__char-members.html +++ b/classstdex_1_1parser_1_1sgml__dns__domain__char-members.html @@ -97,7 +97,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 0e8349a4d..3d45c6aac 100644 --- a/classstdex_1_1parser_1_1sgml__dns__domain__char.html +++ b/classstdex_1_1parser_1_1sgml__dns__domain__char.html @@ -167,7 +167,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 d3fd41e78..b642383da 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 @@ -88,7 +88,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 a1a2b9021..f7d20392e 100644 --- a/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char.html +++ b/classstdex_1_1parser_1_1sgml__ipv6__scope__id__char.html @@ -150,7 +150,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 f59bdf92e..7ef887837 100644 --- a/classstdex_1_1parser_1_1sgml__punct__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__punct__cp-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__punct__cp.html b/classstdex_1_1parser_1_1sgml__punct__cp.html index dd68ab14c..5290fd8ae 100644 --- a/classstdex_1_1parser_1_1sgml__punct__cp.html +++ b/classstdex_1_1parser_1_1sgml__punct__cp.html @@ -162,7 +162,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 71c9d1f9f..ab52d1971 100644 --- a/classstdex_1_1parser_1_1sgml__space__cp-members.html +++ b/classstdex_1_1parser_1_1sgml__space__cp-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__space__cp.html b/classstdex_1_1parser_1_1sgml__space__cp.html index 87e4187a3..100444475 100644 --- a/classstdex_1_1parser_1_1sgml__space__cp.html +++ b/classstdex_1_1parser_1_1sgml__space__cp.html @@ -162,7 +162,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 635325fee..914befee3 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 @@ -96,7 +96,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 249fd288e..711fd81fd 100644 --- a/classstdex_1_1parser_1_1sgml__space__or__punct__cp.html +++ b/classstdex_1_1parser_1_1sgml__space__or__punct__cp.html @@ -162,7 +162,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 eaa9057f8..9913ba832 100644 --- a/classstdex_1_1parser_1_1sgml__string-members.html +++ b/classstdex_1_1parser_1_1sgml__string-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1parser_1_1sgml__string.html b/classstdex_1_1parser_1_1sgml__string.html index d760febe4..50298caee 100644 --- a/classstdex_1_1parser_1_1sgml__string.html +++ b/classstdex_1_1parser_1_1sgml__string.html @@ -157,7 +157,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 a62a75401..d11633fc6 100644 --- a/classstdex_1_1parser_1_1sgml__url__password__char-members.html +++ b/classstdex_1_1parser_1_1sgml__url__password__char-members.html @@ -96,7 +96,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 70c6a1bd2..122796937 100644 --- a/classstdex_1_1parser_1_1sgml__url__password__char.html +++ b/classstdex_1_1parser_1_1sgml__url__password__char.html @@ -158,7 +158,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 08a2fe9bf..4acd8ce2d 100644 --- a/classstdex_1_1parser_1_1sgml__url__path__char-members.html +++ b/classstdex_1_1parser_1_1sgml__url__path__char-members.html @@ -96,7 +96,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 7b32f9a90..fa646908a 100644 --- a/classstdex_1_1parser_1_1sgml__url__path__char.html +++ b/classstdex_1_1parser_1_1sgml__url__path__char.html @@ -158,7 +158,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 419b3d474..576f95d72 100644 --- a/classstdex_1_1parser_1_1sgml__url__username__char-members.html +++ b/classstdex_1_1parser_1_1sgml__url__username__char-members.html @@ -96,7 +96,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 f9320f013..c905d1880 100644 --- a/classstdex_1_1parser_1_1sgml__url__username__char.html +++ b/classstdex_1_1parser_1_1sgml__url__username__char.html @@ -158,7 +158,7 @@ std::locale m_locale diff --git a/classstdex_1_1pool-members.html b/classstdex_1_1pool-members.html index cd9aa7ab3..18da2fe04 100644 --- a/classstdex_1_1pool-members.html +++ b/classstdex_1_1pool-members.html @@ -89,7 +89,7 @@ $(function() { diff --git a/classstdex_1_1pool.html b/classstdex_1_1pool.html index 73436ec11..e4e30dd3c 100644 --- a/classstdex_1_1pool.html +++ b/classstdex_1_1pool.html @@ -194,7 +194,7 @@ template<class T > diff --git a/classstdex_1_1progress-members.html b/classstdex_1_1progress-members.html index d7c0fc2a0..c3cbced42 100644 --- a/classstdex_1_1progress-members.html +++ b/classstdex_1_1progress-members.html @@ -87,10 +87,11 @@ $(function() { set_range(T start, T end)stdex::progress< T >inlinevirtual set_text(const char *msg)stdex::progress< T >inlinevirtual show(bool show=true)stdex::progress< T >inlinevirtual + ~progress() (defined in stdex::progress< T >)stdex::progress< T >inlinevirtual diff --git a/classstdex_1_1progress.html b/classstdex_1_1progress.html index 34e65a5f8..263678bcd 100644 --- a/classstdex_1_1progress.html +++ b/classstdex_1_1progress.html @@ -313,7 +313,7 @@ template<class T > diff --git a/classstdex_1_1progress__switcher-members.html b/classstdex_1_1progress__switcher-members.html index 01e9137e6..aa164c2c2 100644 --- a/classstdex_1_1progress__switcher-members.html +++ b/classstdex_1_1progress__switcher-members.html @@ -98,11 +98,12 @@ $(function() { set_section_range(T start, T end)stdex::global_progress< T >inline set_text(const char *msg)stdex::global_progress< T >inlinevirtual show(bool show=true)stdex::global_progress< T >inlinevirtual - ~progress_switcher() (defined in stdex::progress_switcher< T >)stdex::progress_switcher< T >inline + ~progress() (defined in stdex::progress< T >)stdex::progress< T >inlinevirtual + ~progress_switcher() (defined in stdex::progress_switcher< T >)stdex::progress_switcher< T >inline diff --git a/classstdex_1_1progress__switcher.html b/classstdex_1_1progress__switcher.html index 1ad04321c..1e9b1e9ce 100644 --- a/classstdex_1_1progress__switcher.html +++ b/classstdex_1_1progress__switcher.html @@ -165,7 +165,7 @@ class stdex::progress_switcher< T >

Progress indicator switcher. <

diff --git a/classstdex_1_1ring-members.html b/classstdex_1_1ring-members.html index 4e27d869e..372e933d9 100644 --- a/classstdex_1_1ring-members.html +++ b/classstdex_1_1ring-members.html @@ -102,7 +102,7 @@ $(function() { diff --git a/classstdex_1_1ring.html b/classstdex_1_1ring.html index c5aef348c..7bb0afd89 100644 --- a/classstdex_1_1ring.html +++ b/classstdex_1_1ring.html @@ -296,7 +296,7 @@ template<class T , size_t N_cap> diff --git a/classstdex_1_1sha1__hash-members.html b/classstdex_1_1sha1__hash-members.html index 5016abd86..a8ce83465 100644 --- a/classstdex_1_1sha1__hash-members.html +++ b/classstdex_1_1sha1__hash-members.html @@ -92,10 +92,11 @@ $(function() { operator const T &() conststdex::basic_hash< T >inline sha1_hash() (defined in stdex::sha1_hash)stdex::sha1_hashinline size()stdex::basic_hash< T >inlinestatic + ~basic_hash() (defined in stdex::basic_hash< T >)stdex::basic_hash< T >inlinevirtual diff --git a/classstdex_1_1sha1__hash.html b/classstdex_1_1sha1__hash.html index 71b3e4cbf..c22bd4f15 100644 --- a/classstdex_1_1sha1__hash.html +++ b/classstdex_1_1sha1__hash.html @@ -261,7 +261,7 @@ uint32_t m_temp [16] diff --git a/classstdex_1_1spinlock-members.html b/classstdex_1_1spinlock-members.html index 8e937ba02..f99089a00 100644 --- a/classstdex_1_1spinlock-members.html +++ b/classstdex_1_1spinlock-members.html @@ -88,7 +88,7 @@ $(function() { diff --git a/classstdex_1_1spinlock.html b/classstdex_1_1spinlock.html index acfc66b01..5e61063c2 100644 --- a/classstdex_1_1spinlock.html +++ b/classstdex_1_1spinlock.html @@ -140,7 +140,7 @@ void unlock () noexcep diff --git a/classstdex_1_1stream_1_1async__reader-members.html b/classstdex_1_1stream_1_1async__reader-members.html index f93dfa22e..5ea15467f 100644 --- a/classstdex_1_1stream_1_1async__reader-members.html +++ b/classstdex_1_1stream_1_1async__reader-members.html @@ -156,7 +156,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1async__reader.html b/classstdex_1_1stream_1_1async__reader.html index 04a18903d..827b98d15 100644 --- a/classstdex_1_1stream_1_1async__reader.html +++ b/classstdex_1_1stream_1_1async__reader.html @@ -405,7 +405,7 @@ template<size_t N_cap = default_async_limit> diff --git a/classstdex_1_1stream_1_1async__writer-members.html b/classstdex_1_1stream_1_1async__writer-members.html index 93666a28f..402d40e96 100644 --- a/classstdex_1_1stream_1_1async__writer-members.html +++ b/classstdex_1_1stream_1_1async__writer-members.html @@ -156,7 +156,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1async__writer.html b/classstdex_1_1stream_1_1async__writer.html index 8220b11b8..5ac5da130 100644 --- a/classstdex_1_1stream_1_1async__writer.html +++ b/classstdex_1_1stream_1_1async__writer.html @@ -436,7 +436,7 @@ template<size_t N_cap = default_async_limit> diff --git a/classstdex_1_1stream_1_1basic-members.html b/classstdex_1_1stream_1_1basic-members.html index 06ce48e07..6a38db2fb 100644 --- a/classstdex_1_1stream_1_1basic-members.html +++ b/classstdex_1_1stream_1_1basic-members.html @@ -149,7 +149,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1basic.html b/classstdex_1_1stream_1_1basic.html index f1e6ce084..441f83e13 100644 --- a/classstdex_1_1stream_1_1basic.html +++ b/classstdex_1_1stream_1_1basic.html @@ -1255,7 +1255,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 3da041753..8067bd6ec 100644 --- a/classstdex_1_1stream_1_1basic__file-members.html +++ b/classstdex_1_1stream_1_1basic__file-members.html @@ -165,7 +165,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1basic__file.html b/classstdex_1_1stream_1_1basic__file.html index 38f667551..4288192af 100644 --- a/classstdex_1_1stream_1_1basic__file.html +++ b/classstdex_1_1stream_1_1basic__file.html @@ -929,7 +929,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 341d8293b..46c006c22 100644 --- a/classstdex_1_1stream_1_1basic__sys-members.html +++ b/classstdex_1_1stream_1_1basic__sys-members.html @@ -161,7 +161,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1basic__sys.html b/classstdex_1_1stream_1_1basic__sys.html index 0cae9a5a0..979d16587 100644 --- a/classstdex_1_1stream_1_1basic__sys.html +++ b/classstdex_1_1stream_1_1basic__sys.html @@ -511,7 +511,7 @@ sys_handle m_h
diff --git a/classstdex_1_1stream_1_1buffer-members.html b/classstdex_1_1stream_1_1buffer-members.html index 641c3c613..04f9ba68e 100644 --- a/classstdex_1_1stream_1_1buffer-members.html +++ b/classstdex_1_1stream_1_1buffer-members.html @@ -156,7 +156,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1buffer.html b/classstdex_1_1stream_1_1buffer.html index ed20ca216..ce652ee3d 100644 --- a/classstdex_1_1stream_1_1buffer.html +++ b/classstdex_1_1stream_1_1buffer.html @@ -473,7 +473,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 dcefa4e4f..22239f1ef 100644 --- a/classstdex_1_1stream_1_1buffered__sys-members.html +++ b/classstdex_1_1stream_1_1buffered__sys-members.html @@ -158,7 +158,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1buffered__sys.html b/classstdex_1_1stream_1_1buffered__sys.html index 60fda2896..04f94cf1d 100644 --- a/classstdex_1_1stream_1_1buffered__sys.html +++ b/classstdex_1_1stream_1_1buffered__sys.html @@ -363,7 +363,7 @@ void flush_write () diff --git a/classstdex_1_1stream_1_1cache-members.html b/classstdex_1_1stream_1_1cache-members.html index 100535584..8fdbd25b9 100644 --- a/classstdex_1_1stream_1_1cache-members.html +++ b/classstdex_1_1stream_1_1cache-members.html @@ -167,7 +167,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1cache.html b/classstdex_1_1stream_1_1cache.html index 57c71d919..a52ff26b1 100644 --- a/classstdex_1_1stream_1_1cache.html +++ b/classstdex_1_1stream_1_1cache.html @@ -885,7 +885,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 a317d0865..5d014c9e0 100644 --- a/classstdex_1_1stream_1_1cached__file-members.html +++ b/classstdex_1_1stream_1_1cached__file-members.html @@ -175,7 +175,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1cached__file.html b/classstdex_1_1stream_1_1cached__file.html index fa4775bad..2e5b75d1d 100644 --- a/classstdex_1_1stream_1_1cached__file.html +++ b/classstdex_1_1stream_1_1cached__file.html @@ -578,7 +578,7 @@ template<class TR = std::char_traits<schar_t>, class AX = std::alloca diff --git a/classstdex_1_1stream_1_1converter-members.html b/classstdex_1_1stream_1_1converter-members.html index e0eb3a102..263d00875 100644 --- a/classstdex_1_1stream_1_1converter-members.html +++ b/classstdex_1_1stream_1_1converter-members.html @@ -151,7 +151,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1converter.html b/classstdex_1_1stream_1_1converter.html index 4bd29ba53..f53a23c25 100644 --- a/classstdex_1_1stream_1_1converter.html +++ b/classstdex_1_1stream_1_1converter.html @@ -491,7 +491,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 b2478b58e..21b2d7f8a 100644 --- a/classstdex_1_1stream_1_1diag__file-members.html +++ b/classstdex_1_1stream_1_1diag__file-members.html @@ -168,7 +168,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1diag__file.html b/classstdex_1_1stream_1_1diag__file.html index ca8f6a6b1..083427691 100644 --- a/classstdex_1_1stream_1_1diag__file.html +++ b/classstdex_1_1stream_1_1diag__file.html @@ -717,7 +717,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1fifo-members.html b/classstdex_1_1stream_1_1fifo-members.html index 5cf90207d..22ee21858 100644 --- a/classstdex_1_1stream_1_1fifo-members.html +++ b/classstdex_1_1stream_1_1fifo-members.html @@ -156,7 +156,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1fifo.html b/classstdex_1_1stream_1_1fifo.html index 9922cbc83..539e47e39 100644 --- a/classstdex_1_1stream_1_1fifo.html +++ b/classstdex_1_1stream_1_1fifo.html @@ -463,7 +463,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1file-members.html b/classstdex_1_1stream_1_1file-members.html index 1a1ff78f1..fe0fd37c6 100644 --- a/classstdex_1_1stream_1_1file-members.html +++ b/classstdex_1_1stream_1_1file-members.html @@ -190,7 +190,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1file.html b/classstdex_1_1stream_1_1file.html index db0531b5e..93c8e97d4 100644 --- a/classstdex_1_1stream_1_1file.html +++ b/classstdex_1_1stream_1_1file.html @@ -1115,7 +1115,7 @@ template<class TR = std::char_traits<schar_t>, class AX = std::alloca diff --git a/classstdex_1_1stream_1_1file__window-members.html b/classstdex_1_1stream_1_1file__window-members.html index 0a794f4fa..b67019647 100644 --- a/classstdex_1_1stream_1_1file__window-members.html +++ b/classstdex_1_1stream_1_1file__window-members.html @@ -169,7 +169,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1file__window.html b/classstdex_1_1stream_1_1file__window.html index 80c80defd..29d232ad9 100644 --- a/classstdex_1_1stream_1_1file__window.html +++ b/classstdex_1_1stream_1_1file__window.html @@ -749,7 +749,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1limiter-members.html b/classstdex_1_1stream_1_1limiter-members.html index 612caf422..4a56676f5 100644 --- a/classstdex_1_1stream_1_1limiter-members.html +++ b/classstdex_1_1stream_1_1limiter-members.html @@ -154,7 +154,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1limiter.html b/classstdex_1_1stream_1_1limiter.html index 5cd54815a..052f39ad7 100644 --- a/classstdex_1_1stream_1_1limiter.html +++ b/classstdex_1_1stream_1_1limiter.html @@ -440,7 +440,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 c6b509949..b17dcc8d8 100644 --- a/classstdex_1_1stream_1_1memory__file-members.html +++ b/classstdex_1_1stream_1_1memory__file-members.html @@ -213,7 +213,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1memory__file.html b/classstdex_1_1stream_1_1memory__file.html index 124656262..1b955fc3d 100644 --- a/classstdex_1_1stream_1_1memory__file.html +++ b/classstdex_1_1stream_1_1memory__file.html @@ -1719,7 +1719,7 @@ template<class T > diff --git a/classstdex_1_1stream_1_1replicator-members.html b/classstdex_1_1stream_1_1replicator-members.html index b43b33215..7f9394970 100644 --- a/classstdex_1_1stream_1_1replicator-members.html +++ b/classstdex_1_1stream_1_1replicator-members.html @@ -154,7 +154,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1replicator.html b/classstdex_1_1stream_1_1replicator.html index 7771c8f13..592440f74 100644 --- a/classstdex_1_1stream_1_1replicator.html +++ b/classstdex_1_1stream_1_1replicator.html @@ -453,7 +453,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 5dfb90b65..f7264cd07 100644 --- a/classstdex_1_1stream_1_1replicator_1_1worker-members.html +++ b/classstdex_1_1stream_1_1replicator_1_1worker-members.html @@ -95,7 +95,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1replicator_1_1worker.html b/classstdex_1_1stream_1_1replicator_1_1worker.html index 2af2c98eb..876903248 100644 --- a/classstdex_1_1stream_1_1replicator_1_1worker.html +++ b/classstdex_1_1stream_1_1replicator_1_1worker.html @@ -151,7 +151,7 @@ void process_op () diff --git a/classstdex_1_1stream_1_1socket-members.html b/classstdex_1_1stream_1_1socket-members.html index 4301fd731..eb0e2c1e1 100644 --- a/classstdex_1_1stream_1_1socket-members.html +++ b/classstdex_1_1stream_1_1socket-members.html @@ -157,7 +157,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1socket.html b/classstdex_1_1stream_1_1socket.html index ca9c45248..aa0571701 100644 --- a/classstdex_1_1stream_1_1socket.html +++ b/classstdex_1_1stream_1_1socket.html @@ -509,7 +509,7 @@ state_t m_state diff --git a/classstdex_1_1stream_1_1window-members.html b/classstdex_1_1stream_1_1window-members.html index 72e7c4060..47fdd4b09 100644 --- a/classstdex_1_1stream_1_1window-members.html +++ b/classstdex_1_1stream_1_1window-members.html @@ -157,7 +157,7 @@ $(function() { diff --git a/classstdex_1_1stream_1_1window.html b/classstdex_1_1stream_1_1window.html index e5b64782f..501b5ca17 100644 --- a/classstdex_1_1stream_1_1window.html +++ b/classstdex_1_1stream_1_1window.html @@ -449,7 +449,7 @@ state_t m_state diff --git a/classstdex_1_1stream__hasher-members.html b/classstdex_1_1stream__hasher-members.html index 3f9c08e2a..c20d26168 100644 --- a/classstdex_1_1stream__hasher-members.html +++ b/classstdex_1_1stream__hasher-members.html @@ -153,7 +153,7 @@ $(function() { diff --git a/classstdex_1_1stream__hasher.html b/classstdex_1_1stream__hasher.html index 45d6e2f7d..f2cd1a0b6 100644 --- a/classstdex_1_1stream__hasher.html +++ b/classstdex_1_1stream__hasher.html @@ -432,7 +432,7 @@ template<class T > diff --git a/classstdex_1_1sys__object-members.html b/classstdex_1_1sys__object-members.html index 8959416dd..243e73286 100644 --- a/classstdex_1_1sys__object-members.html +++ b/classstdex_1_1sys__object-members.html @@ -97,7 +97,7 @@ $(function() { diff --git a/classstdex_1_1sys__object.html b/classstdex_1_1sys__object.html index f81dd1904..55e1d908e 100644 --- a/classstdex_1_1sys__object.html +++ b/classstdex_1_1sys__object.html @@ -184,7 +184,7 @@ sys_handle m_h diff --git a/classstdex_1_1timeout__progress-members.html b/classstdex_1_1timeout__progress-members.html index 070167117..7474aacbd 100644 --- a/classstdex_1_1timeout__progress-members.html +++ b/classstdex_1_1timeout__progress-members.html @@ -90,10 +90,11 @@ $(function() { set_text(const char *msg)stdex::timeout_progress< T >inlinevirtual show(bool show=true)stdex::timeout_progress< T >inlinevirtual timeout_progress(const std::chrono::nanoseconds &timeout=std::chrono::seconds(60), progress< T > *host=nullptr)stdex::timeout_progress< T >inline + ~progress() (defined in stdex::progress< T >)stdex::progress< T >inlinevirtual diff --git a/classstdex_1_1timeout__progress.html b/classstdex_1_1timeout__progress.html index 8c4dba296..f5315cdbd 100644 --- a/classstdex_1_1timeout__progress.html +++ b/classstdex_1_1timeout__progress.html @@ -363,7 +363,7 @@ template<class T > diff --git a/classstdex_1_1user__cancelled-members.html b/classstdex_1_1user__cancelled-members.html index e52b17ea9..4bcb1c96a 100644 --- a/classstdex_1_1user__cancelled-members.html +++ b/classstdex_1_1user__cancelled-members.html @@ -86,7 +86,7 @@ $(function() { diff --git a/classstdex_1_1user__cancelled.html b/classstdex_1_1user__cancelled.html index 92c528187..827f48166 100644 --- a/classstdex_1_1user__cancelled.html +++ b/classstdex_1_1user__cancelled.html @@ -142,7 +142,7 @@ Public Member Functions diff --git a/classstdex_1_1vector__queue-members.html b/classstdex_1_1vector__queue-members.html index fc61d0796..36b56ba78 100644 --- a/classstdex_1_1vector__queue-members.html +++ b/classstdex_1_1vector__queue-members.html @@ -124,7 +124,7 @@ $(function() { diff --git a/classstdex_1_1vector__queue.html b/classstdex_1_1vector__queue.html index 180473f9f..a8c6f3111 100644 --- a/classstdex_1_1vector__queue.html +++ b/classstdex_1_1vector__queue.html @@ -782,7 +782,7 @@ template<class T > diff --git a/classstdex_1_1watchdog-members.html b/classstdex_1_1watchdog-members.html index 467f0a63a..0e91c408f 100644 --- a/classstdex_1_1watchdog-members.html +++ b/classstdex_1_1watchdog-members.html @@ -96,7 +96,7 @@ $(function() { diff --git a/classstdex_1_1watchdog.html b/classstdex_1_1watchdog.html index edf3a10fe..68a0f4b0f 100644 --- a/classstdex_1_1watchdog.html +++ b/classstdex_1_1watchdog.html @@ -218,7 +218,7 @@ template<class _Clock , class _Duration = typename _Clock::duration> diff --git a/classstdex_1_1zlib__reader-members.html b/classstdex_1_1zlib__reader-members.html index 3a793f050..a9526b6da 100644 --- a/classstdex_1_1zlib__reader-members.html +++ b/classstdex_1_1zlib__reader-members.html @@ -156,7 +156,7 @@ $(function() { diff --git a/classstdex_1_1zlib__reader.html b/classstdex_1_1zlib__reader.html index 2a8117b10..4d36758d4 100644 --- a/classstdex_1_1zlib__reader.html +++ b/classstdex_1_1zlib__reader.html @@ -392,7 +392,7 @@ state_t m_state diff --git a/classstdex_1_1zlib__writer-members.html b/classstdex_1_1zlib__writer-members.html index 7ffa74081..3ba303bfb 100644 --- a/classstdex_1_1zlib__writer-members.html +++ b/classstdex_1_1zlib__writer-members.html @@ -156,7 +156,7 @@ $(function() { diff --git a/classstdex_1_1zlib__writer.html b/classstdex_1_1zlib__writer.html index d2c3abbd3..849c2b2ae 100644 --- a/classstdex_1_1zlib__writer.html +++ b/classstdex_1_1zlib__writer.html @@ -392,7 +392,7 @@ state_t m_state diff --git a/debug_8hpp_source.html b/debug_8hpp_source.html index 761abf8d3..70367c323 100644 --- a/debug_8hpp_source.html +++ b/debug_8hpp_source.html @@ -213,7 +213,7 @@ $(function() { codefold.init(0); }); diff --git a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html index 7d1763919..cfab56e9b 100644 --- a/dir_4be4f7b278e009bf0f1906cf31fb73bd.html +++ b/dir_4be4f7b278e009bf0f1906cf31fb73bd.html @@ -90,7 +90,7 @@ Files diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html index f706b625b..136d2d7a5 100644 --- a/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -88,7 +88,7 @@ Directories diff --git a/dir_fca3c47b2ea228727bd6729832f89576.html b/dir_fca3c47b2ea228727bd6729832f89576.html index cbb319a90..3693adec6 100644 --- a/dir_fca3c47b2ea228727bd6729832f89576.html +++ b/dir_fca3c47b2ea228727bd6729832f89576.html @@ -154,7 +154,7 @@ Files diff --git a/endian_8hpp_source.html b/endian_8hpp_source.html index 54ce0e880..a323d09b2 100644 --- a/endian_8hpp_source.html +++ b/endian_8hpp_source.html @@ -227,7 +227,7 @@ $(function() { codefold.init(0); }); diff --git a/exception_8hpp_source.html b/exception_8hpp_source.html index 5ebdaf982..e18bee56c 100644 --- a/exception_8hpp_source.html +++ b/exception_8hpp_source.html @@ -109,7 +109,7 @@ $(function() { codefold.init(0); }); diff --git a/files.html b/files.html index 736701e4f..704f9326a 100644 --- a/files.html +++ b/files.html @@ -121,7 +121,7 @@ $(function() { diff --git a/functions.html b/functions.html index 33bac024d..68958f9ca 100644 --- a/functions.html +++ b/functions.html @@ -97,7 +97,7 @@ $(function() { diff --git a/functions_b.html b/functions_b.html index 234a93805..363aeae0a 100644 --- a/functions_b.html +++ b/functions_b.html @@ -91,7 +91,7 @@ $(function() { diff --git a/functions_c.html b/functions_c.html index 3d86ff01a..835deb251 100644 --- a/functions_c.html +++ b/functions_c.html @@ -100,7 +100,7 @@ $(function() { diff --git a/functions_d.html b/functions_d.html index 75a3f2aaf..8e62ef927 100644 --- a/functions_d.html +++ b/functions_d.html @@ -93,7 +93,7 @@ $(function() { diff --git a/functions_e.html b/functions_e.html index f834b786b..a94c9809a 100644 --- a/functions_e.html +++ b/functions_e.html @@ -93,7 +93,7 @@ $(function() { diff --git a/functions_enum.html b/functions_enum.html index 675a51cef..5e4e6fd09 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -78,7 +78,7 @@ $(function() { diff --git a/functions_f.html b/functions_f.html index fb997f94a..e2d6fbaf1 100644 --- a/functions_f.html +++ b/functions_f.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_func.html b/functions_func.html index 22f43e7cb..27538d148 100644 --- a/functions_func.html +++ b/functions_func.html @@ -91,7 +91,7 @@ $(function() { diff --git a/functions_func_b.html b/functions_func_b.html index e863b8cfd..9ab4c8ae3 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_c.html b/functions_func_c.html index 1f4555b92..f5c575a1d 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_func_d.html b/functions_func_d.html index 53d30e12a..b0a7d6655 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_func_e.html b/functions_func_e.html index b86182939..c3fbf0a28 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_func_f.html b/functions_func_f.html index f13bc0fdb..379715a76 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -88,7 +88,7 @@ $(function() { diff --git a/functions_func_g.html b/functions_func_g.html index a73e7d538..bd9ac9988 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_func_h.html b/functions_func_h.html index 74fa79206..962526cdc 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_i.html b/functions_func_i.html index b0413aedd..96bbcf943 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -100,7 +100,7 @@ $(function() { diff --git a/functions_func_l.html b/functions_func_l.html index 20220ccfb..dc04eff31 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_func_m.html b/functions_func_m.html index e565a9089..a594c9875 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_func_n.html b/functions_func_n.html index 9c94ade28..6c13b1e47 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_o.html b/functions_func_o.html index 6c18d3e01..2d09a1413 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -94,7 +94,7 @@ $(function() { diff --git a/functions_func_p.html b/functions_func_p.html index 570ce9cf6..4c2035f2c 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_func_q.html b/functions_func_q.html index 68a7a1f32..f47029c56 100644 --- a/functions_func_q.html +++ b/functions_func_q.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_r.html b/functions_func_r.html index c5f4b503e..9c4f7e1bb 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -94,7 +94,7 @@ $(function() { diff --git a/functions_func_s.html b/functions_func_s.html index eaa063b8a..2763f6e2a 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -103,7 +103,7 @@ $(function() { diff --git a/functions_func_t.html b/functions_func_t.html index 8f7f30937..31f9b7e81 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -88,7 +88,7 @@ $(function() { diff --git a/functions_func_u.html b/functions_func_u.html index a7b142729..529c37f4a 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_func_v.html b/functions_func_v.html index 50a2b2d64..b9f98bc46 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_func_w.html b/functions_func_w.html index f2d65ec63..d1ba3669c 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_func_~.html b/functions_func_~.html index 4187a122e..680b16f42 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -82,7 +82,7 @@ $(function() { diff --git a/functions_g.html b/functions_g.html index 4a27bee20..1bf056fad 100644 --- a/functions_g.html +++ b/functions_g.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_h.html b/functions_h.html index 3b63feb89..3fbb11db2 100644 --- a/functions_h.html +++ b/functions_h.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_i.html b/functions_i.html index b58c37a5b..09b5c8553 100644 --- a/functions_i.html +++ b/functions_i.html @@ -103,7 +103,7 @@ $(function() { diff --git a/functions_l.html b/functions_l.html index 6aca2105d..720b0227c 100644 --- a/functions_l.html +++ b/functions_l.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_m.html b/functions_m.html index ab2d4f9b0..5e67cc87b 100644 --- a/functions_m.html +++ b/functions_m.html @@ -126,7 +126,7 @@ $(function() { diff --git a/functions_n.html b/functions_n.html index c3ebcfb12..47b70f4d0 100644 --- a/functions_n.html +++ b/functions_n.html @@ -90,7 +90,7 @@ $(function() { diff --git a/functions_o.html b/functions_o.html index f552b0fd0..c46d32629 100644 --- a/functions_o.html +++ b/functions_o.html @@ -98,7 +98,7 @@ $(function() { diff --git a/functions_p.html b/functions_p.html index f37fb023e..56b82031c 100644 --- a/functions_p.html +++ b/functions_p.html @@ -97,7 +97,7 @@ $(function() { diff --git a/functions_q.html b/functions_q.html index 008219197..54a243525 100644 --- a/functions_q.html +++ b/functions_q.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_r.html b/functions_r.html index caae6b4db..6a8d23fa4 100644 --- a/functions_r.html +++ b/functions_r.html @@ -97,7 +97,7 @@ $(function() { diff --git a/functions_rela.html b/functions_rela.html index 582aa2e82..5e560cd66 100644 --- a/functions_rela.html +++ b/functions_rela.html @@ -79,7 +79,7 @@ $(function() { diff --git a/functions_s.html b/functions_s.html index e53597683..e3978b465 100644 --- a/functions_s.html +++ b/functions_s.html @@ -112,7 +112,7 @@ $(function() { diff --git a/functions_t.html b/functions_t.html index f1a74ff96..7c62528b6 100644 --- a/functions_t.html +++ b/functions_t.html @@ -93,7 +93,7 @@ $(function() { diff --git a/functions_type.html b/functions_type.html index 35e60bb2a..e7990aa3c 100644 --- a/functions_type.html +++ b/functions_type.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_u.html b/functions_u.html index db9726998..5acc07050 100644 --- a/functions_u.html +++ b/functions_u.html @@ -82,7 +82,7 @@ $(function() { diff --git a/functions_v.html b/functions_v.html index 7970c3815..84da731b6 100644 --- a/functions_v.html +++ b/functions_v.html @@ -83,7 +83,7 @@ $(function() { diff --git a/functions_vars.html b/functions_vars.html index b853cac2c..0b0a5e9a4 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -85,7 +85,7 @@ $(function() { diff --git a/functions_vars_b.html b/functions_vars_b.html index ffc454bf0..19c6c36d2 100644 --- a/functions_vars_b.html +++ b/functions_vars_b.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_vars_c.html b/functions_vars_c.html index 3b9199ac6..953d04b09 100644 --- a/functions_vars_c.html +++ b/functions_vars_c.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_vars_d.html b/functions_vars_d.html index cd97eff64..84ed87a7f 100644 --- a/functions_vars_d.html +++ b/functions_vars_d.html @@ -86,7 +86,7 @@ $(function() { diff --git a/functions_vars_e.html b/functions_vars_e.html index 6bbd4332e..e4e4f9b89 100644 --- a/functions_vars_e.html +++ b/functions_vars_e.html @@ -88,7 +88,7 @@ $(function() { diff --git a/functions_vars_f.html b/functions_vars_f.html index 2fe39b327..dcb6ba839 100644 --- a/functions_vars_f.html +++ b/functions_vars_f.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_vars_h.html b/functions_vars_h.html index 37ec6dd5c..d86da0510 100644 --- a/functions_vars_h.html +++ b/functions_vars_h.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_vars_i.html b/functions_vars_i.html index d1e3c11a0..911e37685 100644 --- a/functions_vars_i.html +++ b/functions_vars_i.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_vars_l.html b/functions_vars_l.html index 47c3ee0d1..61900b44b 100644 --- a/functions_vars_l.html +++ b/functions_vars_l.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_vars_m.html b/functions_vars_m.html index dd98a099b..ea9e3eba9 100644 --- a/functions_vars_m.html +++ b/functions_vars_m.html @@ -121,7 +121,7 @@ $(function() { diff --git a/functions_vars_n.html b/functions_vars_n.html index b51e4f5f6..6ba3caf70 100644 --- a/functions_vars_n.html +++ b/functions_vars_n.html @@ -89,7 +89,7 @@ $(function() { diff --git a/functions_vars_o.html b/functions_vars_o.html index b73e28826..a34fce9ff 100644 --- a/functions_vars_o.html +++ b/functions_vars_o.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_vars_p.html b/functions_vars_p.html index 77a03dfd7..b4dfcbded 100644 --- a/functions_vars_p.html +++ b/functions_vars_p.html @@ -88,7 +88,7 @@ $(function() { diff --git a/functions_vars_r.html b/functions_vars_r.html index 488ea9c47..c65c44f75 100644 --- a/functions_vars_r.html +++ b/functions_vars_r.html @@ -82,7 +82,7 @@ $(function() { diff --git a/functions_vars_s.html b/functions_vars_s.html index 99bcd62b5..e59b1eb08 100644 --- a/functions_vars_s.html +++ b/functions_vars_s.html @@ -87,7 +87,7 @@ $(function() { diff --git a/functions_vars_t.html b/functions_vars_t.html index b429644ca..3feab7da6 100644 --- a/functions_vars_t.html +++ b/functions_vars_t.html @@ -84,7 +84,7 @@ $(function() { diff --git a/functions_vars_u.html b/functions_vars_u.html index 1542298f6..09749537d 100644 --- a/functions_vars_u.html +++ b/functions_vars_u.html @@ -80,7 +80,7 @@ $(function() { diff --git a/functions_vars_v.html b/functions_vars_v.html index 469237a52..ed2530788 100644 --- a/functions_vars_v.html +++ b/functions_vars_v.html @@ -81,7 +81,7 @@ $(function() { diff --git a/functions_vars_w.html b/functions_vars_w.html index fcbc5922c..b4a012178 100644 --- a/functions_vars_w.html +++ b/functions_vars_w.html @@ -82,7 +82,7 @@ $(function() { diff --git a/functions_w.html b/functions_w.html index f35fac554..51834d894 100644 --- a/functions_w.html +++ b/functions_w.html @@ -92,7 +92,7 @@ $(function() { diff --git a/functions_~.html b/functions_~.html index 18bf5b60d..521227eb7 100644 --- a/functions_~.html +++ b/functions_~.html @@ -82,7 +82,7 @@ $(function() { diff --git a/hash_8hpp_source.html b/hash_8hpp_source.html index 1f7d600bc..b022c1268 100644 --- a/hash_8hpp_source.html +++ b/hash_8hpp_source.html @@ -111,642 +111,644 @@ $(function() { codefold.init(0); });
27 class basic_hash
28 {
29 public:
-
33 virtual void clear() = 0;
-
34
-
41 virtual void hash(_In_reads_bytes_opt_(length) const void* data, _In_ size_t length) = 0;
-
42
-
46 virtual void finalize() = 0;
-
47
-
51 static size_t size() { return sizeof(T); }
-
52
-
56 const T& data() { return m_value; };
-
57
-
61 operator const T&() const { return m_value; };
-
62
-
63 protected:
-
64 T m_value;
-
65 };
+
30 virtual ~basic_hash() {}
+
31
+
35 virtual void clear() = 0;
+
36
+
43 virtual void hash(_In_reads_bytes_opt_(length) const void* data, _In_ size_t length) = 0;
+
44
+
48 virtual void finalize() = 0;
+
49
+
53 static size_t size() { return sizeof(T); }
+
54
+
58 const T& data() { return m_value; };
+
59
+
63 operator const T&() const { return m_value; };
+
64
+
65 protected:
+
66 T m_value;
+
67 };
-
66
-
70 template<class T>
-
-
71 class block_hash : public basic_hash<T>
-
72 {
-
73 public:
-
-
74 virtual void clear()
-
75 {
-
76 m_counter[0] = m_counter[1] = 0;
-
77 }
+
68
+
72 template<class T>
+
+
73 class block_hash : public basic_hash<T>
+
74 {
+
75 public:
+
+
76 virtual void clear()
+
77 {
+
78 m_counter[0] = m_counter[1] = 0;
+
79 }
-
78
-
-
79 virtual void hash(_In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
80 {
-
81 _Assume_(data || !length);
-
82
-
83 // Compute number of bytes mod 64.
-
84 size_t j = static_cast<size_t>((m_counter[0] >> 3) & 63);
-
85
-
86 // Update number of m_counter[1].
-
87 if ((m_counter[0] += (static_cast<uint32_t>(length) << 3)) < (static_cast<uint32_t>(length) << 3))
-
88 m_counter[1]++;
-
89 m_counter[1] += static_cast<uint32_t>(length) >> 29;
-
90
-
91 // Transform as many times as possible.
-
92 size_t i, remainder = 64 - j;
-
93 if (length >= remainder) {
-
94 _Assume_(j < 64 && j + remainder <= 64);
-
95 _Assume_(remainder <= length);
-
96 memcpy(m_queue + j, data, remainder);
-
97 hash_block();
-
98 for (i = remainder; i + 64 <= length; i += 64) {
-
99#pragma warning(push)
-
100#pragma warning(disable: 6385)
-
101 memcpy(m_queue, reinterpret_cast<const uint8_t*>(data) + i, 64);
-
102#pragma warning(pop)
-
103 hash_block();
-
104 }
-
105
-
106 j = 0;
-
107 }
-
108 else
-
109 i = 0;
-
110
-
111 // Buffer remaining input.
-
112 _Assume_(j < 64 && j + length - i <= 64);
-
113 _Assume_(i <= length);
-
114 memcpy(m_queue + j, reinterpret_cast<const uint8_t*>(data) + i, length - i);
-
115 }
+
80
+
+
81 virtual void hash(_In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
82 {
+
83 _Assume_(data || !length);
+
84
+
85 // Compute number of bytes mod 64.
+
86 size_t j = static_cast<size_t>((m_counter[0] >> 3) & 63);
+
87
+
88 // Update number of m_counter[1].
+
89 if ((m_counter[0] += (static_cast<uint32_t>(length) << 3)) < (static_cast<uint32_t>(length) << 3))
+
90 m_counter[1]++;
+
91 m_counter[1] += static_cast<uint32_t>(length) >> 29;
+
92
+
93 // Transform as many times as possible.
+
94 size_t i, remainder = 64 - j;
+
95 if (length >= remainder) {
+
96 _Assume_(j < 64 && j + remainder <= 64);
+
97 _Assume_(remainder <= length);
+
98 memcpy(m_queue + j, data, remainder);
+
99 hash_block();
+
100 for (i = remainder; i + 64 <= length; i += 64) {
+
101#pragma warning(push)
+
102#pragma warning(disable: 6385)
+
103 memcpy(m_queue, reinterpret_cast<const uint8_t*>(data) + i, 64);
+
104#pragma warning(pop)
+
105 hash_block();
+
106 }
+
107
+
108 j = 0;
+
109 }
+
110 else
+
111 i = 0;
+
112
+
113 // Buffer remaining input.
+
114 _Assume_(j < 64 && j + length - i <= 64);
+
115 _Assume_(i <= length);
+
116 memcpy(m_queue + j, reinterpret_cast<const uint8_t*>(data) + i, length - i);
+
117 }
-
116
-
117 protected:
-
118 virtual void hash_block() = 0;
-
119
-
120 protected:
-
121 uint32_t m_counter[2];
-
122 union {
-
123 uint8_t m_queue[64];
-
124 uint32_t m_temp[16];
-
125 };
-
126 };
+
118
+
119 protected:
+
120 virtual void hash_block() = 0;
+
121
+
122 protected:
+
123 uint32_t m_counter[2];
+
124 union {
+
125 uint8_t m_queue[64];
+
126 uint32_t m_temp[16];
+
127 };
+
128 };
-
127
-
128#pragma warning(pop)
129
-
133 template<class T>
-
- -
135 {
-
136 public:
-
137 stream_hasher(_Inout_ basic_hash<T>& hash, _Inout_ stdex::stream::basic& source) :
- -
139 m_hash(hash)
-
140 {}
-
141
-
-
142 virtual _Success_(return != 0 || length == 0) size_t read(
-
143 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
144 {
-
145 size_t num_read = stdex::stream::converter::read(data, length);
-
146 m_hash.hash(data, num_read);
-
147 return num_read;
-
148 }
+
130#pragma warning(pop)
+
131
+
135 template<class T>
+
+ +
137 {
+
138 public:
+
139 stream_hasher(_Inout_ basic_hash<T>& hash, _Inout_ stdex::stream::basic& source) :
+ +
141 m_hash(hash)
+
142 {}
+
143
+
+
144 virtual _Success_(return != 0 || length == 0) size_t read(
+
145 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
146 {
+
147 size_t num_read = stdex::stream::converter::read(data, length);
+
148 m_hash.hash(data, num_read);
+
149 return num_read;
+
150 }
-
149
-
-
150 virtual _Success_(return != 0) size_t write(
-
151 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
152 {
-
153 size_t num_written = stdex::stream::converter::write(data, length);
-
154 m_hash.hash(data, num_written);
-
155 return num_written;
-
156 }
+
151
+
+
152 virtual _Success_(return != 0) size_t write(
+
153 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
154 {
+
155 size_t num_written = stdex::stream::converter::write(data, length);
+
156 m_hash.hash(data, num_written);
+
157 return num_written;
+
158 }
-
157
-
158 protected:
-
159 basic_hash<T>& m_hash;
-
160 };
+
159
+
160 protected:
+
161 basic_hash<T>& m_hash;
+
162 };
-
161
-
165 using crc32_t = uint32_t;
-
166
-
-
170 class crc32_hash : public basic_hash<crc32_t>
-
171 {
-
172 public:
-
173 crc32_hash(crc32_t crc = 0)
-
174 {
-
175 m_value = ~crc;
-
176 }
-
177
-
-
178 virtual void clear()
-
179 {
-
180 m_value = 0xffffffff;
-
181 }
+
163
+
167 using crc32_t = uint32_t;
+
168
+
+
172 class crc32_hash : public basic_hash<crc32_t>
+
173 {
+
174 public:
+
175 crc32_hash(crc32_t crc = 0)
+
176 {
+
177 m_value = ~crc;
+
178 }
+
179
+
+
180 virtual void clear()
+
181 {
+
182 m_value = 0xffffffff;
+
183 }
-
182
-
-
183 virtual void hash(_In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
184 {
-
185 static const uint32_t crc32_table[256] = {
-
186 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
-
187 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
-
188 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
-
189 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
-
190 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
-
191 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
-
192 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
-
193 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-
194 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
-
195 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
-
196 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
-
197 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-
198 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
-
199 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
-
200 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
-
201 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-
202 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
-
203 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-
204 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
-
205 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
-
206 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
-
207 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
-
208 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
-
209 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-
210 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
-
211 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
-
212 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
-
213 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
-
214 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
-
215 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
-
216 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
-
217 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-
218 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
-
219 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
-
220 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
-
221 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-
222 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
-
223 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
-
224 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
-
225 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-
226 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
-
227 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
-
228 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
-
229 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
-
230 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
-
231 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
-
232 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
-
233 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-
234 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
-
235 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
-
236 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
-
237 0x2d02ef8d
-
238 };
-
239
-
240 _Assume_(data || !length);
-
241 for (size_t i = 0; i < length; i++)
-
242 m_value = crc32_table[(m_value ^ reinterpret_cast<const uint8_t*>(data)[i]) & 0xff] ^ (m_value >> 8);
-
243 }
+
184
+
+
185 virtual void hash(_In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
186 {
+
187 static const uint32_t crc32_table[256] = {
+
188 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+
189 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+
190 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+
191 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+
192 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+
193 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+
194 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+
195 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+
196 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+
197 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+
198 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+
199 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+
200 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+
201 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+
202 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+
203 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+
204 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+
205 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+
206 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+
207 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+
208 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+
209 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+
210 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+
211 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+
212 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+
213 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+
214 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+
215 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+
216 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+
217 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+
218 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+
219 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+
220 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+
221 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+
222 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+
223 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+
224 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+
225 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+
226 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+
227 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+
228 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+
229 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+
230 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+
231 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+
232 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+
233 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+
234 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+
235 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+
236 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+
237 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+
238 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+
239 0x2d02ef8d
+
240 };
+
241
+
242 _Assume_(data || !length);
+
243 for (size_t i = 0; i < length; i++)
+
244 m_value = crc32_table[(m_value ^ reinterpret_cast<const uint8_t*>(data)[i]) & 0xff] ^ (m_value >> 8);
+
245 }
-
244
-
-
245 virtual void finalize()
-
246 {
-
247 m_value = ~m_value;
-
248 }
+
246
+
+
247 virtual void finalize()
+
248 {
+
249 m_value = ~m_value;
+
250 }
-
249 };
+
251 };
-
250
-
-
254 union md2_t
-
255 {
-
256 uint8_t data8[16];
-
257 uint32_t data32[4];
-
258
-
259 bool operator !=(_In_ const stdex::md2_t& other) const
-
260 {
-
261 return
-
262 (data32[0] ^ other.data32[0]) |
-
263 (data32[1] ^ other.data32[1]) |
-
264 (data32[2] ^ other.data32[2]) |
-
265 (data32[3] ^ other.data32[3]);
-
266 }
-
267
-
268 bool operator ==(_In_ const stdex::md2_t& other) const
-
269 {
-
270 return !operator !=(other);
-
271 }
-
272
-
273 friend inline stdex::stream::basic& operator >>(_Inout_ stdex::stream::basic& stream, _Out_ stdex::md2_t& data)
-
274 {
-
275 if (!stream.ok()) _Unlikely_{
-
276 memset(&data, 0, sizeof(data));
-
277 return stream;
-
278 }
-
279 stream.read_array(&data, sizeof(data), 1);
-
280 return stream;
-
281 }
-
282
-
283 friend inline stdex::stream::basic& operator <<(_Inout_ stdex::stream::basic& stream, _In_ const stdex::md2_t& data)
-
284 {
-
285 if (!stream.ok()) _Unlikely_ return stream;
-
286 stream.write_array(&data, sizeof(data), 1);
-
287 return stream;
-
288 }
-
289 };
+
252
+
+
256 union md2_t
+
257 {
+
258 uint8_t data8[16];
+
259 uint32_t data32[4];
+
260
+
261 bool operator !=(_In_ const stdex::md2_t& other) const
+
262 {
+
263 return
+
264 (data32[0] ^ other.data32[0]) |
+
265 (data32[1] ^ other.data32[1]) |
+
266 (data32[2] ^ other.data32[2]) |
+
267 (data32[3] ^ other.data32[3]);
+
268 }
+
269
+
270 bool operator ==(_In_ const stdex::md2_t& other) const
+
271 {
+
272 return !operator !=(other);
+
273 }
+
274
+
275 friend inline stdex::stream::basic& operator >>(_Inout_ stdex::stream::basic& stream, _Out_ stdex::md2_t& data)
+
276 {
+
277 if (!stream.ok()) _Unlikely_{
+
278 memset(&data, 0, sizeof(data));
+
279 return stream;
+
280 }
+
281 stream.read_array(&data, sizeof(data), 1);
+
282 return stream;
+
283 }
+
284
+
285 friend inline stdex::stream::basic& operator <<(_Inout_ stdex::stream::basic& stream, _In_ const stdex::md2_t& data)
+
286 {
+
287 if (!stream.ok()) _Unlikely_ return stream;
+
288 stream.write_array(&data, sizeof(data), 1);
+
289 return stream;
+
290 }
+
291 };
-
290
-
294 using md5_t = md2_t;
-
295
-
-
299 class md5_hash : public block_hash<md5_t>
-
300 {
-
301 public:
-
302 md5_hash()
-
303 {
-
304 clear();
-
305 }
-
306
-
-
307 virtual void clear()
-
308 {
- -
310 m_state[0] = 0x67452301;
-
311 m_state[1] = 0xefcdab89;
-
312 m_state[2] = 0x98badcfe;
-
313 m_state[3] = 0x10325476;
-
314 }
+
292
+
296 using md5_t = md2_t;
+
297
+
+
301 class md5_hash : public block_hash<md5_t>
+
302 {
+
303 public:
+
304 md5_hash()
+
305 {
+
306 clear();
+
307 }
+
308
+
+
309 virtual void clear()
+
310 {
+ +
312 m_state[0] = 0x67452301;
+
313 m_state[1] = 0xefcdab89;
+
314 m_state[2] = 0x98badcfe;
+
315 m_state[3] = 0x10325476;
+
316 }
-
315
-
-
316 virtual void finalize()
-
317 {
-
318 static const uint8_t md5_padding[64] = {
-
319 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-
322 };
-
323
-
324 // Save number of final.
-
325 uint8_t final[8];
-
326 memcpy(final, m_counter, sizeof(m_counter));
-
327
-
328 // Pad out to 56 mod 64.
-
329 size_t index = (m_counter[0] >> 3) & 0x3f;
-
330 size_t remainder = index < 56 ? 56 - index : 120 - index;
-
331 hash(md5_padding, remainder);
-
332
-
333 // Append length (before padding).
-
334 hash(final, 8);
-
335
-
336 // Store m_state in m_value.
-
337 memcpy(&m_value, m_state, sizeof(md5_t));
-
338 }
+
317
+
+
318 virtual void finalize()
+
319 {
+
320 static const uint8_t md5_padding[64] = {
+
321 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+
324 };
+
325
+
326 // Save number of final.
+
327 uint8_t final[8];
+
328 memcpy(final, m_counter, sizeof(m_counter));
+
329
+
330 // Pad out to 56 mod 64.
+
331 size_t index = (m_counter[0] >> 3) & 0x3f;
+
332 size_t remainder = index < 56 ? 56 - index : 120 - index;
+
333 hash(md5_padding, remainder);
+
334
+
335 // Append length (before padding).
+
336 hash(final, 8);
+
337
+
338 // Store m_state in m_value.
+
339 memcpy(&m_value, m_state, sizeof(md5_t));
+
340 }
-
339
-
340 protected:
-
341 virtual void hash_block()
-
342 {
-
343 constexpr int S11 = 7;
-
344 constexpr int S12 = 12;
-
345 constexpr int S13 = 17;
-
346 constexpr int S14 = 22;
-
347 constexpr int S21 = 5;
-
348 constexpr int S22 = 9;
-
349 constexpr int S23 = 14;
-
350 constexpr int S24 = 20;
-
351 constexpr int S31 = 4;
-
352 constexpr int S32 = 11;
-
353 constexpr int S33 = 16;
-
354 constexpr int S34 = 23;
-
355 constexpr int S41 = 6;
-
356 constexpr int S42 = 10;
-
357 constexpr int S43 = 15;
-
358 constexpr int S44 = 21;
-
359
-
360 // Copy m_state[] to working vars.
-
361 uint32_t a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3];
-
362
-
363 // MD5 rounds
-
364 #define MD5_R1(a, b, c, d, i, s, ac) { (a) += (((b) & (c)) | ((~b) & (d))) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
-
365 #define MD5_R2(a, b, c, d, i, s, ac) { (a) += (((b) & (d)) | ((c) & (~d))) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
-
366 #define MD5_R3(a, b, c, d, i, s, ac) { (a) += ((b) ^ (c) ^ (d)) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
-
367 #define MD5_R4(a, b, c, d, i, s, ac) { (a) += ((c) ^ ((b) | (~d))) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
-
368
-
369 // 4 rounds of 16 operations each. Loop unrolled.
-
370 MD5_R1(a, b, c, d, 0, S11, 0xd76aa478);
-
371 MD5_R1(d, a, b, c, 1, S12, 0xe8c7b756);
-
372 MD5_R1(c, d, a, b, 2, S13, 0x242070db);
-
373 MD5_R1(b, c, d, a, 3, S14, 0xc1bdceee);
-
374 MD5_R1(a, b, c, d, 4, S11, 0xf57c0faf);
-
375 MD5_R1(d, a, b, c, 5, S12, 0x4787c62a);
-
376 MD5_R1(c, d, a, b, 6, S13, 0xa8304613);
-
377 MD5_R1(b, c, d, a, 7, S14, 0xfd469501);
-
378 MD5_R1(a, b, c, d, 8, S11, 0x698098d8);
-
379 MD5_R1(d, a, b, c, 9, S12, 0x8b44f7af);
-
380 MD5_R1(c, d, a, b, 10, S13, 0xffff5bb1);
-
381 MD5_R1(b, c, d, a, 11, S14, 0x895cd7be);
-
382 MD5_R1(a, b, c, d, 12, S11, 0x6b901122);
-
383 MD5_R1(d, a, b, c, 13, S12, 0xfd987193);
-
384 MD5_R1(c, d, a, b, 14, S13, 0xa679438e);
-
385 MD5_R1(b, c, d, a, 15, S14, 0x49b40821);
-
386 MD5_R2(a, b, c, d, 1, S21, 0xf61e2562);
-
387 MD5_R2(d, a, b, c, 6, S22, 0xc040b340);
-
388 MD5_R2(c, d, a, b, 11, S23, 0x265e5a51);
-
389 MD5_R2(b, c, d, a, 0, S24, 0xe9b6c7aa);
-
390 MD5_R2(a, b, c, d, 5, S21, 0xd62f105d);
-
391 MD5_R2(d, a, b, c, 10, S22, 0x2441453);
-
392 MD5_R2(c, d, a, b, 15, S23, 0xd8a1e681);
-
393 MD5_R2(b, c, d, a, 4, S24, 0xe7d3fbc8);
-
394 MD5_R2(a, b, c, d, 9, S21, 0x21e1cde6);
-
395 MD5_R2(d, a, b, c, 14, S22, 0xc33707d6);
-
396 MD5_R2(c, d, a, b, 3, S23, 0xf4d50d87);
-
397 MD5_R2(b, c, d, a, 8, S24, 0x455a14ed);
-
398 MD5_R2(a, b, c, d, 13, S21, 0xa9e3e905);
-
399 MD5_R2(d, a, b, c, 2, S22, 0xfcefa3f8);
-
400 MD5_R2(c, d, a, b, 7, S23, 0x676f02d9);
-
401 MD5_R2(b, c, d, a, 12, S24, 0x8d2a4c8a);
-
402 MD5_R3(a, b, c, d, 5, S31, 0xfffa3942);
-
403 MD5_R3(d, a, b, c, 8, S32, 0x8771f681);
-
404 MD5_R3(c, d, a, b, 11, S33, 0x6d9d6122);
-
405 MD5_R3(b, c, d, a, 14, S34, 0xfde5380c);
-
406 MD5_R3(a, b, c, d, 1, S31, 0xa4beea44);
-
407 MD5_R3(d, a, b, c, 4, S32, 0x4bdecfa9);
-
408 MD5_R3(c, d, a, b, 7, S33, 0xf6bb4b60);
-
409 MD5_R3(b, c, d, a, 10, S34, 0xbebfbc70);
-
410 MD5_R3(a, b, c, d, 13, S31, 0x289b7ec6);
-
411 MD5_R3(d, a, b, c, 0, S32, 0xeaa127fa);
-
412 MD5_R3(c, d, a, b, 3, S33, 0xd4ef3085);
-
413 MD5_R3(b, c, d, a, 6, S34, 0x4881d05);
-
414 MD5_R3(a, b, c, d, 9, S31, 0xd9d4d039);
-
415 MD5_R3(d, a, b, c, 12, S32, 0xe6db99e5);
-
416 MD5_R3(c, d, a, b, 15, S33, 0x1fa27cf8);
-
417 MD5_R3(b, c, d, a, 2, S34, 0xc4ac5665);
-
418 MD5_R4(a, b, c, d, 0, S41, 0xf4292244);
-
419 MD5_R4(d, a, b, c, 7, S42, 0x432aff97);
-
420 MD5_R4(c, d, a, b, 14, S43, 0xab9423a7);
-
421 MD5_R4(b, c, d, a, 5, S44, 0xfc93a039);
-
422 MD5_R4(a, b, c, d, 12, S41, 0x655b59c3);
-
423 MD5_R4(d, a, b, c, 3, S42, 0x8f0ccc92);
-
424 MD5_R4(c, d, a, b, 10, S43, 0xffeff47d);
-
425 MD5_R4(b, c, d, a, 1, S44, 0x85845dd1);
-
426 MD5_R4(a, b, c, d, 8, S41, 0x6fa87e4f);
-
427 MD5_R4(d, a, b, c, 15, S42, 0xfe2ce6e0);
-
428 MD5_R4(c, d, a, b, 6, S43, 0xa3014314);
-
429 MD5_R4(b, c, d, a, 13, S44, 0x4e0811a1);
-
430 MD5_R4(a, b, c, d, 4, S41, 0xf7537e82);
-
431 MD5_R4(d, a, b, c, 11, S42, 0xbd3af235);
-
432 MD5_R4(c, d, a, b, 2, S43, 0x2ad7d2bb);
-
433 MD5_R4(b, c, d, a, 9, S44, 0xeb86d391);
-
434
-
435 #undef MD5_R1
-
436 #undef MD5_R2
-
437 #undef MD5_R3
-
438 #undef MD5_R4
-
439
-
440 // Add the working vars back into internal state.
-
441 m_state[0] += a;
-
442 m_state[1] += b;
-
443 m_state[2] += c;
-
444 m_state[3] += d;
-
445 }
-
446
-
447 protected:
-
448 uint32_t m_state[4];
-
449 };
+
341
+
342 protected:
+
343 virtual void hash_block()
+
344 {
+
345 constexpr int S11 = 7;
+
346 constexpr int S12 = 12;
+
347 constexpr int S13 = 17;
+
348 constexpr int S14 = 22;
+
349 constexpr int S21 = 5;
+
350 constexpr int S22 = 9;
+
351 constexpr int S23 = 14;
+
352 constexpr int S24 = 20;
+
353 constexpr int S31 = 4;
+
354 constexpr int S32 = 11;
+
355 constexpr int S33 = 16;
+
356 constexpr int S34 = 23;
+
357 constexpr int S41 = 6;
+
358 constexpr int S42 = 10;
+
359 constexpr int S43 = 15;
+
360 constexpr int S44 = 21;
+
361
+
362 // Copy m_state[] to working vars.
+
363 uint32_t a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3];
+
364
+
365 // MD5 rounds
+
366 #define MD5_R1(a, b, c, d, i, s, ac) { (a) += (((b) & (c)) | ((~b) & (d))) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
+
367 #define MD5_R2(a, b, c, d, i, s, ac) { (a) += (((b) & (d)) | ((c) & (~d))) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
+
368 #define MD5_R3(a, b, c, d, i, s, ac) { (a) += ((b) ^ (c) ^ (d)) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
+
369 #define MD5_R4(a, b, c, d, i, s, ac) { (a) += ((c) ^ ((b) | (~d))) + m_temp[(i)] + static_cast<uint32_t>(ac); (a) = rol((a), (s)); (a) += (b); }
+
370
+
371 // 4 rounds of 16 operations each. Loop unrolled.
+
372 MD5_R1(a, b, c, d, 0, S11, 0xd76aa478);
+
373 MD5_R1(d, a, b, c, 1, S12, 0xe8c7b756);
+
374 MD5_R1(c, d, a, b, 2, S13, 0x242070db);
+
375 MD5_R1(b, c, d, a, 3, S14, 0xc1bdceee);
+
376 MD5_R1(a, b, c, d, 4, S11, 0xf57c0faf);
+
377 MD5_R1(d, a, b, c, 5, S12, 0x4787c62a);
+
378 MD5_R1(c, d, a, b, 6, S13, 0xa8304613);
+
379 MD5_R1(b, c, d, a, 7, S14, 0xfd469501);
+
380 MD5_R1(a, b, c, d, 8, S11, 0x698098d8);
+
381 MD5_R1(d, a, b, c, 9, S12, 0x8b44f7af);
+
382 MD5_R1(c, d, a, b, 10, S13, 0xffff5bb1);
+
383 MD5_R1(b, c, d, a, 11, S14, 0x895cd7be);
+
384 MD5_R1(a, b, c, d, 12, S11, 0x6b901122);
+
385 MD5_R1(d, a, b, c, 13, S12, 0xfd987193);
+
386 MD5_R1(c, d, a, b, 14, S13, 0xa679438e);
+
387 MD5_R1(b, c, d, a, 15, S14, 0x49b40821);
+
388 MD5_R2(a, b, c, d, 1, S21, 0xf61e2562);
+
389 MD5_R2(d, a, b, c, 6, S22, 0xc040b340);
+
390 MD5_R2(c, d, a, b, 11, S23, 0x265e5a51);
+
391 MD5_R2(b, c, d, a, 0, S24, 0xe9b6c7aa);
+
392 MD5_R2(a, b, c, d, 5, S21, 0xd62f105d);
+
393 MD5_R2(d, a, b, c, 10, S22, 0x2441453);
+
394 MD5_R2(c, d, a, b, 15, S23, 0xd8a1e681);
+
395 MD5_R2(b, c, d, a, 4, S24, 0xe7d3fbc8);
+
396 MD5_R2(a, b, c, d, 9, S21, 0x21e1cde6);
+
397 MD5_R2(d, a, b, c, 14, S22, 0xc33707d6);
+
398 MD5_R2(c, d, a, b, 3, S23, 0xf4d50d87);
+
399 MD5_R2(b, c, d, a, 8, S24, 0x455a14ed);
+
400 MD5_R2(a, b, c, d, 13, S21, 0xa9e3e905);
+
401 MD5_R2(d, a, b, c, 2, S22, 0xfcefa3f8);
+
402 MD5_R2(c, d, a, b, 7, S23, 0x676f02d9);
+
403 MD5_R2(b, c, d, a, 12, S24, 0x8d2a4c8a);
+
404 MD5_R3(a, b, c, d, 5, S31, 0xfffa3942);
+
405 MD5_R3(d, a, b, c, 8, S32, 0x8771f681);
+
406 MD5_R3(c, d, a, b, 11, S33, 0x6d9d6122);
+
407 MD5_R3(b, c, d, a, 14, S34, 0xfde5380c);
+
408 MD5_R3(a, b, c, d, 1, S31, 0xa4beea44);
+
409 MD5_R3(d, a, b, c, 4, S32, 0x4bdecfa9);
+
410 MD5_R3(c, d, a, b, 7, S33, 0xf6bb4b60);
+
411 MD5_R3(b, c, d, a, 10, S34, 0xbebfbc70);
+
412 MD5_R3(a, b, c, d, 13, S31, 0x289b7ec6);
+
413 MD5_R3(d, a, b, c, 0, S32, 0xeaa127fa);
+
414 MD5_R3(c, d, a, b, 3, S33, 0xd4ef3085);
+
415 MD5_R3(b, c, d, a, 6, S34, 0x4881d05);
+
416 MD5_R3(a, b, c, d, 9, S31, 0xd9d4d039);
+
417 MD5_R3(d, a, b, c, 12, S32, 0xe6db99e5);
+
418 MD5_R3(c, d, a, b, 15, S33, 0x1fa27cf8);
+
419 MD5_R3(b, c, d, a, 2, S34, 0xc4ac5665);
+
420 MD5_R4(a, b, c, d, 0, S41, 0xf4292244);
+
421 MD5_R4(d, a, b, c, 7, S42, 0x432aff97);
+
422 MD5_R4(c, d, a, b, 14, S43, 0xab9423a7);
+
423 MD5_R4(b, c, d, a, 5, S44, 0xfc93a039);
+
424 MD5_R4(a, b, c, d, 12, S41, 0x655b59c3);
+
425 MD5_R4(d, a, b, c, 3, S42, 0x8f0ccc92);
+
426 MD5_R4(c, d, a, b, 10, S43, 0xffeff47d);
+
427 MD5_R4(b, c, d, a, 1, S44, 0x85845dd1);
+
428 MD5_R4(a, b, c, d, 8, S41, 0x6fa87e4f);
+
429 MD5_R4(d, a, b, c, 15, S42, 0xfe2ce6e0);
+
430 MD5_R4(c, d, a, b, 6, S43, 0xa3014314);
+
431 MD5_R4(b, c, d, a, 13, S44, 0x4e0811a1);
+
432 MD5_R4(a, b, c, d, 4, S41, 0xf7537e82);
+
433 MD5_R4(d, a, b, c, 11, S42, 0xbd3af235);
+
434 MD5_R4(c, d, a, b, 2, S43, 0x2ad7d2bb);
+
435 MD5_R4(b, c, d, a, 9, S44, 0xeb86d391);
+
436
+
437 #undef MD5_R1
+
438 #undef MD5_R2
+
439 #undef MD5_R3
+
440 #undef MD5_R4
+
441
+
442 // Add the working vars back into internal state.
+
443 m_state[0] += a;
+
444 m_state[1] += b;
+
445 m_state[2] += c;
+
446 m_state[3] += d;
+
447 }
+
448
+
449 protected:
+
450 uint32_t m_state[4];
+
451 };
-
450
-
-
454 union sha_t
-
455 {
-
456 uint8_t data8[20];
-
457 uint32_t data32[5];
-
458
-
459 bool operator !=(_In_ const stdex::sha_t& other) const
-
460 {
-
461 return
-
462 (data32[0] ^ other.data32[0]) |
-
463 (data32[1] ^ other.data32[1]) |
-
464 (data32[2] ^ other.data32[2]) |
-
465 (data32[3] ^ other.data32[3]) |
-
466 (data32[4] ^ other.data32[4]);
-
467 }
-
468
-
469 bool operator ==(_In_ const stdex::sha_t& other) const
-
470 {
-
471 return !operator !=(other);
-
472 }
-
473
-
474 friend inline stdex::stream::basic& operator >>(_Inout_ stdex::stream::basic& stream, _Out_ stdex::sha_t& data)
-
475 {
-
476 if (!stream.ok()) _Unlikely_{
-
477 memset(&data, 0, sizeof(data));
-
478 return stream;
-
479 }
-
480 stream.read_array(&data, sizeof(data), 1);
-
481 return stream;
-
482 }
-
483
-
484 friend inline stdex::stream::basic& operator <<(_Inout_ stdex::stream::basic& stream, _In_ const stdex::sha_t data)
-
485 {
-
486 if (!stream.ok()) _Unlikely_ return stream;
-
487 stream.write_array(&data, sizeof(data), 1);
-
488 return stream;
-
489 }
-
490 };
+
452
+
+
456 union sha_t
+
457 {
+
458 uint8_t data8[20];
+
459 uint32_t data32[5];
+
460
+
461 bool operator !=(_In_ const stdex::sha_t& other) const
+
462 {
+
463 return
+
464 (data32[0] ^ other.data32[0]) |
+
465 (data32[1] ^ other.data32[1]) |
+
466 (data32[2] ^ other.data32[2]) |
+
467 (data32[3] ^ other.data32[3]) |
+
468 (data32[4] ^ other.data32[4]);
+
469 }
+
470
+
471 bool operator ==(_In_ const stdex::sha_t& other) const
+
472 {
+
473 return !operator !=(other);
+
474 }
+
475
+
476 friend inline stdex::stream::basic& operator >>(_Inout_ stdex::stream::basic& stream, _Out_ stdex::sha_t& data)
+
477 {
+
478 if (!stream.ok()) _Unlikely_{
+
479 memset(&data, 0, sizeof(data));
+
480 return stream;
+
481 }
+
482 stream.read_array(&data, sizeof(data), 1);
+
483 return stream;
+
484 }
+
485
+
486 friend inline stdex::stream::basic& operator <<(_Inout_ stdex::stream::basic& stream, _In_ const stdex::sha_t data)
+
487 {
+
488 if (!stream.ok()) _Unlikely_ return stream;
+
489 stream.write_array(&data, sizeof(data), 1);
+
490 return stream;
+
491 }
+
492 };
-
491
-
495 using sha1_t = sha_t;
-
496
-
-
500 class sha1_hash : public block_hash<sha1_t>
-
501 {
-
502 public:
-
503 sha1_hash()
-
504 {
-
505 clear();
-
506 }
-
507
-
-
508 virtual void clear()
-
509 {
- -
511
-
512 // SHA1 initialization constants
-
513 m_state[0] = 0x67452301;
-
514 m_state[1] = 0xEFCDAB89;
-
515 m_state[2] = 0x98BADCFE;
-
516 m_state[3] = 0x10325476;
-
517 m_state[4] = 0xC3D2E1F0;
-
518 }
+
493
+
497 using sha1_t = sha_t;
+
498
+
+
502 class sha1_hash : public block_hash<sha1_t>
+
503 {
+
504 public:
+
505 sha1_hash()
+
506 {
+
507 clear();
+
508 }
+
509
+
+
510 virtual void clear()
+
511 {
+ +
513
+
514 // SHA1 initialization constants
+
515 m_state[0] = 0x67452301;
+
516 m_state[1] = 0xEFCDAB89;
+
517 m_state[2] = 0x98BADCFE;
+
518 m_state[3] = 0x10325476;
+
519 m_state[4] = 0xC3D2E1F0;
+
520 }
-
519
-
-
520 virtual void finalize()
-
521 {
-
522 // Save number of final.
-
523 uint8_t final[8];
-
524 for (size_t i = 0; i < 8; i++)
-
525 final[i] = static_cast<uint8_t>((m_counter[((i >= 4) ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); // Endian independent
-
526
-
527 hash("\200", 1);
-
528 while ((m_counter[0] & 504) != 448)
-
529 hash("\0", 1);
-
530 hash(final, 8); // Cause a SHA1Transform()
-
531
-
532 // Store m_state in m_value.
-
533 for (size_t i = 0; i < 20; i++)
-
534 m_value.data8[i] = static_cast<uint8_t>((m_state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
-
535 }
+
521
+
+
522 virtual void finalize()
+
523 {
+
524 // Save number of final.
+
525 uint8_t final[8];
+
526 for (size_t i = 0; i < 8; i++)
+
527 final[i] = static_cast<uint8_t>((m_counter[((i >= 4) ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); // Endian independent
+
528
+
529 hash("\200", 1);
+
530 while ((m_counter[0] & 504) != 448)
+
531 hash("\0", 1);
+
532 hash(final, 8); // Cause a SHA1Transform()
+
533
+
534 // Store m_state in m_value.
+
535 for (size_t i = 0; i < 20; i++)
+
536 m_value.data8[i] = static_cast<uint8_t>((m_state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
+
537 }
-
536
-
537 protected:
-
538 virtual void hash_block()
-
539 {
-
540 // Copy m_state[] to working vars.
-
541 uint32_t a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], e = m_state[4];
-
542
-
543#if BYTE_ORDER == BIG_ENDIAN
-
544 #define SHA1BLK0(i) (m_temp[i])
-
545#else
-
546 #define SHA1BLK0(i) (m_temp[i] = (rol(m_temp[i],24) & 0xFF00FF00) | (rol(m_temp[i],8) & 0x00FF00FF))
-
547#endif
-
548 #define SHA1BLK(i) (m_temp[i&15] = rol(m_temp[(i+13)&15] ^ m_temp[(i+8)&15] ^ m_temp[(i+2)&15] ^ m_temp[i&15],1))
-
549
-
550 // SHA1 rounds
-
551 #define SHA1_R0(v, w, x, y, z, i) { (z) += (((w)&((x)^(y)))^(y))+SHA1BLK0((i))+0x5A827999+rol((v),5); (w)=rol((w),30); }
-
552 #define SHA1_R1(v, w, x, y, z, i) { (z) += (((w)&((x)^(y)))^(y))+SHA1BLK((i))+0x5A827999+rol((v),5); (w)=rol((w),30); }
-
553 #define SHA1_R2(v, w, x, y, z, i) { (z) += ((w)^(x)^(y))+SHA1BLK((i))+0x6ED9EBA1+rol((v),5); (w)=rol((w),30); }
-
554 #define SHA1_R3(v, w, x, y, z, i) { (z) += ((((w)|(x))&(y))|((w)&(x)))+SHA1BLK((i))+0x8F1BBCDC+rol((v),5); (w)=rol((w),30); }
-
555 #define SHA1_R4(v, w, x, y, z, i) { (z) += ((w)^(x)^(y))+SHA1BLK((i))+0xCA62C1D6+rol((v),5); (w)=rol((w),30); }
-
556
-
557 // 5 rounds of 16 operations each. Loop unrolled.
-
558 SHA1_R0(a, b, c, d, e, 0); SHA1_R0(e, a, b, c, d, 1); SHA1_R0(d, e, a, b, c, 2); SHA1_R0(c, d, e, a, b, 3);
-
559 SHA1_R0(b, c, d, e, a, 4); SHA1_R0(a, b, c, d, e, 5); SHA1_R0(e, a, b, c, d, 6); SHA1_R0(d, e, a, b, c, 7);
-
560 SHA1_R0(c, d, e, a, b, 8); SHA1_R0(b, c, d, e, a, 9); SHA1_R0(a, b, c, d, e, 10); SHA1_R0(e, a, b, c, d, 11);
-
561 SHA1_R0(d, e, a, b, c, 12); SHA1_R0(c, d, e, a, b, 13); SHA1_R0(b, c, d, e, a, 14); SHA1_R0(a, b, c, d, e, 15);
-
562 SHA1_R1(e, a, b, c, d, 16); SHA1_R1(d, e, a, b, c, 17); SHA1_R1(c, d, e, a, b, 18); SHA1_R1(b, c, d, e, a, 19);
-
563 SHA1_R2(a, b, c, d, e, 20); SHA1_R2(e, a, b, c, d, 21); SHA1_R2(d, e, a, b, c, 22); SHA1_R2(c, d, e, a, b, 23);
-
564 SHA1_R2(b, c, d, e, a, 24); SHA1_R2(a, b, c, d, e, 25); SHA1_R2(e, a, b, c, d, 26); SHA1_R2(d, e, a, b, c, 27);
-
565 SHA1_R2(c, d, e, a, b, 28); SHA1_R2(b, c, d, e, a, 29); SHA1_R2(a, b, c, d, e, 30); SHA1_R2(e, a, b, c, d, 31);
-
566 SHA1_R2(d, e, a, b, c, 32); SHA1_R2(c, d, e, a, b, 33); SHA1_R2(b, c, d, e, a, 34); SHA1_R2(a, b, c, d, e, 35);
-
567 SHA1_R2(e, a, b, c, d, 36); SHA1_R2(d, e, a, b, c, 37); SHA1_R2(c, d, e, a, b, 38); SHA1_R2(b, c, d, e, a, 39);
-
568 SHA1_R3(a, b, c, d, e, 40); SHA1_R3(e, a, b, c, d, 41); SHA1_R3(d, e, a, b, c, 42); SHA1_R3(c, d, e, a, b, 43);
-
569 SHA1_R3(b, c, d, e, a, 44); SHA1_R3(a, b, c, d, e, 45); SHA1_R3(e, a, b, c, d, 46); SHA1_R3(d, e, a, b, c, 47);
-
570 SHA1_R3(c, d, e, a, b, 48); SHA1_R3(b, c, d, e, a, 49); SHA1_R3(a, b, c, d, e, 50); SHA1_R3(e, a, b, c, d, 51);
-
571 SHA1_R3(d, e, a, b, c, 52); SHA1_R3(c, d, e, a, b, 53); SHA1_R3(b, c, d, e, a, 54); SHA1_R3(a, b, c, d, e, 55);
-
572 SHA1_R3(e, a, b, c, d, 56); SHA1_R3(d, e, a, b, c, 57); SHA1_R3(c, d, e, a, b, 58); SHA1_R3(b, c, d, e, a, 59);
-
573 SHA1_R4(a, b, c, d, e, 60); SHA1_R4(e, a, b, c, d, 61); SHA1_R4(d, e, a, b, c, 62); SHA1_R4(c, d, e, a, b, 63);
-
574 SHA1_R4(b, c, d, e, a, 64); SHA1_R4(a, b, c, d, e, 65); SHA1_R4(e, a, b, c, d, 66); SHA1_R4(d, e, a, b, c, 67);
-
575 SHA1_R4(c, d, e, a, b, 68); SHA1_R4(b, c, d, e, a, 69); SHA1_R4(a, b, c, d, e, 70); SHA1_R4(e, a, b, c, d, 71);
-
576 SHA1_R4(d, e, a, b, c, 72); SHA1_R4(c, d, e, a, b, 73); SHA1_R4(b, c, d, e, a, 74); SHA1_R4(a, b, c, d, e, 75);
-
577 SHA1_R4(e, a, b, c, d, 76); SHA1_R4(d, e, a, b, c, 77); SHA1_R4(c, d, e, a, b, 78); SHA1_R4(b, c, d, e, a, 79);
-
578
-
579 // Add the working vars back into m_state.
-
580 m_state[0] += a;
-
581 m_state[1] += b;
-
582 m_state[2] += c;
-
583 m_state[3] += d;
-
584 m_state[4] += e;
-
585
-
586 #undef SHA1_R0
-
587 #undef SHA1_R1
-
588 #undef SHA1_R2
-
589 #undef SHA1_R3
-
590 #undef SHA1_R4
-
591 #undef SHA1BLK0
-
592 #undef SHA1BLK0
-
593 #undef SHA1BLK
-
594 }
-
595
-
596 protected:
-
597 uint32_t m_state[5];
-
598 };
+
538
+
539 protected:
+
540 virtual void hash_block()
+
541 {
+
542 // Copy m_state[] to working vars.
+
543 uint32_t a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], e = m_state[4];
+
544
+
545#if BYTE_ORDER == BIG_ENDIAN
+
546 #define SHA1BLK0(i) (m_temp[i])
+
547#else
+
548 #define SHA1BLK0(i) (m_temp[i] = (rol(m_temp[i],24) & 0xFF00FF00) | (rol(m_temp[i],8) & 0x00FF00FF))
+
549#endif
+
550 #define SHA1BLK(i) (m_temp[i&15] = rol(m_temp[(i+13)&15] ^ m_temp[(i+8)&15] ^ m_temp[(i+2)&15] ^ m_temp[i&15],1))
+
551
+
552 // SHA1 rounds
+
553 #define SHA1_R0(v, w, x, y, z, i) { (z) += (((w)&((x)^(y)))^(y))+SHA1BLK0((i))+0x5A827999+rol((v),5); (w)=rol((w),30); }
+
554 #define SHA1_R1(v, w, x, y, z, i) { (z) += (((w)&((x)^(y)))^(y))+SHA1BLK((i))+0x5A827999+rol((v),5); (w)=rol((w),30); }
+
555 #define SHA1_R2(v, w, x, y, z, i) { (z) += ((w)^(x)^(y))+SHA1BLK((i))+0x6ED9EBA1+rol((v),5); (w)=rol((w),30); }
+
556 #define SHA1_R3(v, w, x, y, z, i) { (z) += ((((w)|(x))&(y))|((w)&(x)))+SHA1BLK((i))+0x8F1BBCDC+rol((v),5); (w)=rol((w),30); }
+
557 #define SHA1_R4(v, w, x, y, z, i) { (z) += ((w)^(x)^(y))+SHA1BLK((i))+0xCA62C1D6+rol((v),5); (w)=rol((w),30); }
+
558
+
559 // 5 rounds of 16 operations each. Loop unrolled.
+
560 SHA1_R0(a, b, c, d, e, 0); SHA1_R0(e, a, b, c, d, 1); SHA1_R0(d, e, a, b, c, 2); SHA1_R0(c, d, e, a, b, 3);
+
561 SHA1_R0(b, c, d, e, a, 4); SHA1_R0(a, b, c, d, e, 5); SHA1_R0(e, a, b, c, d, 6); SHA1_R0(d, e, a, b, c, 7);
+
562 SHA1_R0(c, d, e, a, b, 8); SHA1_R0(b, c, d, e, a, 9); SHA1_R0(a, b, c, d, e, 10); SHA1_R0(e, a, b, c, d, 11);
+
563 SHA1_R0(d, e, a, b, c, 12); SHA1_R0(c, d, e, a, b, 13); SHA1_R0(b, c, d, e, a, 14); SHA1_R0(a, b, c, d, e, 15);
+
564 SHA1_R1(e, a, b, c, d, 16); SHA1_R1(d, e, a, b, c, 17); SHA1_R1(c, d, e, a, b, 18); SHA1_R1(b, c, d, e, a, 19);
+
565 SHA1_R2(a, b, c, d, e, 20); SHA1_R2(e, a, b, c, d, 21); SHA1_R2(d, e, a, b, c, 22); SHA1_R2(c, d, e, a, b, 23);
+
566 SHA1_R2(b, c, d, e, a, 24); SHA1_R2(a, b, c, d, e, 25); SHA1_R2(e, a, b, c, d, 26); SHA1_R2(d, e, a, b, c, 27);
+
567 SHA1_R2(c, d, e, a, b, 28); SHA1_R2(b, c, d, e, a, 29); SHA1_R2(a, b, c, d, e, 30); SHA1_R2(e, a, b, c, d, 31);
+
568 SHA1_R2(d, e, a, b, c, 32); SHA1_R2(c, d, e, a, b, 33); SHA1_R2(b, c, d, e, a, 34); SHA1_R2(a, b, c, d, e, 35);
+
569 SHA1_R2(e, a, b, c, d, 36); SHA1_R2(d, e, a, b, c, 37); SHA1_R2(c, d, e, a, b, 38); SHA1_R2(b, c, d, e, a, 39);
+
570 SHA1_R3(a, b, c, d, e, 40); SHA1_R3(e, a, b, c, d, 41); SHA1_R3(d, e, a, b, c, 42); SHA1_R3(c, d, e, a, b, 43);
+
571 SHA1_R3(b, c, d, e, a, 44); SHA1_R3(a, b, c, d, e, 45); SHA1_R3(e, a, b, c, d, 46); SHA1_R3(d, e, a, b, c, 47);
+
572 SHA1_R3(c, d, e, a, b, 48); SHA1_R3(b, c, d, e, a, 49); SHA1_R3(a, b, c, d, e, 50); SHA1_R3(e, a, b, c, d, 51);
+
573 SHA1_R3(d, e, a, b, c, 52); SHA1_R3(c, d, e, a, b, 53); SHA1_R3(b, c, d, e, a, 54); SHA1_R3(a, b, c, d, e, 55);
+
574 SHA1_R3(e, a, b, c, d, 56); SHA1_R3(d, e, a, b, c, 57); SHA1_R3(c, d, e, a, b, 58); SHA1_R3(b, c, d, e, a, 59);
+
575 SHA1_R4(a, b, c, d, e, 60); SHA1_R4(e, a, b, c, d, 61); SHA1_R4(d, e, a, b, c, 62); SHA1_R4(c, d, e, a, b, 63);
+
576 SHA1_R4(b, c, d, e, a, 64); SHA1_R4(a, b, c, d, e, 65); SHA1_R4(e, a, b, c, d, 66); SHA1_R4(d, e, a, b, c, 67);
+
577 SHA1_R4(c, d, e, a, b, 68); SHA1_R4(b, c, d, e, a, 69); SHA1_R4(a, b, c, d, e, 70); SHA1_R4(e, a, b, c, d, 71);
+
578 SHA1_R4(d, e, a, b, c, 72); SHA1_R4(c, d, e, a, b, 73); SHA1_R4(b, c, d, e, a, 74); SHA1_R4(a, b, c, d, e, 75);
+
579 SHA1_R4(e, a, b, c, d, 76); SHA1_R4(d, e, a, b, c, 77); SHA1_R4(c, d, e, a, b, 78); SHA1_R4(b, c, d, e, a, 79);
+
580
+
581 // Add the working vars back into m_state.
+
582 m_state[0] += a;
+
583 m_state[1] += b;
+
584 m_state[2] += c;
+
585 m_state[3] += d;
+
586 m_state[4] += e;
+
587
+
588 #undef SHA1_R0
+
589 #undef SHA1_R1
+
590 #undef SHA1_R2
+
591 #undef SHA1_R3
+
592 #undef SHA1_R4
+
593 #undef SHA1BLK0
+
594 #undef SHA1BLK0
+
595 #undef SHA1BLK
+
596 }
+
597
+
598 protected:
+
599 uint32_t m_state[5];
+
600 };
-
599
-
- -
604 {
-
605 uint8_t data8[32];
-
606 uint32_t data32[8];
-
607
-
608 bool operator !=(_In_ const stdex::sha256_t& other) const
-
609 {
-
610 return
-
611 (data32[0] ^ other.data32[0]) |
-
612 (data32[1] ^ other.data32[1]) |
-
613 (data32[2] ^ other.data32[2]) |
-
614 (data32[3] ^ other.data32[3]) |
-
615 (data32[4] ^ other.data32[4]) |
-
616 (data32[5] ^ other.data32[5]) |
-
617 (data32[6] ^ other.data32[6]) |
-
618 (data32[7] ^ other.data32[7]);
-
619 }
-
620
-
621 bool operator ==(_In_ const stdex::sha256_t& other) const
-
622 {
-
623 return !operator !=(other);
-
624 }
-
625
-
626 friend inline stdex::stream::basic& operator >>(_Inout_ stdex::stream::basic& stream, _Out_ stdex::sha256_t& data)
-
627 {
-
628 if (!stream.ok()) _Unlikely_{
-
629 memset(&data, 0, sizeof(data));
-
630 return stream;
-
631 }
-
632 stream.read_array(&data, sizeof(data), 1);
-
633 return stream;
-
634 }
-
635
-
636 friend inline stdex::stream::basic& operator <<(_Inout_ stdex::stream::basic& stream, _In_ const stdex::sha256_t& data)
-
637 {
-
638 if (!stream.ok()) _Unlikely_ return stream;
-
639 stream.write_array(&data, sizeof(data), 1);
-
640 return stream;
-
641 }
-
642 };
+
601
+
+ +
606 {
+
607 uint8_t data8[32];
+
608 uint32_t data32[8];
+
609
+
610 bool operator !=(_In_ const stdex::sha256_t& other) const
+
611 {
+
612 return
+
613 (data32[0] ^ other.data32[0]) |
+
614 (data32[1] ^ other.data32[1]) |
+
615 (data32[2] ^ other.data32[2]) |
+
616 (data32[3] ^ other.data32[3]) |
+
617 (data32[4] ^ other.data32[4]) |
+
618 (data32[5] ^ other.data32[5]) |
+
619 (data32[6] ^ other.data32[6]) |
+
620 (data32[7] ^ other.data32[7]);
+
621 }
+
622
+
623 bool operator ==(_In_ const stdex::sha256_t& other) const
+
624 {
+
625 return !operator !=(other);
+
626 }
+
627
+
628 friend inline stdex::stream::basic& operator >>(_Inout_ stdex::stream::basic& stream, _Out_ stdex::sha256_t& data)
+
629 {
+
630 if (!stream.ok()) _Unlikely_{
+
631 memset(&data, 0, sizeof(data));
+
632 return stream;
+
633 }
+
634 stream.read_array(&data, sizeof(data), 1);
+
635 return stream;
+
636 }
+
637
+
638 friend inline stdex::stream::basic& operator <<(_Inout_ stdex::stream::basic& stream, _In_ const stdex::sha256_t& data)
+
639 {
+
640 if (!stream.ok()) _Unlikely_ return stream;
+
641 stream.write_array(&data, sizeof(data), 1);
+
642 return stream;
+
643 }
+
644 };
-
643}
-
644
-
645#if defined(__GNUC__)
-
646#pragma GCC diagnostic pop
-
647#endif
+
645}
+
646
+
647#if defined(__GNUC__)
+
648#pragma GCC diagnostic pop
+
649#endif
Basic hashing operations.
Definition hash.hpp:28
-
const T & data()
Returns hash value.
Definition hash.hpp:56
+
const T & data()
Returns hash value.
Definition hash.hpp:58
virtual void hash(_In_reads_bytes_opt_(length) const void *data, size_t length)=0
Hashes block of data.
-
static size_t size()
Returns size of the hash value in bytes.
Definition hash.hpp:51
+
static size_t size()
Returns size of the hash value in bytes.
Definition hash.hpp:53
virtual void finalize()=0
Finalizes hash value.
virtual void clear()=0
Initializes hash value and internal state.
-
Hashing in blocks.
Definition hash.hpp:72
-
virtual void hash(_In_reads_bytes_opt_(length) const void *data, size_t length)
Hashes block of data.
Definition hash.hpp:79
-
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:74
-
Hashes as CRC32.
Definition hash.hpp:171
-
virtual void finalize()
Finalizes hash value.
Definition hash.hpp:245
-
virtual void hash(_In_reads_bytes_opt_(length) const void *data, size_t length)
Hashes block of data.
Definition hash.hpp:183
-
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:178
-
Hashes as MD5.
Definition hash.hpp:300
-
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:307
-
virtual void finalize()
Finalizes hash value.
Definition hash.hpp:316
-
Hashes as SHA1.
Definition hash.hpp:501
-
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:508
-
virtual void finalize()
Finalizes hash value.
Definition hash.hpp:520
+
Hashing in blocks.
Definition hash.hpp:74
+
virtual void hash(_In_reads_bytes_opt_(length) const void *data, size_t length)
Hashes block of data.
Definition hash.hpp:81
+
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:76
+
Hashes as CRC32.
Definition hash.hpp:173
+
virtual void finalize()
Finalizes hash value.
Definition hash.hpp:247
+
virtual void hash(_In_reads_bytes_opt_(length) const void *data, size_t length)
Hashes block of data.
Definition hash.hpp:185
+
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:180
+
Hashes as MD5.
Definition hash.hpp:302
+
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:309
+
virtual void finalize()
Finalizes hash value.
Definition hash.hpp:318
+
Hashes as SHA1.
Definition hash.hpp:503
+
virtual void clear()
Initializes hash value and internal state.
Definition hash.hpp:510
+
virtual void finalize()
Finalizes hash value.
Definition hash.hpp:522
‍UTF-8 byte-order-mark
Definition stream.hpp:84
Modifies data on the fly when reading from/writing to a source stream. Could also be used to modify r...
Definition stream.hpp:1022
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:1051
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:1059
-
Hashes read to or write from data of the stream.
Definition hash.hpp:135
-
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition hash.hpp:142
-
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition hash.hpp:150
-
MD2 hash value.
Definition hash.hpp:255
-
SHA256 hash value.
Definition hash.hpp:604
-
SHA hash value.
Definition hash.hpp:455
+
Hashes read to or write from data of the stream.
Definition hash.hpp:137
+
virtual size_t read(_Out_writes_bytes_to_opt_(length, return) void *data, size_t length)
Reads block of data from the stream.
Definition hash.hpp:144
+
virtual size_t write(_In_reads_bytes_opt_(length) const void *data, size_t length)
Writes block of data to the stream.
Definition hash.hpp:152
+
MD2 hash value.
Definition hash.hpp:257
+
SHA256 hash value.
Definition hash.hpp:606
+
SHA hash value.
Definition hash.hpp:457
diff --git a/hex_8hpp_source.html b/hex_8hpp_source.html index f4d781af1..341e91b13 100644 --- a/hex_8hpp_source.html +++ b/hex_8hpp_source.html @@ -174,15 +174,15 @@ $(function() { codefold.init(0); });
110 if (i >= size)
111 break;
112
-
113 int x = data[i];
+
113 auto x = data[i];
114 if ('0' <= x && x <= '9') {
-
115 buf = ((buf & 0xf) << 4) | (uint8_t)(x - '0');
+
115 buf = ((buf & 0xf) << 4) | static_cast<uint8_t>(x - '0');
116 num++;
117 } else if ('A' <= x && x <= 'F') {
-
118 buf = ((buf & 0xf) << 4) | (uint8_t)(x - ('A' - 10));
+
118 buf = ((buf & 0xf) << 4) | static_cast<uint8_t>(x - ('A' - 10));
119 num++;
120 } else if ('a' <= x && x <= 'f') {
-
121 buf = ((buf & 0xf) << 4) | (uint8_t)(x - ('a' - 10));
+
121 buf = ((buf & 0xf) << 4) | static_cast<uint8_t>(x - ('a' - 10));
122 num++;
123 }
124 }
@@ -223,7 +223,7 @@ $(function() { codefold.init(0); });
diff --git a/hierarchy.html b/hierarchy.html index ff51ec2a2..c50faff95 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -311,7 +311,7 @@ $(function() {
diff --git a/html_8hpp_source.html b/html_8hpp_source.html index e7bae0efd..644221b56 100644 --- a/html_8hpp_source.html +++ b/html_8hpp_source.html @@ -263,17 +263,17 @@ $(function() { codefold.init(0); });
248 case '%': {
249 i++;
250
-
251 uint8_t chr;
-
252 if ('0' <= src[i] && src[i] <= '9') chr = (src[i++] - '0') << 4;
-
253 else if ('A' <= src[i] && src[i] <= 'F') chr = (src[i++] - 'A' + 10) << 4;
-
254 else if ('a' <= src[i] && src[i] <= 'f') chr = (src[i++] - 'a' + 10) << 4;
+
251 char chr;
+
252 if ('0' <= src[i] && src[i] <= '9') chr = static_cast<char>((src[i++] - '0') << 4);
+
253 else if ('A' <= src[i] && src[i] <= 'F') chr = static_cast<char>((src[i++] - 'A' + 10) << 4);
+
254 else if ('a' <= src[i] && src[i] <= 'f') chr = static_cast<char>((src[i++] - 'a' + 10) << 4);
255 else { dst += '%'; continue; }
-
256 if ('0' <= src[i] && src[i] <= '9') chr |= (src[i++] - '0');
-
257 else if ('A' <= src[i] && src[i] <= 'F') chr |= (src[i++] - 'A' + 10);
-
258 else if ('a' <= src[i] && src[i] <= 'f') chr |= (src[i++] - 'a' + 10);
+
256 if ('0' <= src[i] && src[i] <= '9') chr |= static_cast<char>((src[i++] - '0'));
+
257 else if ('A' <= src[i] && src[i] <= 'F') chr |= static_cast<char>((src[i++] - 'A' + 10));
+
258 else if ('a' <= src[i] && src[i] <= 'f') chr |= static_cast<char>((src[i++] - 'a' + 10));
259 else { dst += '%'; dst += src[i - 1]; continue; }
260
-
261 dst += static_cast<char>(chr);
+
261 dst += chr;
262 break;
263 }
264
@@ -2520,12 +2520,12 @@ $(function() { codefold.init(0); });
HTTP token representing an URL.
Definition html.hpp:2141
token_url_t encoding
URL encoding.
Definition html.hpp:2156
std::basic_string< T, TR, AX > url
URL.
Definition html.hpp:2155
-
stdex::interval< size_t > interval
Region of the last match.
Definition parser.hpp:119
-
Test for given string.
Definition parser.hpp:834
+
stdex::interval< size_t > interval
Region of the last match.
Definition parser.hpp:120
+
Test for given string.
Definition parser.hpp:835
Progress indicator base class.
Definition progress.hpp:22
-
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:68
-
virtual void set(T value)
Set current progress.
Definition progress.hpp:50
-
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:40
+
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:70
+
virtual void set(T value)
Set current progress.
Definition progress.hpp:52
+
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:42
User cancelled exception.
Definition exception.hpp:17
Describes attributes associated with a HTML element.
Definition html.hpp:685
static bool is_group(element_t code)
Does element represent a separate part of text?
Definition html.hpp:1102
@@ -2560,12 +2560,12 @@ $(function() { codefold.init(0); });
T end
interval end
Definition interval.hpp:20
T start
interval start
Definition interval.hpp:19
Maps index in source string to index in destination string.
Definition mapping.hpp:17
-
Tag attribute.
Definition parser.hpp:8043
-
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8045
+
Tag attribute.
Definition parser.hpp:8044
+
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8046
diff --git a/idrec_8hpp_source.html b/idrec_8hpp_source.html index eacbf5493..c5c340cca 100644 --- a/idrec_8hpp_source.html +++ b/idrec_8hpp_source.html @@ -475,12 +475,12 @@ $(function() { codefold.init(0); });
virtual void skip(fsize_t amount)
Skips given amount of bytes of data on the stream.
Definition stream.hpp:147
Limits reading from/writing to stream to a predefined number of bytes.
Definition stream.hpp:1551
fsize_t read_limit
Number of bytes left that may be read from the stream.
Definition stream.hpp:1603
-
In-memory file.
Definition stream.hpp:3220
-
const void * data() const
Returns pointer to data.
Definition stream.hpp:3550
+
In-memory file.
Definition stream.hpp:3221
+
const void * data() const
Returns pointer to data.
Definition stream.hpp:3551
diff --git a/include_2stdex_2compat_8hpp_source.html b/include_2stdex_2compat_8hpp_source.html index 1ca8e149f..768af0788 100644 --- a/include_2stdex_2compat_8hpp_source.html +++ b/include_2stdex_2compat_8hpp_source.html @@ -267,38 +267,39 @@ $(function() { codefold.init(0); });
181#ifdef _WIN32
182#define _Unreferenced_(x) UNREFERENCED_PARAMETER(x)
183#else
-
184#define _Unreferenced_(x)
+
184#define _Unreferenced_(x) (void)(x)
185#endif
186
187#ifndef _WIN32
188template <class T, size_t N>
189size_t _countof(const T (&arr)[N])
190{
-
191 return std::extent<T[N]>::value;
-
192}
-
193#endif
-
194
-
195#ifndef _Analysis_assume_
-
196#define _Analysis_assume_(p)
-
197#endif
-
198#ifdef NDEBUG
-
199#define _Assume_(p) _Analysis_assume_(p)
-
200#define _Verify_(p) ((void)(p))
-
201#else
-
202#define _Assume_(p) assert(p)
-
203#define _Verify_(p) assert(p)
-
204#endif
-
205
-
206#ifdef __APPLE__
-
207#define off64_t off_t
-
208#define lseek64 lseek
-
209#define lockf64 lockf
-
210#define ftruncate64 ftruncate
-
211#endif
+
191 _Unreferenced_(arr);
+
192 return std::extent<T[N]>::value;
+
193}
+
194#endif
+
195
+
196#ifndef _Analysis_assume_
+
197#define _Analysis_assume_(p)
+
198#endif
+
199#ifdef NDEBUG
+
200#define _Assume_(p) _Analysis_assume_(p)
+
201#define _Verify_(p) ((void)(p))
+
202#else
+
203#define _Assume_(p) assert(p)
+
204#define _Verify_(p) assert(p)
+
205#endif
+
206
+
207#ifdef __APPLE__
+
208#define off64_t off_t
+
209#define lseek64 lseek
+
210#define lockf64 lockf
+
211#define ftruncate64 ftruncate
+
212#endif
diff --git a/index.html b/index.html index a876995be..f787c5d04 100644 --- a/index.html +++ b/index.html @@ -87,7 +87,7 @@ Requirements
diff --git a/interval_8hpp_source.html b/interval_8hpp_source.html index 98f358ddb..0b7ca9771 100644 --- a/interval_8hpp_source.html +++ b/interval_8hpp_source.html @@ -253,7 +253,7 @@ $(function() { codefold.init(0); });
diff --git a/locale_8hpp_source.html b/locale_8hpp_source.html index 894896e2b..5a8827b3a 100644 --- a/locale_8hpp_source.html +++ b/locale_8hpp_source.html @@ -95,102 +95,111 @@ $(function() { codefold.init(0); });
9#include <locale.h>
10#include <memory>
11
-
12namespace stdex
-
13{
-
14#ifdef _WIN32
-
15 using locale_t = _locale_t;
+
12#if defined(__GNUC__)
+
13#pragma GCC diagnostic push
+
14#pragma GCC diagnostic ignored "-Wexit-time-destructors"
+
15#endif
16
-
17 inline locale_t create_locale(_In_ int category, _In_z_ const char* locale) { return _create_locale(category, locale); }
-
18 inline locale_t create_locale(_In_ int category, _In_z_ const wchar_t* locale) { return _wcreate_locale(category, locale); }
-
19 inline void free_locale(_In_opt_ locale_t locale) { _free_locale(locale); }
-
20#else
-
21 using locale_t = ::locale_t;
-
22
-
23 inline locale_t create_locale(_In_ int category, _In_z_ const char* locale)
-
24 {
-
25 int mask = 0;
-
26 switch (category) {
-
27 case LC_ALL : mask = LC_ALL_MASK ; break;
-
28 case LC_COLLATE : mask = LC_COLLATE_MASK ; break;
-
29 case LC_CTYPE : mask = LC_CTYPE_MASK ; break;
-
30 case LC_MESSAGES: mask = LC_MESSAGES_MASK; break;
-
31 case LC_MONETARY: mask = LC_MONETARY_MASK; break;
-
32 case LC_NUMERIC : mask = LC_NUMERIC_MASK ; break;
-
33 case LC_TIME : mask = LC_TIME_MASK ; break;
-
34 }
-
35 return newlocale(mask, locale, LC_GLOBAL_LOCALE);
-
36 }
-
37
-
38 inline void free_locale(_In_opt_ locale_t locale) { freelocale(locale); }
-
39#endif
-
40
-
- -
45 {
-
-
49 void operator()(_In_ locale_t locale) const
-
50 {
-
51 free_locale(locale);
-
52 }
+
17namespace stdex
+
18{
+
19#ifdef _WIN32
+
20 using locale_t = _locale_t;
+
21
+
22 inline locale_t create_locale(_In_ int category, _In_z_ const char* locale) { return _create_locale(category, locale); }
+
23 inline locale_t create_locale(_In_ int category, _In_z_ const wchar_t* locale) { return _wcreate_locale(category, locale); }
+
24 inline void free_locale(_In_opt_ locale_t locale) { _free_locale(locale); }
+
25#else
+
26 using locale_t = ::locale_t;
+
27
+
28 inline locale_t create_locale(_In_ int category, _In_z_ const char* locale)
+
29 {
+
30 int mask = 0;
+
31 switch (category) {
+
32 case LC_ALL : mask = LC_ALL_MASK ; break;
+
33 case LC_COLLATE : mask = LC_COLLATE_MASK ; break;
+
34 case LC_CTYPE : mask = LC_CTYPE_MASK ; break;
+
35 case LC_MESSAGES: mask = LC_MESSAGES_MASK; break;
+
36 case LC_MONETARY: mask = LC_MONETARY_MASK; break;
+
37 case LC_NUMERIC : mask = LC_NUMERIC_MASK ; break;
+
38 case LC_TIME : mask = LC_TIME_MASK ; break;
+
39 }
+
40 return newlocale(mask, locale, LC_GLOBAL_LOCALE);
+
41 }
+
42
+
43 inline void free_locale(_In_opt_ locale_t locale) { freelocale(locale); }
+
44#endif
+
45
+
+ +
50 {
+
+
54 void operator()(_In_ locale_t locale) const
+
55 {
+
56 free_locale(locale);
+
57 }
-
53 };
+
58 };
-
54
-
56#if defined(_WIN32)
-
57 using _locale_t_ref = __crt_locale_pointers;
-
58#elif defined(__APPLE__)
-
59 using _locale_t_ref = struct _xlocale;
-
60#else
-
61 using _locale_t_ref = struct __locale_struct;
-
62#endif
-
64
-
-
68 class locale : public std::unique_ptr<_locale_t_ref, free_locale_delete>
-
69 {
-
70 public:
-
71 locale() = default;
-
72
-
73 locale(_In_ locale_t ptr) :
-
74 std::unique_ptr<_locale_t_ref, free_locale_delete>(ptr)
-
75 {}
-
76
-
77 locale(_In_ int category, _In_z_ const char* locale) :
-
78 stdex::locale(create_locale(category, locale))
-
79 {}
-
80
-
81#ifdef _WIN32
-
82 locale(_In_ int category, _In_z_ const wchar_t* locale) :
+
59
+
61#if defined(_WIN32)
+
62 using _locale_t_ref = __crt_locale_pointers;
+
63#elif defined(__APPLE__)
+
64 using _locale_t_ref = struct _xlocale;
+
65#else
+
66 using _locale_t_ref = struct __locale_struct;
+
67#endif
+
69
+
+
73 class locale : public std::unique_ptr<_locale_t_ref, free_locale_delete>
+
74 {
+
75 public:
+
76 locale() = default;
+
77
+
78 locale(_In_ locale_t ptr) :
+
79 std::unique_ptr<_locale_t_ref, free_locale_delete>(ptr)
+
80 {}
+
81
+
82 locale(_In_ int category, _In_z_ const char* locale) :
83 stdex::locale(create_locale(category, locale))
84 {}
-
85#endif
-
86
-
87 operator locale_t() const { return get(); }
-
88 };
+
85
+
86#ifdef _WIN32
+
87 locale(_In_ int category, _In_z_ const wchar_t* locale) :
+
88 stdex::locale(create_locale(category, locale))
+
89 {}
+
90#endif
+
91
+
92 operator locale_t() const { return get(); }
+
93 };
-
89
-
93 const inline locale locale_C(create_locale(LC_ALL, "C"));
94
-
98 const inline locale locale_utf8(create_locale(LC_ALL, ".UTF-8"));
+
98 const inline locale locale_C(create_locale(LC_ALL, "C"));
99
-
103 const inline locale locale_default(
-
104#ifdef WIN32
-
105#ifdef _CONSOLE
-
106 create_locale(LC_ALL, ".OCP")
-
107#else
-
108 create_locale(LC_ALL, ".ACP")
-
109#endif
-
110#else
-
111 nullptr
-
112#endif
-
113 );
-
114}
-
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:69
-
Deleter for unique_ptr using free_locale.
Definition locale.hpp:45
-
void operator()(locale_t locale) const
Delete a pointer.
Definition locale.hpp:49
+
103 const inline locale locale_utf8(create_locale(LC_ALL, ".UTF-8"));
+
104
+
108 const inline locale locale_default(
+
109#ifdef WIN32
+
110#ifdef _CONSOLE
+
111 create_locale(LC_ALL, ".OCP")
+
112#else
+
113 create_locale(LC_ALL, ".ACP")
+
114#endif
+
115#else
+
116 nullptr
+
117#endif
+
118 );
+
119}
+
120
+
121#if defined(__GNUC__)
+
122#pragma GCC diagnostic pop
+
123#endif
+
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:74
+
Deleter for unique_ptr using free_locale.
Definition locale.hpp:50
+
void operator()(locale_t locale) const
Delete a pointer.
Definition locale.hpp:54
diff --git a/mapping_8hpp_source.html b/mapping_8hpp_source.html index ca53d0d74..e264879f8 100644 --- a/mapping_8hpp_source.html +++ b/mapping_8hpp_source.html @@ -134,7 +134,7 @@ $(function() { codefold.init(0); });
diff --git a/math_8hpp_source.html b/math_8hpp_source.html index 9a16b1fca..f241043f6 100644 --- a/math_8hpp_source.html +++ b/math_8hpp_source.html @@ -169,7 +169,7 @@ $(function() { codefold.init(0); });
diff --git a/memory_8hpp_source.html b/memory_8hpp_source.html index 91c7c86e4..cef38a6d4 100644 --- a/memory_8hpp_source.html +++ b/memory_8hpp_source.html @@ -131,7 +131,7 @@ $(function() { codefold.init(0); });
diff --git a/parser_8hpp_source.html b/parser_8hpp_source.html index 8a0a1acf1..21b6df9c3 100644 --- a/parser_8hpp_source.html +++ b/parser_8hpp_source.html @@ -123,8441 +123,8442 @@ $(function() { codefold.init(0); });
37#elif defined(__GNUC__)
38#pragma GCC diagnostic push
39#pragma GCC diagnostic ignored "-Wunknown-pragmas"
-
40#endif
-
41
-
42#define ENUM_FLAG_OPERATOR(T,X) \
-
43inline T operator X (const T lhs, const T rhs) { return static_cast<T>(static_cast<std::underlying_type_t<T>>(lhs) X static_cast<std::underlying_type_t<T>>(rhs)); } \
-
44inline T operator X (const T lhs, const std::underlying_type_t<T> rhs) { return static_cast<T>(static_cast<std::underlying_type_t<T>>(lhs) X rhs); } \
-
45inline T operator X (const std::underlying_type_t<T> lhs, const T rhs) { return static_cast<T>(lhs X static_cast<std::underlying_type_t<T>>(rhs)); } \
-
46inline T& operator X= (T& lhs, const T rhs) { return lhs = lhs X rhs; } \
-
47inline T& operator X= (T& lhs, const std::underlying_type_t<T> rhs) { return lhs = lhs X rhs; }
-
48#define ENUM_FLAGS(T, type) \
-
49enum class T : type; \
-
50inline T operator ~ (T t) { return (T) (~static_cast<std::underlying_type_t <T>>(t)); } \
-
51ENUM_FLAG_OPERATOR(T,|) \
-
52ENUM_FLAG_OPERATOR(T,^) \
-
53ENUM_FLAG_OPERATOR(T,&) \
-
54enum class T : type
-
55
-
56#if defined(_WIN32)
-
57#elif defined(__APPLE__)
-
58#define s6_words __u6_addr.__u6_addr16
-
59#else
-
60#define s6_words s6_addr16
-
61#endif
-
62
-
63namespace stdex
-
64{
-
65 namespace parser
-
66 {
-
70 constexpr int match_default = 0;
-
71 constexpr int match_case_insensitive = 0x1;
-
72 constexpr int match_multiline = 0x2;
-
73
-
77 template <class T>
-
-
78 class basic_parser
-
79 {
-
80 public:
-
81 basic_parser(_In_ const std::locale& locale = std::locale()) : m_locale(locale) {}
-
82 virtual ~basic_parser() {}
-
83
-
84 bool search(
-
85 _In_reads_or_z_opt_(end) const T* text,
-
86 _In_ size_t start = 0,
-
87 _In_ size_t end = SIZE_MAX,
-
88 _In_ int flags = match_default)
-
89 {
-
90 for (size_t i = start; i < end && text[i]; i++)
-
91 if (match(text, i, end, flags))
-
92 return true;
-
93 return false;
-
94 }
-
95
-
96 bool match(
-
97 _In_reads_or_z_opt_(end) const T* text,
-
98 _In_ size_t start = 0,
-
99 _In_ size_t end = SIZE_MAX,
-
100 _In_ int flags = match_default)
-
101 {
-
102 return do_match(text, start, end, flags);
-
103 }
-
104
-
105 bool match(
-
106 _In_ const std::basic_string_view<T, std::char_traits<T>> text,
-
107 _In_ size_t start = 0,
-
108 _In_ size_t end = SIZE_MAX,
-
109 _In_ int flags = match_default)
-
110 {
-
111 return match(text.data(), start, std::min<size_t>(end, text.size()), flags);
-
112 }
-
113
-
114 virtual void invalidate()
-
115 {
-
116 this->interval.invalidate();
-
117 }
-
118
-
119 stdex::interval<size_t> interval;
-
120
-
121 protected:
-
122 virtual bool do_match(
-
123 _In_reads_or_z_opt_(end) const T* text,
-
124 _In_ size_t start = 0,
-
125 _In_ size_t end = SIZE_MAX,
-
126 _In_ int flags = match_default) = 0;
-
127
-
129 const wchar_t* next_sgml_cp(_In_ const char* text, _In_ size_t start, _In_ size_t end, _Out_ size_t& chr_end, _Out_ wchar_t(&buf)[3])
-
130 {
-
131 if (text[start] == '&') {
-
132 // Potential entity start
-
133 const auto& ctype = std::use_facet<std::ctype<T>>(m_locale);
-
134 for (chr_end = start + 1;; chr_end++) {
-
135 if (chr_end >= end || text[chr_end] == 0) {
-
136 // Unterminated entity
-
137 break;
-
138 }
-
139 if (text[chr_end] == ';') {
-
140 // Entity end
-
141 size_t n = chr_end - start - 1;
-
142 if (n >= 2 && text[start + 1] == '#') {
-
143 // Numerical entity
-
144 utf32_t unicode;
-
145 if (text[start + 2] == 'x' || text[start + 2] == 'X')
-
146 unicode = static_cast<utf32_t>(strtou32(text + start + 3, n - 2, nullptr, 16));
-
147 else
-
148 unicode = static_cast<utf32_t>(strtou32(text + start + 2, n - 1, nullptr, 10));
-
149#ifdef _WIN32
-
150 if (unicode < 0x10000) {
-
151 buf[0] = (wchar_t)unicode;
-
152 buf[1] = 0;
-
153 }
-
154 else {
-
155 ucs4_to_surrogate_pair(buf, unicode);
-
156 buf[2] = 0;
-
157 }
-
158#else
-
159 buf[0] = (wchar_t)unicode;
-
160 buf[1] = 0;
-
161#endif
-
162 chr_end++;
-
163 return buf;
-
164 }
-
165 const wchar_t* entity_w = sgml2uni(text + start + 1, n);
-
166 if (entity_w) {
-
167 chr_end++;
-
168 return entity_w;
-
169 }
-
170 // Unknown entity.
-
171 break;
-
172 }
-
173 else if (text[chr_end] == '&' || ctype.is(ctype.space, text[chr_end])) {
-
174 // This char cannot possibly be a part of entity.
-
175 break;
-
176 }
-
177 }
-
178 }
-
179 buf[0] = text[start];
-
180 buf[1] = 0;
-
181 chr_end = start + 1;
-
182 return buf;
-
183 }
-
185
-
186 std::locale m_locale;
-
187 };
+
40#pragma GCC diagnostic ignored "-Wunused-parameter"
+
41#endif
+
42
+
43#define ENUM_FLAG_OPERATOR(T,X) \
+
44inline T operator X (const T lhs, const T rhs) { return static_cast<T>(static_cast<std::underlying_type_t<T>>(lhs) X static_cast<std::underlying_type_t<T>>(rhs)); } \
+
45inline T operator X (const T lhs, const std::underlying_type_t<T> rhs) { return static_cast<T>(static_cast<std::underlying_type_t<T>>(lhs) X rhs); } \
+
46inline T operator X (const std::underlying_type_t<T> lhs, const T rhs) { return static_cast<T>(lhs X static_cast<std::underlying_type_t<T>>(rhs)); } \
+
47inline T& operator X= (T& lhs, const T rhs) { return lhs = lhs X rhs; } \
+
48inline T& operator X= (T& lhs, const std::underlying_type_t<T> rhs) { return lhs = lhs X rhs; }
+
49#define ENUM_FLAGS(T, type) \
+
50enum class T : type; \
+
51inline T operator ~ (T t) { return (T) (~static_cast<std::underlying_type_t <T>>(t)); } \
+
52ENUM_FLAG_OPERATOR(T,|) \
+
53ENUM_FLAG_OPERATOR(T,^) \
+
54ENUM_FLAG_OPERATOR(T,&) \
+
55enum class T : type
+
56
+
57#if defined(_WIN32)
+
58#elif defined(__APPLE__)
+
59#define s6_words __u6_addr.__u6_addr16
+
60#else
+
61#define s6_words s6_addr16
+
62#endif
+
63
+
64namespace stdex
+
65{
+
66 namespace parser
+
67 {
+
71 constexpr int match_default = 0;
+
72 constexpr int match_case_insensitive = 0x1;
+
73 constexpr int match_multiline = 0x2;
+
74
+
78 template <class T>
+
+ +
80 {
+
81 public:
+
82 basic_parser(_In_ const std::locale& locale = std::locale()) : m_locale(locale) {}
+
83 virtual ~basic_parser() {}
+
84
+
85 bool search(
+
86 _In_reads_or_z_opt_(end) const T* text,
+
87 _In_ size_t start = 0,
+
88 _In_ size_t end = SIZE_MAX,
+
89 _In_ int flags = match_default)
+
90 {
+
91 for (size_t i = start; i < end && text[i]; i++)
+
92 if (match(text, i, end, flags))
+
93 return true;
+
94 return false;
+
95 }
+
96
+
97 bool match(
+
98 _In_reads_or_z_opt_(end) const T* text,
+
99 _In_ size_t start = 0,
+
100 _In_ size_t end = SIZE_MAX,
+
101 _In_ int flags = match_default)
+
102 {
+
103 return do_match(text, start, end, flags);
+
104 }
+
105
+
106 bool match(
+
107 _In_ const std::basic_string_view<T, std::char_traits<T>> text,
+
108 _In_ size_t start = 0,
+
109 _In_ size_t end = SIZE_MAX,
+
110 _In_ int flags = match_default)
+
111 {
+
112 return match(text.data(), start, std::min<size_t>(end, text.size()), flags);
+
113 }
+
114
+
115 virtual void invalidate()
+
116 {
+
117 this->interval.invalidate();
+
118 }
+
119
+ +
121
+
122 protected:
+
123 virtual bool do_match(
+
124 _In_reads_or_z_opt_(end) const T* text,
+
125 _In_ size_t start = 0,
+
126 _In_ size_t end = SIZE_MAX,
+
127 _In_ int flags = match_default) = 0;
+
128
+
130 const wchar_t* next_sgml_cp(_In_ const char* text, _In_ size_t start, _In_ size_t end, _Out_ size_t& chr_end, _Out_ wchar_t(&buf)[3])
+
131 {
+
132 if (text[start] == '&') {
+
133 // Potential entity start
+
134 const auto& ctype = std::use_facet<std::ctype<T>>(m_locale);
+
135 for (chr_end = start + 1;; chr_end++) {
+
136 if (chr_end >= end || text[chr_end] == 0) {
+
137 // Unterminated entity
+
138 break;
+
139 }
+
140 if (text[chr_end] == ';') {
+
141 // Entity end
+
142 size_t n = chr_end - start - 1;
+
143 if (n >= 2 && text[start + 1] == '#') {
+
144 // Numerical entity
+
145 utf32_t unicode;
+
146 if (text[start + 2] == 'x' || text[start + 2] == 'X')
+
147 unicode = static_cast<utf32_t>(strtou32(text + start + 3, n - 2, nullptr, 16));
+
148 else
+
149 unicode = static_cast<utf32_t>(strtou32(text + start + 2, n - 1, nullptr, 10));
+
150#ifdef _WIN32
+
151 if (unicode < 0x10000) {
+
152 buf[0] = (wchar_t)unicode;
+
153 buf[1] = 0;
+
154 }
+
155 else {
+
156 ucs4_to_surrogate_pair(buf, unicode);
+
157 buf[2] = 0;
+
158 }
+
159#else
+
160 buf[0] = (wchar_t)unicode;
+
161 buf[1] = 0;
+
162#endif
+
163 chr_end++;
+
164 return buf;
+
165 }
+
166 const wchar_t* entity_w = sgml2uni(text + start + 1, n);
+
167 if (entity_w) {
+
168 chr_end++;
+
169 return entity_w;
+
170 }
+
171 // Unknown entity.
+
172 break;
+
173 }
+
174 else if (text[chr_end] == '&' || ctype.is(ctype.space, text[chr_end])) {
+
175 // This char cannot possibly be a part of entity.
+
176 break;
+
177 }
+
178 }
+
179 }
+
180 buf[0] = text[start];
+
181 buf[1] = 0;
+
182 chr_end = start + 1;
+
183 return buf;
+
184 }
+
186
+
187 std::locale m_locale;
+
188 };
-
188
-
189 using parser = basic_parser<char>;
-
190 using wparser = basic_parser<wchar_t>;
-
191#ifdef _UNICODE
-
192 using tparser = wparser;
-
193#else
-
194 using tparser = parser;
-
195#endif
-
196 using sgml_parser = basic_parser<char>;
-
197
-
201 template <class T>
-
-
202 class basic_noop : public basic_parser<T>
-
203 {
-
204 protected:
-
205 virtual bool do_match(
-
206 _In_reads_or_z_opt_(end) const T* text,
-
207 _In_ size_t start = 0,
-
208 _In_ size_t end = SIZE_MAX,
-
209 _In_ int flags = match_default)
-
210 {
-
211 _Assume_(text || start >= end);
-
212 if (start < end && text[start]) {
-
213 this->interval.start = this->interval.end = start;
-
214 return true;
-
215 }
-
216 this->interval.invalidate();
-
217 return false;
-
218 }
-
219 };
+
189
+
190 using parser = basic_parser<char>;
+
191 using wparser = basic_parser<wchar_t>;
+
192#ifdef _UNICODE
+
193 using tparser = wparser;
+
194#else
+
195 using tparser = parser;
+
196#endif
+
197 using sgml_parser = basic_parser<char>;
+
198
+
202 template <class T>
+
+
203 class basic_noop : public basic_parser<T>
+
204 {
+
205 protected:
+
206 virtual bool do_match(
+
207 _In_reads_or_z_opt_(end) const T* text,
+
208 _In_ size_t start = 0,
+
209 _In_ size_t end = SIZE_MAX,
+
210 _In_ int flags = match_default)
+
211 {
+
212 _Assume_(text || start >= end);
+
213 if (start < end && text[start]) {
+
214 this->interval.start = this->interval.end = start;
+
215 return true;
+
216 }
+
217 this->interval.invalidate();
+
218 return false;
+
219 }
+
220 };
-
220
-
221 using noop = basic_noop<char>;
- -
223#ifdef _UNICODE
-
224 using tnoop = wnoop;
-
225#else
-
226 using tnoop = noop;
-
227#endif
- -
229
-
233 template <class T>
-
-
234 class basic_any_cu : public basic_parser<T>
-
235 {
-
236 public:
-
237 basic_any_cu(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
238
-
239 protected:
-
240 virtual bool do_match(
-
241 _In_reads_or_z_opt_(end) const T* text,
-
242 _In_ size_t start = 0,
-
243 _In_ size_t end = SIZE_MAX,
-
244 _In_ int flags = match_default)
-
245 {
-
246 _Assume_(text || start >= end);
-
247 if (start < end && text[start]) {
-
248 this->interval.end = (this->interval.start = start) + 1;
-
249 return true;
-
250 }
-
251 this->interval.invalidate();
-
252 return false;
-
253 }
-
254 };
+
221
+
222 using noop = basic_noop<char>;
+ +
224#ifdef _UNICODE
+
225 using tnoop = wnoop;
+
226#else
+
227 using tnoop = noop;
+
228#endif
+ +
230
+
234 template <class T>
+
+
235 class basic_any_cu : public basic_parser<T>
+
236 {
+
237 public:
+
238 basic_any_cu(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
239
+
240 protected:
+
241 virtual bool do_match(
+
242 _In_reads_or_z_opt_(end) const T* text,
+
243 _In_ size_t start = 0,
+
244 _In_ size_t end = SIZE_MAX,
+
245 _In_ int flags = match_default)
+
246 {
+
247 _Assume_(text || start >= end);
+
248 if (start < end && text[start]) {
+
249 this->interval.end = (this->interval.start = start) + 1;
+
250 return true;
+
251 }
+
252 this->interval.invalidate();
+
253 return false;
+
254 }
+
255 };
-
255
- - -
258#ifdef _UNICODE
-
259 using tany_cu = wany_cu;
-
260#else
-
261 using tany_cu = any_cu;
-
262#endif
-
263
-
-
267 class sgml_any_cp : public basic_any_cu<char>
-
268 {
-
269 public:
-
270 sgml_any_cp(_In_ const std::locale& locale = std::locale()) : basic_any_cu<char>(locale) {}
-
271
-
272 protected:
-
273 virtual bool do_match(
-
274 _In_reads_or_z_(end) const char* text,
-
275 _In_ size_t start = 0,
-
276 _In_ size_t end = SIZE_MAX,
-
277 _In_ int flags = match_default)
-
278 {
-
279 _Assume_(text || start >= end);
-
280 if (start < end && text[start]) {
-
281 if (text[start] == '&') {
-
282 // SGML entity
-
283 const auto& ctype = std::use_facet<std::ctype<char>>(m_locale);
-
284 for (this->interval.end = start + 1; this->interval.end < end && text[this->interval.end]; this->interval.end++)
-
285 if (text[this->interval.end] == ';') {
-
286 this->interval.end++;
-
287 this->interval.start = start;
-
288 return true;
-
289 }
-
290 else if (text[this->interval.end] == '&' || ctype.is(ctype.space, text[this->interval.end]))
-
291 break;
-
292 // Unterminated entity
-
293 }
-
294 this->interval.end = (this->interval.start = start) + 1;
-
295 return true;
-
296 }
-
297 this->interval.invalidate();
-
298 return false;
-
299 }
-
300 };
+
256
+ + +
259#ifdef _UNICODE
+
260 using tany_cu = wany_cu;
+
261#else
+
262 using tany_cu = any_cu;
+
263#endif
+
264
+
+
268 class sgml_any_cp : public basic_any_cu<char>
+
269 {
+
270 public:
+
271 sgml_any_cp(_In_ const std::locale& locale = std::locale()) : basic_any_cu<char>(locale) {}
+
272
+
273 protected:
+
274 virtual bool do_match(
+
275 _In_reads_or_z_(end) const char* text,
+
276 _In_ size_t start = 0,
+
277 _In_ size_t end = SIZE_MAX,
+
278 _In_ int flags = match_default)
+
279 {
+
280 _Assume_(text || start >= end);
+
281 if (start < end && text[start]) {
+
282 if (text[start] == '&') {
+
283 // SGML entity
+
284 const auto& ctype = std::use_facet<std::ctype<char>>(m_locale);
+
285 for (this->interval.end = start + 1; this->interval.end < end && text[this->interval.end]; this->interval.end++)
+
286 if (text[this->interval.end] == ';') {
+
287 this->interval.end++;
+
288 this->interval.start = start;
+
289 return true;
+
290 }
+
291 else if (text[this->interval.end] == '&' || ctype.is(ctype.space, text[this->interval.end]))
+
292 break;
+
293 // Unterminated entity
+
294 }
+
295 this->interval.end = (this->interval.start = start) + 1;
+
296 return true;
+
297 }
+
298 this->interval.invalidate();
+
299 return false;
+
300 }
+
301 };
-
301
-
305 template <class T>
-
-
306 class basic_cu : public basic_parser<T>
-
307 {
-
308 public:
-
309 basic_cu(T chr, bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
311 m_chr(chr),
-
312 m_invert(invert)
-
313 {}
-
314
-
315 protected:
-
316 virtual bool do_match(
-
317 _In_reads_or_z_opt_(end) const T* text,
-
318 _In_ size_t start = 0,
-
319 _In_ size_t end = SIZE_MAX,
-
320 _In_ int flags = match_default)
-
321 {
-
322 _Assume_(text || start >= end);
-
323 if (start < end && text[start]) {
-
324 bool r;
-
325 if (flags & match_case_insensitive) {
-
326 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
327 r = ctype.tolower(text[start]) == ctype.tolower(m_chr);
-
328 }
-
329 else
-
330 r = text[start] == m_chr;
-
331 if ((r && !m_invert) || (!r && m_invert)) {
-
332 this->interval.end = (this->interval.start = start) + 1;
-
333 return true;
-
334 }
-
335 }
-
336 this->interval.invalidate();
-
337 return false;
-
338 }
-
339
-
340 T m_chr;
-
341 bool m_invert;
-
342 };
+
302
+
306 template <class T>
+
+
307 class basic_cu : public basic_parser<T>
+
308 {
+
309 public:
+
310 basic_cu(T chr, bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
312 m_chr(chr),
+
313 m_invert(invert)
+
314 {}
+
315
+
316 protected:
+
317 virtual bool do_match(
+
318 _In_reads_or_z_opt_(end) const T* text,
+
319 _In_ size_t start = 0,
+
320 _In_ size_t end = SIZE_MAX,
+
321 _In_ int flags = match_default)
+
322 {
+
323 _Assume_(text || start >= end);
+
324 if (start < end && text[start]) {
+
325 bool r;
+
326 if (flags & match_case_insensitive) {
+
327 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
328 r = ctype.tolower(text[start]) == ctype.tolower(m_chr);
+
329 }
+
330 else
+
331 r = text[start] == m_chr;
+
332 if ((r && !m_invert) || (!r && m_invert)) {
+
333 this->interval.end = (this->interval.start = start) + 1;
+
334 return true;
+
335 }
+
336 }
+
337 this->interval.invalidate();
+
338 return false;
+
339 }
+
340
+
341 T m_chr;
+
342 bool m_invert;
+
343 };
-
343
-
344 using cu = basic_cu<char>;
-
345 using wcu = basic_cu<wchar_t>;
-
346#ifdef _UNICODE
-
347 using tcu = wcu;
-
348#else
-
349 using tcu = cu;
-
350#endif
-
351
-
-
355 class sgml_cp : public sgml_parser
-
356 {
-
357 public:
-
358 sgml_cp(const char* chr, size_t count = SIZE_MAX, bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
360 m_invert(invert)
-
361 {
-
362 _Assume_(chr || !count);
-
363 wchar_t buf[3];
-
364 size_t chr_end;
-
365 m_chr.assign(count ? next_sgml_cp(chr, 0, count, chr_end, buf) : L"");
-
366 }
-
367
-
368 protected:
-
369 virtual bool do_match(
-
370 _In_reads_or_z_(end) const char* text,
-
371 _In_ size_t start = 0,
-
372 _In_ size_t end = SIZE_MAX,
-
373 _In_ int flags = match_default)
-
374 {
-
375 _Assume_(text || start >= end);
-
376 if (start < end && text[start]) {
-
377 wchar_t buf[3];
-
378 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
379 bool r = ((flags & match_case_insensitive) ?
-
380 stdex::strnicmp(chr, SIZE_MAX, m_chr.data(), m_chr.size(), m_locale) :
-
381 stdex::strncmp(chr, SIZE_MAX, m_chr.data(), m_chr.size())) == 0;
-
382 if ((r && !m_invert) || (!r && m_invert)) {
-
383 this->interval.start = start;
-
384 return true;
-
385 }
-
386 }
-
387 this->interval.invalidate();
-
388 return false;
-
389 }
-
390
-
391 std::wstring m_chr;
-
392 bool m_invert;
-
393 };
+
344
+
345 using cu = basic_cu<char>;
+
346 using wcu = basic_cu<wchar_t>;
+
347#ifdef _UNICODE
+
348 using tcu = wcu;
+
349#else
+
350 using tcu = cu;
+
351#endif
+
352
+
+
356 class sgml_cp : public sgml_parser
+
357 {
+
358 public:
+
359 sgml_cp(const char* chr, size_t count = SIZE_MAX, bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
361 m_invert(invert)
+
362 {
+
363 _Assume_(chr || !count);
+
364 wchar_t buf[3];
+
365 size_t chr_end;
+
366 m_chr.assign(count ? next_sgml_cp(chr, 0, count, chr_end, buf) : L"");
+
367 }
+
368
+
369 protected:
+
370 virtual bool do_match(
+
371 _In_reads_or_z_(end) const char* text,
+
372 _In_ size_t start = 0,
+
373 _In_ size_t end = SIZE_MAX,
+
374 _In_ int flags = match_default)
+
375 {
+
376 _Assume_(text || start >= end);
+
377 if (start < end && text[start]) {
+
378 wchar_t buf[3];
+
379 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
380 bool r = ((flags & match_case_insensitive) ?
+
381 stdex::strnicmp(chr, stdex::strlen(chr), m_chr.data(), m_chr.size(), m_locale) :
+
382 stdex::strncmp(chr, stdex::strlen(chr), m_chr.data(), m_chr.size())) == 0;
+
383 if ((r && !m_invert) || (!r && m_invert)) {
+
384 this->interval.start = start;
+
385 return true;
+
386 }
+
387 }
+
388 this->interval.invalidate();
+
389 return false;
+
390 }
+
391
+
392 std::wstring m_chr;
+
393 bool m_invert;
+
394 };
-
394
-
398 template <class T>
-
-
399 class basic_space_cu : public basic_parser<T>
-
400 {
-
401 public:
-
402 basic_space_cu(bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
404 m_invert(invert)
-
405 {}
-
406
-
407 protected:
-
408 virtual bool do_match(
-
409 _In_reads_or_z_opt_(end) const T* text,
-
410 _In_ size_t start = 0,
-
411 _In_ size_t end = SIZE_MAX,
-
412 _In_ int flags = match_default)
-
413 {
-
414 _Assume_(text || start >= end);
-
415 if (start < end && text[start]) {
-
416 bool r =
-
417 ((flags & match_multiline) || !stdex::islbreak(text[start])) &&
-
418 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space, text[start]);
-
419 if ((r && !m_invert) || (!r && m_invert)) {
-
420 this->interval.end = (this->interval.start = start) + 1;
-
421 return true;
-
422 }
-
423 }
-
424 this->interval.invalidate();
-
425 return false;
-
426 }
-
427
-
428 bool m_invert;
-
429 };
+
395
+
399 template <class T>
+
+
400 class basic_space_cu : public basic_parser<T>
+
401 {
+
402 public:
+
403 basic_space_cu(bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
405 m_invert(invert)
+
406 {}
+
407
+
408 protected:
+
409 virtual bool do_match(
+
410 _In_reads_or_z_opt_(end) const T* text,
+
411 _In_ size_t start = 0,
+
412 _In_ size_t end = SIZE_MAX,
+
413 _In_ int flags = match_default)
+
414 {
+
415 _Assume_(text || start >= end);
+
416 if (start < end && text[start]) {
+
417 bool r =
+
418 ((flags & match_multiline) || !stdex::islbreak(text[start])) &&
+
419 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space, text[start]);
+
420 if ((r && !m_invert) || (!r && m_invert)) {
+
421 this->interval.end = (this->interval.start = start) + 1;
+
422 return true;
+
423 }
+
424 }
+
425 this->interval.invalidate();
+
426 return false;
+
427 }
+
428
+
429 bool m_invert;
+
430 };
-
430
- - -
433#ifdef _UNICODE
-
434 using tspace_cu = wspace_cu;
-
435#else
-
436 using tspace_cu = space_cu;
-
437#endif
-
438
-
-
442 class sgml_space_cp : public basic_space_cu<char>
-
443 {
-
444 public:
-
445 sgml_space_cp(_In_ bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
447 {}
-
448
-
449 protected:
-
450 virtual bool do_match(
-
451 _In_reads_or_z_(end) const char* text,
-
452 _In_ size_t start = 0,
-
453 _In_ size_t end = SIZE_MAX,
-
454 _In_ int flags = match_default)
-
455 {
-
456 _Assume_(text || start >= end);
-
457 if (start < end && text[start]) {
-
458 wchar_t buf[3];
-
459 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
460 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
461 bool r =
-
462 ((flags & match_multiline) || !stdex::islbreak(chr, SIZE_MAX)) &&
-
463 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space, chr, chr_end) == chr_end;
-
464 if ((r && !m_invert) || (!r && m_invert)) {
-
465 this->interval.start = start;
-
466 return true;
-
467 }
-
468 }
-
469
-
470 this->interval.invalidate();
-
471 return false;
-
472 }
-
473 };
+
431
+ + +
434#ifdef _UNICODE
+
435 using tspace_cu = wspace_cu;
+
436#else
+
437 using tspace_cu = space_cu;
+
438#endif
+
439
+
+
443 class sgml_space_cp : public basic_space_cu<char>
+
444 {
+
445 public:
+
446 sgml_space_cp(_In_ bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
448 {}
+
449
+
450 protected:
+
451 virtual bool do_match(
+
452 _In_reads_or_z_(end) const char* text,
+
453 _In_ size_t start = 0,
+
454 _In_ size_t end = SIZE_MAX,
+
455 _In_ int flags = match_default)
+
456 {
+
457 _Assume_(text || start >= end);
+
458 if (start < end && text[start]) {
+
459 wchar_t buf[3];
+
460 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
461 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
462 bool r =
+
463 ((flags & match_multiline) || !stdex::islbreak(chr, SIZE_MAX)) &&
+
464 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space, chr, chr_end) == chr_end;
+
465 if ((r && !m_invert) || (!r && m_invert)) {
+
466 this->interval.start = start;
+
467 return true;
+
468 }
+
469 }
+
470
+
471 this->interval.invalidate();
+
472 return false;
+
473 }
+
474 };
-
474
-
478 template <class T>
-
-
479 class basic_punct_cu : public basic_parser<T>
-
480 {
-
481 public:
-
482 basic_punct_cu(bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
484 m_invert(invert)
-
485 {}
-
486
-
487 protected:
-
488 virtual bool do_match(
-
489 _In_reads_or_z_opt_(end) const T* text,
-
490 _In_ size_t start = 0,
-
491 _In_ size_t end = SIZE_MAX,
-
492 _In_ int flags = match_default)
-
493 {
-
494 _Assume_(text || start >= end);
-
495 if (start < end && text[start]) {
-
496 bool r = std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::punct, text[start]);
-
497 if ((r && !m_invert) || (!r && m_invert)) {
-
498 this->interval.end = (this->interval.start = start) + 1;
-
499 return true;
-
500 }
-
501 }
-
502 this->interval.invalidate();
-
503 return false;
-
504 }
-
505
-
506 bool m_invert;
-
507 };
+
475
+
479 template <class T>
+
+
480 class basic_punct_cu : public basic_parser<T>
+
481 {
+
482 public:
+
483 basic_punct_cu(bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
485 m_invert(invert)
+
486 {}
+
487
+
488 protected:
+
489 virtual bool do_match(
+
490 _In_reads_or_z_opt_(end) const T* text,
+
491 _In_ size_t start = 0,
+
492 _In_ size_t end = SIZE_MAX,
+
493 _In_ int flags = match_default)
+
494 {
+
495 _Assume_(text || start >= end);
+
496 if (start < end && text[start]) {
+
497 bool r = std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::punct, text[start]);
+
498 if ((r && !m_invert) || (!r && m_invert)) {
+
499 this->interval.end = (this->interval.start = start) + 1;
+
500 return true;
+
501 }
+
502 }
+
503 this->interval.invalidate();
+
504 return false;
+
505 }
+
506
+
507 bool m_invert;
+
508 };
-
508
- - -
511#ifdef _UNICODE
-
512 using tpunct_cu = wpunct_cu;
-
513#else
-
514 using tpunct_cu = punct_cu;
-
515#endif
-
516
-
-
520 class sgml_punct_cp : public basic_punct_cu<char>
-
521 {
-
522 public:
-
523 sgml_punct_cp(bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
525 {}
-
526
-
527 protected:
-
528 virtual bool do_match(
-
529 _In_reads_or_z_(end) const char* text,
-
530 _In_ size_t start = 0,
-
531 _In_ size_t end = SIZE_MAX,
-
532 _In_ int flags = match_default)
-
533 {
-
534 _Assume_(text || start >= end);
-
535 if (start < end && text[start]) {
-
536 wchar_t buf[3];
-
537 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
538 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
539 bool r = std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::punct, chr, chr_end) == chr_end;
-
540 if ((r && !m_invert) || (!r && m_invert)) {
-
541 this->interval.start = start;
-
542 return true;
-
543 }
-
544 }
-
545 this->interval.invalidate();
-
546 return false;
-
547 }
-
548 };
+
509
+ + +
512#ifdef _UNICODE
+
513 using tpunct_cu = wpunct_cu;
+
514#else
+
515 using tpunct_cu = punct_cu;
+
516#endif
+
517
+
+
521 class sgml_punct_cp : public basic_punct_cu<char>
+
522 {
+
523 public:
+
524 sgml_punct_cp(bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
526 {}
+
527
+
528 protected:
+
529 virtual bool do_match(
+
530 _In_reads_or_z_(end) const char* text,
+
531 _In_ size_t start = 0,
+
532 _In_ size_t end = SIZE_MAX,
+
533 _In_ int flags = match_default)
+
534 {
+
535 _Assume_(text || start >= end);
+
536 if (start < end && text[start]) {
+
537 wchar_t buf[3];
+
538 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
539 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
540 bool r = std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::punct, chr, chr_end) == chr_end;
+
541 if ((r && !m_invert) || (!r && m_invert)) {
+
542 this->interval.start = start;
+
543 return true;
+
544 }
+
545 }
+
546 this->interval.invalidate();
+
547 return false;
+
548 }
+
549 };
-
549
-
553 template <class T>
-
- -
555 {
-
556 public:
-
557 basic_space_or_punct_cu(bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
559 m_invert(invert)
-
560 {}
-
561
-
562 protected:
-
563 virtual bool do_match(
-
564 _In_reads_or_z_opt_(end) const T* text,
-
565 _In_ size_t start = 0,
-
566 _In_ size_t end = SIZE_MAX,
-
567 _In_ int flags = match_default)
-
568 {
-
569 _Assume_(text || start >= end);
-
570 if (start < end && text[start]) {
-
571 bool r =
-
572 ((flags & match_multiline) || !stdex::islbreak(text[start])) &&
-
573 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space | std::ctype_base::punct, text[start]);
-
574 if ((r && !m_invert) || (!r && m_invert)) {
-
575 this->interval.end = (this->interval.start = start) + 1;
-
576 return true;
-
577 }
-
578 }
-
579 this->interval.invalidate();
-
580 return false;
-
581 }
-
582
-
583 bool m_invert;
-
584 };
+
550
+
554 template <class T>
+
+ +
556 {
+
557 public:
+
558 basic_space_or_punct_cu(bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
560 m_invert(invert)
+
561 {}
+
562
+
563 protected:
+
564 virtual bool do_match(
+
565 _In_reads_or_z_opt_(end) const T* text,
+
566 _In_ size_t start = 0,
+
567 _In_ size_t end = SIZE_MAX,
+
568 _In_ int flags = match_default)
+
569 {
+
570 _Assume_(text || start >= end);
+
571 if (start < end && text[start]) {
+
572 bool r =
+
573 ((flags & match_multiline) || !stdex::islbreak(text[start])) &&
+
574 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space | std::ctype_base::punct, text[start]);
+
575 if ((r && !m_invert) || (!r && m_invert)) {
+
576 this->interval.end = (this->interval.start = start) + 1;
+
577 return true;
+
578 }
+
579 }
+
580 this->interval.invalidate();
+
581 return false;
+
582 }
+
583
+
584 bool m_invert;
+
585 };
-
585
- - -
588#ifdef _UNICODE
- -
590#else
- -
592#endif
-
593
-
- -
598 {
-
599 public:
-
600 sgml_space_or_punct_cp(bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
602 {}
-
603
-
604 protected:
-
605 virtual bool do_match(
-
606 _In_reads_or_z_(end) const char* text,
-
607 _In_ size_t start = 0,
-
608 _In_ size_t end = SIZE_MAX,
-
609 _In_ int flags = match_default)
-
610 {
-
611 _Assume_(text || start >= end);
-
612 if (start < end && text[start]) {
-
613 wchar_t buf[3];
-
614 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
615 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
616 bool r =
-
617 ((flags & match_multiline) || !stdex::islbreak(chr, SIZE_MAX)) &&
-
618 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space | std::ctype_base::punct, chr, chr_end) == chr_end;
-
619 if ((r && !m_invert) || (!r && m_invert)) {
-
620 this->interval.start = start;
-
621 return true;
-
622 }
-
623 }
-
624 this->interval.invalidate();
-
625 return false;
-
626 }
-
627 };
+
586
+ + +
589#ifdef _UNICODE
+ +
591#else
+ +
593#endif
+
594
+
+ +
599 {
+
600 public:
+
601 sgml_space_or_punct_cp(bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
603 {}
+
604
+
605 protected:
+
606 virtual bool do_match(
+
607 _In_reads_or_z_(end) const char* text,
+
608 _In_ size_t start = 0,
+
609 _In_ size_t end = SIZE_MAX,
+
610 _In_ int flags = match_default)
+
611 {
+
612 _Assume_(text || start >= end);
+
613 if (start < end && text[start]) {
+
614 wchar_t buf[3];
+
615 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
616 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
617 bool r =
+
618 ((flags & match_multiline) || !stdex::islbreak(chr, SIZE_MAX)) &&
+
619 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space | std::ctype_base::punct, chr, chr_end) == chr_end;
+
620 if ((r && !m_invert) || (!r && m_invert)) {
+
621 this->interval.start = start;
+
622 return true;
+
623 }
+
624 }
+
625 this->interval.invalidate();
+
626 return false;
+
627 }
+
628 };
-
628
-
632 template <class T>
-
-
633 class basic_bol : public basic_parser<T>
-
634 {
-
635 public:
-
636 basic_bol(bool invert = false) : m_invert(invert) {}
-
637
-
638 protected:
-
639 virtual bool do_match(
-
640 _In_reads_or_z_opt_(end) const T* text,
-
641 _In_ size_t start = 0,
-
642 _In_ size_t end = SIZE_MAX,
-
643 _In_ int flags = match_default)
-
644 {
-
645 _Assume_(text || !end);
-
646 _Assume_(text || start >= end);
-
647 bool r = start == 0 || (start <= end && stdex::islbreak(text[start - 1]));
-
648 if ((r && !m_invert) || (!r && m_invert)) {
-
649 this->interval.end = this->interval.start = start;
-
650 return true;
-
651 }
-
652 this->interval.invalidate();
-
653 return false;
-
654 }
-
655
-
656 bool m_invert;
-
657 };
+
629
+
633 template <class T>
+
+
634 class basic_bol : public basic_parser<T>
+
635 {
+
636 public:
+
637 basic_bol(bool invert = false) : m_invert(invert) {}
+
638
+
639 protected:
+
640 virtual bool do_match(
+
641 _In_reads_or_z_opt_(end) const T* text,
+
642 _In_ size_t start = 0,
+
643 _In_ size_t end = SIZE_MAX,
+
644 _In_ int flags = match_default)
+
645 {
+
646 _Assume_(text || !end);
+
647 _Assume_(text || start >= end);
+
648 bool r = start == 0 || (start <= end && stdex::islbreak(text[start - 1]));
+
649 if ((r && !m_invert) || (!r && m_invert)) {
+
650 this->interval.end = this->interval.start = start;
+
651 return true;
+
652 }
+
653 this->interval.invalidate();
+
654 return false;
+
655 }
+
656
+
657 bool m_invert;
+
658 };
-
658
-
659 using bol = basic_bol<char>;
-
660 using wbol = basic_bol<wchar_t>;
-
661#ifdef _UNICODE
-
662 using tbol = wbol;
-
663#else
-
664 using tbol = bol;
-
665#endif
- -
667
-
671 template <class T>
-
-
672 class basic_eol : public basic_parser<T>
-
673 {
-
674 public:
-
675 basic_eol(bool invert = false) : m_invert(invert) {}
-
676
-
677 protected:
-
678 virtual bool do_match(
-
679 _In_reads_or_z_opt_(end) const T* text,
-
680 _In_ size_t start = 0,
-
681 _In_ size_t end = SIZE_MAX,
-
682 _In_ int flags = match_default)
-
683 {
-
684 _Assume_(text || start >= end);
-
685 bool r = start >= end || !text[start] || stdex::islbreak(text[start]);
-
686 if ((r && !m_invert) || (!r && m_invert)) {
-
687 this->interval.end = this->interval.start = start;
-
688 return true;
-
689 }
-
690 this->interval.invalidate();
-
691 return false;
-
692 }
-
693
-
694 bool m_invert;
-
695 };
+
659
+
660 using bol = basic_bol<char>;
+
661 using wbol = basic_bol<wchar_t>;
+
662#ifdef _UNICODE
+
663 using tbol = wbol;
+
664#else
+
665 using tbol = bol;
+
666#endif
+ +
668
+
672 template <class T>
+
+
673 class basic_eol : public basic_parser<T>
+
674 {
+
675 public:
+
676 basic_eol(bool invert = false) : m_invert(invert) {}
+
677
+
678 protected:
+
679 virtual bool do_match(
+
680 _In_reads_or_z_opt_(end) const T* text,
+
681 _In_ size_t start = 0,
+
682 _In_ size_t end = SIZE_MAX,
+
683 _In_ int flags = match_default)
+
684 {
+
685 _Assume_(text || start >= end);
+
686 bool r = start >= end || !text[start] || stdex::islbreak(text[start]);
+
687 if ((r && !m_invert) || (!r && m_invert)) {
+
688 this->interval.end = this->interval.start = start;
+
689 return true;
+
690 }
+
691 this->interval.invalidate();
+
692 return false;
+
693 }
+
694
+
695 bool m_invert;
+
696 };
-
696
-
697 using eol = basic_eol<char>;
-
698 using weol = basic_eol<wchar_t>;
-
699#ifdef _UNICODE
-
700 using teol = weol;
-
701#else
-
702 using teol = eol;
-
703#endif
- -
705
-
706 template <class T>
-
-
707 class basic_set : public basic_parser<T>
-
708 {
-
709 public:
-
710 basic_set(bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
712 hit_offset(SIZE_MAX),
-
713 m_invert(invert)
-
714 {}
-
715
-
716 virtual void invalidate()
-
717 {
-
718 hit_offset = SIZE_MAX;
- -
720 }
-
721
-
722 size_t hit_offset;
-
723
-
724 protected:
-
725 virtual bool do_match(
-
726 _In_reads_or_z_opt_(end) const T* text,
-
727 _In_ size_t start = 0,
-
728 _In_ size_t end = SIZE_MAX,
-
729 _In_ int flags = match_default) = 0;
-
730
-
731 bool m_invert;
-
732 };
+
697
+
698 using eol = basic_eol<char>;
+
699 using weol = basic_eol<wchar_t>;
+
700#ifdef _UNICODE
+
701 using teol = weol;
+
702#else
+
703 using teol = eol;
+
704#endif
+ +
706
+
707 template <class T>
+
+
708 class basic_set : public basic_parser<T>
+
709 {
+
710 public:
+
711 basic_set(bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
713 hit_offset(SIZE_MAX),
+
714 m_invert(invert)
+
715 {}
+
716
+
717 virtual void invalidate()
+
718 {
+
719 hit_offset = SIZE_MAX;
+ +
721 }
+
722
+
723 size_t hit_offset;
+
724
+
725 protected:
+
726 virtual bool do_match(
+
727 _In_reads_or_z_opt_(end) const T* text,
+
728 _In_ size_t start = 0,
+
729 _In_ size_t end = SIZE_MAX,
+
730 _In_ int flags = match_default) = 0;
+
731
+
732 bool m_invert;
+
733 };
-
733
-
737 template <class T>
-
-
738 class basic_cu_set : public basic_set<T>
-
739 {
-
740 public:
- -
742 _In_reads_or_z_(count) const T* set,
-
743 _In_ size_t count = SIZE_MAX,
-
744 _In_ bool invert = false,
-
745 _In_ const std::locale& locale = std::locale()) :
- -
747 {
-
748 if (set)
-
749 m_set.assign(set, set + stdex::strnlen(set, count));
-
750 }
-
751
-
752 protected:
-
753 virtual bool do_match(
-
754 _In_reads_or_z_opt_(end) const T* text,
-
755 _In_ size_t start = 0,
-
756 _In_ size_t end = SIZE_MAX,
-
757 _In_ int flags = match_default)
-
758 {
-
759 _Assume_(text || start >= end);
-
760 if (start < end && text[start]) {
-
761 const T* set = m_set.data();
-
762 size_t r = (flags & match_case_insensitive) ?
-
763 stdex::strnichr(set, m_set.size(), text[start], this->m_locale) :
-
764 stdex::strnchr(set, m_set.size(), text[start]);
-
765 if ((r != stdex::npos && !this->m_invert) || (r == stdex::npos && this->m_invert)) {
-
766 this->hit_offset = r;
-
767 this->interval.end = (this->interval.start = start) + 1;
-
768 return true;
-
769 }
-
770 }
-
771 this->hit_offset = SIZE_MAX;
-
772 this->interval.invalidate();
-
773 return false;
-
774 }
-
775
-
776 std::basic_string<T> m_set;
-
777 };
+
734
+
738 template <class T>
+
+
739 class basic_cu_set : public basic_set<T>
+
740 {
+
741 public:
+ +
743 _In_reads_or_z_(count) const T* set,
+
744 _In_ size_t count = SIZE_MAX,
+
745 _In_ bool invert = false,
+
746 _In_ const std::locale& locale = std::locale()) :
+ +
748 {
+
749 if (set)
+
750 m_set.assign(set, set + stdex::strnlen(set, count));
+
751 }
+
752
+
753 protected:
+
754 virtual bool do_match(
+
755 _In_reads_or_z_opt_(end) const T* text,
+
756 _In_ size_t start = 0,
+
757 _In_ size_t end = SIZE_MAX,
+
758 _In_ int flags = match_default)
+
759 {
+
760 _Assume_(text || start >= end);
+
761 if (start < end && text[start]) {
+
762 const T* set = m_set.data();
+
763 size_t r = (flags & match_case_insensitive) ?
+
764 stdex::strnichr(set, m_set.size(), text[start], this->m_locale) :
+
765 stdex::strnchr(set, m_set.size(), text[start]);
+
766 if ((r != stdex::npos && !this->m_invert) || (r == stdex::npos && this->m_invert)) {
+
767 this->hit_offset = r;
+
768 this->interval.end = (this->interval.start = start) + 1;
+
769 return true;
+
770 }
+
771 }
+
772 this->hit_offset = SIZE_MAX;
+
773 this->interval.invalidate();
+
774 return false;
+
775 }
+
776
+
777 std::basic_string<T> m_set;
+
778 };
-
778
- - -
781#ifdef _UNICODE
-
782 using tcu_set = wcu_set;
-
783#else
-
784 using tcu_set = cu_set;
-
785#endif
-
786
-
-
790 class sgml_cp_set : public basic_set<char>
-
791 {
-
792 public:
-
793 sgml_cp_set(const char* set, size_t count = SIZE_MAX, bool invert = false, _In_ const std::locale& locale = std::locale()) :
- -
795 {
-
796 if (set)
-
797 m_set = sgml2str(set, count);
-
798 }
-
799
-
800 protected:
-
801 virtual bool do_match(
-
802 _In_reads_or_z_(end) const char* text,
-
803 _In_ size_t start = 0,
-
804 _In_ size_t end = SIZE_MAX,
-
805 _In_ int flags = match_default)
-
806 {
-
807 _Assume_(text || start >= end);
-
808 if (start < end && text[start]) {
-
809 wchar_t buf[3];
-
810 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
811 const wchar_t* set = m_set.data();
-
812 size_t r = (flags & match_case_insensitive) ?
-
813 stdex::strnistr(set, m_set.size(), chr, m_locale) :
-
814 stdex::strnstr(set, m_set.size(), chr);
-
815 if ((r != stdex::npos && !m_invert) || (r == stdex::npos && m_invert)) {
-
816 hit_offset = r;
-
817 this->interval.start = start;
-
818 return true;
-
819 }
-
820 }
-
821 hit_offset = SIZE_MAX;
-
822 this->interval.invalidate();
-
823 return false;
-
824 }
-
825
-
826 std::wstring m_set;
-
827 };
+
779
+ + +
782#ifdef _UNICODE
+
783 using tcu_set = wcu_set;
+
784#else
+
785 using tcu_set = cu_set;
+
786#endif
+
787
+
+
791 class sgml_cp_set : public basic_set<char>
+
792 {
+
793 public:
+
794 sgml_cp_set(const char* set, size_t count = SIZE_MAX, bool invert = false, _In_ const std::locale& locale = std::locale()) :
+ +
796 {
+
797 if (set)
+
798 m_set = sgml2str(set, count);
+
799 }
+
800
+
801 protected:
+
802 virtual bool do_match(
+
803 _In_reads_or_z_(end) const char* text,
+
804 _In_ size_t start = 0,
+
805 _In_ size_t end = SIZE_MAX,
+
806 _In_ int flags = match_default)
+
807 {
+
808 _Assume_(text || start >= end);
+
809 if (start < end && text[start]) {
+
810 wchar_t buf[3];
+
811 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
812 const wchar_t* set = m_set.data();
+
813 size_t r = (flags & match_case_insensitive) ?
+
814 stdex::strnistr(set, m_set.size(), chr, m_locale) :
+
815 stdex::strnstr(set, m_set.size(), chr);
+
816 if ((r != stdex::npos && !m_invert) || (r == stdex::npos && m_invert)) {
+
817 hit_offset = r;
+
818 this->interval.start = start;
+
819 return true;
+
820 }
+
821 }
+
822 hit_offset = SIZE_MAX;
+
823 this->interval.invalidate();
+
824 return false;
+
825 }
+
826
+
827 std::wstring m_set;
+
828 };
-
828
-
832 template <class T>
-
-
833 class basic_string : public basic_parser<T>
-
834 {
-
835 public:
- -
837 _In_reads_or_z_(count) const T* str,
-
838 _In_ size_t count = SIZE_MAX,
-
839 _In_ const std::locale& locale = std::locale()) :
- -
841 m_str(str, str + stdex::strnlen(str, count))
-
842 {}
-
843
-
844 protected:
-
845 virtual bool do_match(
-
846 _In_reads_or_z_opt_(end) const T* text,
-
847 _In_ size_t start = 0,
-
848 _In_ size_t end = SIZE_MAX,
-
849 _In_ int flags = match_default)
-
850 {
-
851 _Assume_(text || start >= end);
-
852 size_t
-
853 m = m_str.size(),
-
854 n = std::min<size_t>(end - start, m);
-
855 bool r = ((flags & match_case_insensitive) ?
-
856 stdex::strnicmp(text + start, n, m_str.data(), m, this->m_locale) :
-
857 stdex::strncmp(text + start, n, m_str.data(), m)) == 0;
-
858 if (r) {
-
859 this->interval.end = (this->interval.start = start) + n;
-
860 return true;
-
861 }
-
862 this->interval.invalidate();
-
863 return false;
-
864 }
-
865
-
866 std::basic_string<T> m_str;
-
867 };
+
829
+
833 template <class T>
+
+
834 class basic_string : public basic_parser<T>
+
835 {
+
836 public:
+ +
838 _In_reads_or_z_(count) const T* str,
+
839 _In_ size_t count = SIZE_MAX,
+
840 _In_ const std::locale& locale = std::locale()) :
+ +
842 m_str(str, str + stdex::strnlen(str, count))
+
843 {}
+
844
+
845 protected:
+
846 virtual bool do_match(
+
847 _In_reads_or_z_opt_(end) const T* text,
+
848 _In_ size_t start = 0,
+
849 _In_ size_t end = SIZE_MAX,
+
850 _In_ int flags = match_default)
+
851 {
+
852 _Assume_(text || start >= end);
+
853 size_t
+
854 m = m_str.size(),
+
855 n = std::min<size_t>(end - start, m);
+
856 bool r = ((flags & match_case_insensitive) ?
+
857 stdex::strnicmp(text + start, n, m_str.data(), m, this->m_locale) :
+
858 stdex::strncmp(text + start, n, m_str.data(), m)) == 0;
+
859 if (r) {
+
860 this->interval.end = (this->interval.start = start) + n;
+
861 return true;
+
862 }
+
863 this->interval.invalidate();
+
864 return false;
+
865 }
+
866
+
867 std::basic_string<T> m_str;
+
868 };
-
868
- - -
871#ifdef _UNICODE
-
872 using tstring = wstring;
-
873#else
-
874 using tstring = string;
-
875#endif
-
876
-
- -
881 {
-
882 public:
-
883 sgml_string(const char* str, size_t count = SIZE_MAX, _In_ const std::locale& locale = std::locale()) :
- -
885 m_str(sgml2str(str, count))
-
886 {}
-
887
-
888 protected:
-
889 virtual bool do_match(
-
890 _In_reads_or_z_(end) const char* text,
-
891 _In_ size_t start = 0,
-
892 _In_ size_t end = SIZE_MAX,
-
893 _In_ int flags = match_default)
-
894 {
-
895 _Assume_(text || start >= end);
-
896 const wchar_t* str = m_str.data();
-
897 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
898 const auto& ctype = std::use_facet<std::ctype<wchar_t>>(m_locale);
-
899 for (this->interval.end = start;;) {
-
900 if (!*str) {
-
901 this->interval.start = start;
-
902 return true;
-
903 }
-
904 if (this->interval.end >= end || !text[this->interval.end]) {
-
905 this->interval.invalidate();
-
906 return false;
-
907 }
-
908 wchar_t buf[3];
-
909 const wchar_t* chr = next_sgml_cp(text, this->interval.end, end, this->interval.end, buf);
-
910 for (; *chr; ++str, ++chr) {
-
911 if (!*str ||
-
912 (case_insensitive ? ctype.tolower(*str) != ctype.tolower(*chr) : *str != *chr))
-
913 {
-
914 this->interval.invalidate();
-
915 return false;
-
916 }
-
917 }
-
918 }
-
919 }
-
920
-
921 std::wstring m_str;
-
922 };
+
869
+ + +
872#ifdef _UNICODE
+
873 using tstring = wstring;
+
874#else
+
875 using tstring = string;
+
876#endif
+
877
+
+ +
882 {
+
883 public:
+
884 sgml_string(const char* str, size_t count = SIZE_MAX, _In_ const std::locale& locale = std::locale()) :
+ +
886 m_str(sgml2str(str, count))
+
887 {}
+
888
+
889 protected:
+
890 virtual bool do_match(
+
891 _In_reads_or_z_(end) const char* text,
+
892 _In_ size_t start = 0,
+
893 _In_ size_t end = SIZE_MAX,
+
894 _In_ int flags = match_default)
+
895 {
+
896 _Assume_(text || start >= end);
+
897 const wchar_t* str = m_str.data();
+
898 const bool case_insensitive = flags & match_case_insensitive ? true : false;
+
899 const auto& ctype = std::use_facet<std::ctype<wchar_t>>(m_locale);
+
900 for (this->interval.end = start;;) {
+
901 if (!*str) {
+
902 this->interval.start = start;
+
903 return true;
+
904 }
+
905 if (this->interval.end >= end || !text[this->interval.end]) {
+
906 this->interval.invalidate();
+
907 return false;
+
908 }
+
909 wchar_t buf[3];
+
910 const wchar_t* chr = next_sgml_cp(text, this->interval.end, end, this->interval.end, buf);
+
911 for (; *chr; ++str, ++chr) {
+
912 if (!*str ||
+
913 (case_insensitive ? ctype.tolower(*str) != ctype.tolower(*chr) : *str != *chr))
+
914 {
+
915 this->interval.invalidate();
+
916 return false;
+
917 }
+
918 }
+
919 }
+
920 }
+
921
+
922 std::wstring m_str;
+
923 };
-
923
-
927 template <class T>
-
- -
929 {
-
930 public:
-
931 basic_iterations(const std::shared_ptr<basic_parser<T>>& el, size_t min_iterations = 0, size_t max_iterations = SIZE_MAX, bool greedy = true) :
-
932 m_el(el),
- - - -
936 {}
-
937
-
938 protected:
-
939 virtual bool do_match(
-
940 _In_reads_or_z_opt_(end) const T* text,
-
941 _In_ size_t start = 0,
-
942 _In_ size_t end = SIZE_MAX,
-
943 _In_ int flags = match_default)
-
944 {
-
945 _Assume_(text || start >= end);
-
946 this->interval.start = this->interval.end = start;
-
947 for (size_t i = 0; ; i++) {
-
948 if ((!m_greedy && i >= m_min_iterations) || i >= m_max_iterations)
-
949 return true;
-
950 if (!m_el->match(text, this->interval.end, end, flags)) {
-
951 if (i >= m_min_iterations)
-
952 return true;
-
953 break;
-
954 }
-
955 if (m_el->interval.end == this->interval.end) {
-
956 // Element did match, but the matching interval was empty. Quit instead of spinning.
-
957 return true;
-
958 }
-
959 this->interval.end = m_el->interval.end;
-
960 }
-
961 this->interval.invalidate();
-
962 return false;
-
963 }
-
964
-
965 std::shared_ptr<basic_parser<T>> m_el;
- - -
968 bool m_greedy;
-
969 };
+
924
+
928 template <class T>
+
+ +
930 {
+
931 public:
+
932 basic_iterations(const std::shared_ptr<basic_parser<T>>& el, size_t min_iterations = 0, size_t max_iterations = SIZE_MAX, bool greedy = true) :
+
933 m_el(el),
+ + + +
937 {}
+
938
+
939 protected:
+
940 virtual bool do_match(
+
941 _In_reads_or_z_opt_(end) const T* text,
+
942 _In_ size_t start = 0,
+
943 _In_ size_t end = SIZE_MAX,
+
944 _In_ int flags = match_default)
+
945 {
+
946 _Assume_(text || start >= end);
+
947 this->interval.start = this->interval.end = start;
+
948 for (size_t i = 0; ; i++) {
+
949 if ((!m_greedy && i >= m_min_iterations) || i >= m_max_iterations)
+
950 return true;
+
951 if (!m_el->match(text, this->interval.end, end, flags)) {
+
952 if (i >= m_min_iterations)
+
953 return true;
+
954 break;
+
955 }
+
956 if (m_el->interval.end == this->interval.end) {
+
957 // Element did match, but the matching interval was empty. Quit instead of spinning.
+
958 return true;
+
959 }
+
960 this->interval.end = m_el->interval.end;
+
961 }
+
962 this->interval.invalidate();
+
963 return false;
+
964 }
+
965
+
966 std::shared_ptr<basic_parser<T>> m_el;
+ + +
969 bool m_greedy;
+
970 };
-
970
- - -
973#ifdef _UNICODE
-
974 using titerations = witerations;
-
975#else
-
976 using titerations = iterations;
-
977#endif
- -
979
-
983 template <class T>
-
- -
985 {
-
986 protected:
-
987 parser_collection(_In_ const std::locale& locale) : basic_parser<T>(locale) {}
-
988
-
989 public:
- -
991 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el,
-
992 _In_ size_t count,
-
993 _In_ const std::locale& locale = std::locale()) :
- -
995 {
-
996 _Assume_(el || !count);
-
997 m_collection.reserve(count);
-
998 for (size_t i = 0; i < count; i++)
-
999 m_collection.push_back(el[i]);
-
1000 }
-
1001
- -
1003 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
-
1004 _In_ const std::locale& locale = std::locale()) :
- -
1006 m_collection(std::move(collection))
-
1007 {}
-
1008
-
1009 virtual void invalidate()
-
1010 {
-
1011 for (auto& el : m_collection)
-
1012 el->invalidate();
- -
1014 }
-
1015
-
1016 protected:
-
1017 std::vector<std::shared_ptr<basic_parser<T>>> m_collection;
-
1018 };
+
971
+ + +
974#ifdef _UNICODE
+
975 using titerations = witerations;
+
976#else
+
977 using titerations = iterations;
+
978#endif
+ +
980
+
984 template <class T>
+
+ +
986 {
+
987 protected:
+
988 parser_collection(_In_ const std::locale& locale) : basic_parser<T>(locale) {}
+
989
+
990 public:
+ +
992 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el,
+
993 _In_ size_t count,
+
994 _In_ const std::locale& locale = std::locale()) :
+ +
996 {
+
997 _Assume_(el || !count);
+
998 m_collection.reserve(count);
+
999 for (size_t i = 0; i < count; i++)
+
1000 m_collection.push_back(el[i]);
+
1001 }
+
1002
+ +
1004 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
+
1005 _In_ const std::locale& locale = std::locale()) :
+ +
1007 m_collection(std::move(collection))
+
1008 {}
+
1009
+
1010 virtual void invalidate()
+
1011 {
+
1012 for (auto& el : m_collection)
+
1013 el->invalidate();
+ +
1015 }
+
1016
+
1017 protected:
+
1018 std::vector<std::shared_ptr<basic_parser<T>>> m_collection;
+
1019 };
-
1019
-
1023 template <class T>
-
- -
1025 {
-
1026 public:
- -
1028 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el = nullptr,
-
1029 _In_ size_t count = 0,
-
1030 _In_ const std::locale& locale = std::locale()) :
- -
1032 {}
-
1033
- -
1035 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
-
1036 _In_ const std::locale& locale = std::locale()) :
- -
1038 {}
-
1039
-
1040 protected:
-
1041 virtual bool do_match(
-
1042 _In_reads_or_z_opt_(end) const T* text,
-
1043 _In_ size_t start = 0,
-
1044 _In_ size_t end = SIZE_MAX,
-
1045 _In_ int flags = match_default)
-
1046 {
-
1047 _Assume_(text || start >= end);
-
1048 this->interval.end = start;
-
1049 for (auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i) {
-
1050 if (!(*i)->match(text, this->interval.end, end, flags)) {
-
1051 for (++i; i != this->m_collection.end(); ++i)
-
1052 (*i)->invalidate();
-
1053 this->interval.invalidate();
-
1054 return false;
-
1055 }
-
1056 this->interval.end = (*i)->interval.end;
-
1057 }
-
1058 this->interval.start = start;
-
1059 return true;
-
1060 }
-
1061 };
+
1020
+
1024 template <class T>
+
+ +
1026 {
+
1027 public:
+ +
1029 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el = nullptr,
+
1030 _In_ size_t count = 0,
+
1031 _In_ const std::locale& locale = std::locale()) :
+ +
1033 {}
+
1034
+ +
1036 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
+
1037 _In_ const std::locale& locale = std::locale()) :
+ +
1039 {}
+
1040
+
1041 protected:
+
1042 virtual bool do_match(
+
1043 _In_reads_or_z_opt_(end) const T* text,
+
1044 _In_ size_t start = 0,
+
1045 _In_ size_t end = SIZE_MAX,
+
1046 _In_ int flags = match_default)
+
1047 {
+
1048 _Assume_(text || start >= end);
+
1049 this->interval.end = start;
+
1050 for (auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i) {
+
1051 if (!(*i)->match(text, this->interval.end, end, flags)) {
+
1052 for (++i; i != this->m_collection.end(); ++i)
+
1053 (*i)->invalidate();
+
1054 this->interval.invalidate();
+
1055 return false;
+
1056 }
+
1057 this->interval.end = (*i)->interval.end;
+
1058 }
+
1059 this->interval.start = start;
+
1060 return true;
+
1061 }
+
1062 };
-
1062
- - -
1065#ifdef _UNICODE
-
1066 using tsequence = wsequence;
-
1067#else
-
1068 using tsequence = sequence;
-
1069#endif
- -
1071
-
1075 template <class T>
-
- -
1077 {
-
1078 protected:
-
1079 basic_branch(_In_ const std::locale& locale) :
- -
1081 hit_offset(SIZE_MAX)
-
1082 {}
-
1083
-
1084 public:
- -
1086 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el = nullptr,
-
1087 _In_ size_t count = 0,
-
1088 _In_ const std::locale& locale = std::locale()) :
- -
1090 hit_offset(SIZE_MAX)
-
1091 {}
-
1092
- -
1094 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
-
1095 _In_ const std::locale& locale = std::locale()) :
- -
1097 hit_offset(SIZE_MAX)
-
1098 {}
-
1099
-
1100 virtual void invalidate()
-
1101 {
-
1102 hit_offset = SIZE_MAX;
- -
1104 }
-
1105
-
1106 size_t hit_offset;
-
1107
-
1108 protected:
-
1109 virtual bool do_match(
-
1110 _In_reads_or_z_opt_(end) const T* text,
-
1111 _In_ size_t start = 0,
-
1112 _In_ size_t end = SIZE_MAX,
-
1113 _In_ int flags = match_default)
-
1114 {
-
1115 _Assume_(text || start >= end);
-
1116 hit_offset = 0;
-
1117 for (auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i, ++hit_offset) {
-
1118 if ((*i)->match(text, start, end, flags)) {
-
1119 this->interval = (*i)->interval;
-
1120 for (++i; i != this->m_collection.end(); ++i)
-
1121 (*i)->invalidate();
-
1122 return true;
-
1123 }
-
1124 }
-
1125 hit_offset = SIZE_MAX;
-
1126 this->interval.invalidate();
-
1127 return false;
-
1128 }
-
1129 };
+
1063
+ + +
1066#ifdef _UNICODE
+
1067 using tsequence = wsequence;
+
1068#else
+
1069 using tsequence = sequence;
+
1070#endif
+ +
1072
+
1076 template <class T>
+
+ +
1078 {
+
1079 protected:
+
1080 basic_branch(_In_ const std::locale& locale) :
+ +
1082 hit_offset(SIZE_MAX)
+
1083 {}
+
1084
+
1085 public:
+ +
1087 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el = nullptr,
+
1088 _In_ size_t count = 0,
+
1089 _In_ const std::locale& locale = std::locale()) :
+ +
1091 hit_offset(SIZE_MAX)
+
1092 {}
+
1093
+ +
1095 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
+
1096 _In_ const std::locale& locale = std::locale()) :
+ +
1098 hit_offset(SIZE_MAX)
+
1099 {}
+
1100
+
1101 virtual void invalidate()
+
1102 {
+
1103 hit_offset = SIZE_MAX;
+ +
1105 }
+
1106
+
1107 size_t hit_offset;
+
1108
+
1109 protected:
+
1110 virtual bool do_match(
+
1111 _In_reads_or_z_opt_(end) const T* text,
+
1112 _In_ size_t start = 0,
+
1113 _In_ size_t end = SIZE_MAX,
+
1114 _In_ int flags = match_default)
+
1115 {
+
1116 _Assume_(text || start >= end);
+
1117 hit_offset = 0;
+
1118 for (auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i, ++hit_offset) {
+
1119 if ((*i)->match(text, start, end, flags)) {
+
1120 this->interval = (*i)->interval;
+
1121 for (++i; i != this->m_collection.end(); ++i)
+
1122 (*i)->invalidate();
+
1123 return true;
+
1124 }
+
1125 }
+
1126 hit_offset = SIZE_MAX;
+
1127 this->interval.invalidate();
+
1128 return false;
+
1129 }
+
1130 };
-
1130
-
1131 using branch = basic_branch<char>;
- -
1133#ifdef _UNICODE
-
1134 using tbranch = wbranch;
-
1135#else
-
1136 using tbranch = branch;
-
1137#endif
- -
1139
-
1143 template <class T, class T_parser = basic_string<T>>
-
- -
1145 {
-
1146 public:
- -
1148 _In_reads_(count) const T* str_z = nullptr,
-
1149 _In_ size_t count = 0,
-
1150 _In_ const std::locale& locale = std::locale()) :
- -
1152 {
-
1153 build(str_z, count);
-
1154 }
-
1155
-
1156 basic_string_branch(_In_z_ const T* str, ...) :
-
1157 basic_branch<T>(std::locale())
-
1158 {
-
1159 va_list params;
-
1160 va_start(params, str);
-
1161 build(str, params);
-
1162 va_end(params);
-
1163 }
-
1164
-
1165 basic_string_branch(_In_ const std::locale& locale, _In_z_ const T* str, ...) :
- -
1167 {
-
1168 va_list params;
-
1169 va_start(params, str);
-
1170 build(str, params);
-
1171 va_end(params);
-
1172 }
-
1173
-
1174 protected:
-
1175 void build(_In_reads_(count) const T* str_z, _In_ size_t count)
-
1176 {
-
1177 _Assume_(str_z || !count);
-
1178 if (count) {
-
1179 size_t offset, n;
-
1180 for (
-
1181 offset = n = 0;
-
1182 offset < count && str_z[offset];
-
1183 offset += stdex::strnlen(str_z + offset, count - offset) + 1, ++n);
-
1184 this->m_collection.reserve(n);
-
1185 for (
-
1186 offset = 0;
-
1187 offset < count && str_z[offset];
-
1188 offset += stdex::strnlen(str_z + offset, count - offset) + 1)
-
1189 this->m_collection.push_back(std::move(std::make_shared<T_parser>(str_z + offset, count - offset, this->m_locale)));
-
1190 }
-
1191 }
-
1192
-
1193 void build(_In_z_ const T* str, _In_ va_list params)
-
1194 {
-
1195 const T* p;
-
1196 for (
-
1197 this->m_collection.push_back(std::move(std::make_shared<T_parser>(str, SIZE_MAX, this->m_locale)));
-
1198 (p = va_arg(params, const T*)) != nullptr;
-
1199 this->m_collection.push_back(std::move(std::make_shared<T_parser>(p, SIZE_MAX, this->m_locale))));
-
1200 }
-
1201 };
+
1131
+
1132 using branch = basic_branch<char>;
+ +
1134#ifdef _UNICODE
+
1135 using tbranch = wbranch;
+
1136#else
+
1137 using tbranch = branch;
+
1138#endif
+ +
1140
+
1144 template <class T, class T_parser = basic_string<T>>
+
+ +
1146 {
+
1147 public:
+ +
1149 _In_reads_(count) const T* str_z = nullptr,
+
1150 _In_ size_t count = 0,
+
1151 _In_ const std::locale& locale = std::locale()) :
+ +
1153 {
+
1154 build(str_z, count);
+
1155 }
+
1156
+
1157 basic_string_branch(_In_z_ const T* str, ...) :
+
1158 basic_branch<T>(std::locale())
+
1159 {
+
1160 va_list params;
+
1161 va_start(params, str);
+
1162 build(str, params);
+
1163 va_end(params);
+
1164 }
+
1165
+
1166 basic_string_branch(_In_ const std::locale& locale, _In_z_ const T* str, ...) :
+ +
1168 {
+
1169 va_list params;
+
1170 va_start(params, str);
+
1171 build(str, params);
+
1172 va_end(params);
+
1173 }
+
1174
+
1175 protected:
+
1176 void build(_In_reads_(count) const T* str_z, _In_ size_t count)
+
1177 {
+
1178 _Assume_(str_z || !count);
+
1179 if (count) {
+
1180 size_t offset, n;
+
1181 for (
+
1182 offset = n = 0;
+
1183 offset < count && str_z[offset];
+
1184 offset += stdex::strnlen(str_z + offset, count - offset) + 1, ++n);
+
1185 this->m_collection.reserve(n);
+
1186 for (
+
1187 offset = 0;
+
1188 offset < count && str_z[offset];
+
1189 offset += stdex::strnlen(str_z + offset, count - offset) + 1)
+
1190 this->m_collection.push_back(std::move(std::make_shared<T_parser>(str_z + offset, count - offset, this->m_locale)));
+
1191 }
+
1192 }
+
1193
+
1194 void build(_In_z_ const T* str, _In_ va_list params)
+
1195 {
+
1196 const T* p;
+
1197 for (
+
1198 this->m_collection.push_back(std::move(std::make_shared<T_parser>(str, SIZE_MAX, this->m_locale)));
+
1199 (p = va_arg(params, const T*)) != nullptr;
+
1200 this->m_collection.push_back(std::move(std::make_shared<T_parser>(p, SIZE_MAX, this->m_locale))));
+
1201 }
+
1202 };
-
1202
- - -
1205#ifdef _UNICODE
- -
1207#else
- -
1209#endif
- -
1211
-
1215 template <class T>
-
- -
1217 {
-
1218 public:
- -
1220 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el = nullptr,
-
1221 _In_ size_t count = 0,
-
1222 _In_ const std::locale& locale = std::locale()) :
- -
1224 {}
-
1225
- -
1227 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
-
1228 _In_ const std::locale& locale = std::locale()) :
- -
1230 {}
-
1231
-
1232 protected:
-
1233 virtual bool do_match(
-
1234 _In_reads_or_z_opt_(end) const T* text,
-
1235 _In_ size_t start = 0,
-
1236 _In_ size_t end = SIZE_MAX,
-
1237 _In_ int flags = match_default)
-
1238 {
-
1239 _Assume_(text || start >= end);
-
1240 for (auto& el : this->m_collection)
-
1241 el->invalidate();
-
1242 if (match_recursively(text, start, end, flags)) {
-
1243 this->interval.start = start;
-
1244 return true;
-
1245 }
-
1246 this->interval.invalidate();
-
1247 return false;
-
1248 }
-
1249
-
1250 bool match_recursively(
-
1251 _In_reads_or_z_opt_(end) const T* text,
-
1252 _In_ size_t start = 0,
-
1253 _In_ size_t end = SIZE_MAX,
-
1254 _In_ int flags = match_default)
-
1255 {
-
1256 bool all_matched = true;
-
1257 for (auto& el : this->m_collection) {
-
1258 if (!el->interval) {
-
1259 // Element was not matched in permutatuion yet.
-
1260 all_matched = false;
-
1261 if (el->match(text, start, end, flags)) {
-
1262 // Element matched for the first time.
-
1263 if (match_recursively(text, el->interval.end, end, flags)) {
-
1264 // Rest of the elements matched too.
-
1265 return true;
-
1266 }
-
1267 el->invalidate();
-
1268 }
-
1269 }
-
1270 }
-
1271 if (all_matched) {
-
1272 this->interval.end = start;
-
1273 return true;
-
1274 }
-
1275 return false;
-
1276 }
-
1277 };
+
1203
+ + +
1206#ifdef _UNICODE
+ +
1208#else
+ +
1210#endif
+ +
1212
+
1216 template <class T>
+
+ +
1218 {
+
1219 public:
+ +
1221 _In_count_(count) const std::shared_ptr<basic_parser<T>>* el = nullptr,
+
1222 _In_ size_t count = 0,
+
1223 _In_ const std::locale& locale = std::locale()) :
+ +
1225 {}
+
1226
+ +
1228 _Inout_ std::vector<std::shared_ptr<basic_parser<T>>>&& collection,
+
1229 _In_ const std::locale& locale = std::locale()) :
+ +
1231 {}
+
1232
+
1233 protected:
+
1234 virtual bool do_match(
+
1235 _In_reads_or_z_opt_(end) const T* text,
+
1236 _In_ size_t start = 0,
+
1237 _In_ size_t end = SIZE_MAX,
+
1238 _In_ int flags = match_default)
+
1239 {
+
1240 _Assume_(text || start >= end);
+
1241 for (auto& el : this->m_collection)
+
1242 el->invalidate();
+
1243 if (match_recursively(text, start, end, flags)) {
+
1244 this->interval.start = start;
+
1245 return true;
+
1246 }
+
1247 this->interval.invalidate();
+
1248 return false;
+
1249 }
+
1250
+
1251 bool match_recursively(
+
1252 _In_reads_or_z_opt_(end) const T* text,
+
1253 _In_ size_t start = 0,
+
1254 _In_ size_t end = SIZE_MAX,
+
1255 _In_ int flags = match_default)
+
1256 {
+
1257 bool all_matched = true;
+
1258 for (auto& el : this->m_collection) {
+
1259 if (!el->interval) {
+
1260 // Element was not matched in permutatuion yet.
+
1261 all_matched = false;
+
1262 if (el->match(text, start, end, flags)) {
+
1263 // Element matched for the first time.
+
1264 if (match_recursively(text, el->interval.end, end, flags)) {
+
1265 // Rest of the elements matched too.
+
1266 return true;
+
1267 }
+
1268 el->invalidate();
+
1269 }
+
1270 }
+
1271 }
+
1272 if (all_matched) {
+
1273 this->interval.end = start;
+
1274 return true;
+
1275 }
+
1276 return false;
+
1277 }
+
1278 };
-
1278
- - -
1281#ifdef _UNICODE
-
1282 using tpermutation = wpermutation;
-
1283#else
-
1284 using tpermutation = permutation;
-
1285#endif
- -
1287
-
1291 template <class T>
-
-
1292 class basic_integer : public basic_parser<T>
-
1293 {
-
1294 public:
-
1295 basic_integer(_In_ const std::locale& locale = std::locale()) :
- -
1297 value(0)
-
1298 {}
-
1299
-
1300 virtual void invalidate()
-
1301 {
-
1302 value = 0;
- -
1304 }
-
1305
-
1306 public:
-
1307 size_t value;
-
1308 };
+
1279
+ + +
1282#ifdef _UNICODE
+
1283 using tpermutation = wpermutation;
+
1284#else
+
1285 using tpermutation = permutation;
+
1286#endif
+ +
1288
+
1292 template <class T>
+
+
1293 class basic_integer : public basic_parser<T>
+
1294 {
+
1295 public:
+
1296 basic_integer(_In_ const std::locale& locale = std::locale()) :
+ +
1298 value(0)
+
1299 {}
+
1300
+
1301 virtual void invalidate()
+
1302 {
+
1303 value = 0;
+ +
1305 }
+
1306
+
1307 public:
+
1308 size_t value;
+
1309 };
-
1309
-
1313 template <class T>
-
- -
1315 {
-
1316 public:
- -
1318 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
-
1319 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
-
1320 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
-
1321 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
-
1322 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
-
1323 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
-
1324 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
-
1325 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
-
1326 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
-
1327 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
-
1328 _In_ const std::locale& locale = std::locale()) :
- -
1330 m_digit_0(digit_0),
-
1331 m_digit_1(digit_1),
-
1332 m_digit_2(digit_2),
-
1333 m_digit_3(digit_3),
-
1334 m_digit_4(digit_4),
-
1335 m_digit_5(digit_5),
-
1336 m_digit_6(digit_6),
-
1337 m_digit_7(digit_7),
-
1338 m_digit_8(digit_8),
-
1339 m_digit_9(digit_9)
-
1340 {}
-
1341
-
1342 protected:
-
1343 virtual bool do_match(
-
1344 _In_reads_or_z_opt_(end) const T* text,
-
1345 _In_ size_t start = 0,
-
1346 _In_ size_t end = SIZE_MAX,
-
1347 _In_ int flags = match_default)
-
1348 {
-
1349 _Assume_(text || start >= end);
-
1350 for (this->interval.end = start, this->value = 0; this->interval.end < end && text[this->interval.end];) {
-
1351 size_t dig;
-
1352 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; this->interval.end = m_digit_0->interval.end; }
-
1353 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; this->interval.end = m_digit_1->interval.end; }
-
1354 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; this->interval.end = m_digit_2->interval.end; }
-
1355 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; this->interval.end = m_digit_3->interval.end; }
-
1356 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; this->interval.end = m_digit_4->interval.end; }
-
1357 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; this->interval.end = m_digit_5->interval.end; }
-
1358 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; this->interval.end = m_digit_6->interval.end; }
-
1359 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; this->interval.end = m_digit_7->interval.end; }
-
1360 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; this->interval.end = m_digit_8->interval.end; }
-
1361 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; this->interval.end = m_digit_9->interval.end; }
-
1362 else break;
-
1363 this->value = this->value * 10 + dig;
-
1364 }
- -
1366 this->interval.start = start;
-
1367 return true;
-
1368 }
-
1369 this->interval.invalidate();
-
1370 return false;
-
1371 }
-
1372
-
1373 std::shared_ptr<basic_parser<T>>
-
1374 m_digit_0,
-
1375 m_digit_1,
-
1376 m_digit_2,
-
1377 m_digit_3,
-
1378 m_digit_4,
-
1379 m_digit_5,
-
1380 m_digit_6,
-
1381 m_digit_7,
-
1382 m_digit_8,
-
1383 m_digit_9;
-
1384 };
+
1310
+
1314 template <class T>
+
+ +
1316 {
+
1317 public:
+ +
1319 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
+
1320 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
+
1321 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
+
1322 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
+
1323 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
+
1324 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
+
1325 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
+
1326 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
+
1327 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
+
1328 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
+
1329 _In_ const std::locale& locale = std::locale()) :
+ +
1331 m_digit_0(digit_0),
+
1332 m_digit_1(digit_1),
+
1333 m_digit_2(digit_2),
+
1334 m_digit_3(digit_3),
+
1335 m_digit_4(digit_4),
+
1336 m_digit_5(digit_5),
+
1337 m_digit_6(digit_6),
+
1338 m_digit_7(digit_7),
+
1339 m_digit_8(digit_8),
+
1340 m_digit_9(digit_9)
+
1341 {}
+
1342
+
1343 protected:
+
1344 virtual bool do_match(
+
1345 _In_reads_or_z_opt_(end) const T* text,
+
1346 _In_ size_t start = 0,
+
1347 _In_ size_t end = SIZE_MAX,
+
1348 _In_ int flags = match_default)
+
1349 {
+
1350 _Assume_(text || start >= end);
+
1351 for (this->interval.end = start, this->value = 0; this->interval.end < end && text[this->interval.end];) {
+
1352 size_t dig;
+
1353 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; this->interval.end = m_digit_0->interval.end; }
+
1354 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; this->interval.end = m_digit_1->interval.end; }
+
1355 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; this->interval.end = m_digit_2->interval.end; }
+
1356 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; this->interval.end = m_digit_3->interval.end; }
+
1357 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; this->interval.end = m_digit_4->interval.end; }
+
1358 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; this->interval.end = m_digit_5->interval.end; }
+
1359 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; this->interval.end = m_digit_6->interval.end; }
+
1360 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; this->interval.end = m_digit_7->interval.end; }
+
1361 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; this->interval.end = m_digit_8->interval.end; }
+
1362 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; this->interval.end = m_digit_9->interval.end; }
+
1363 else break;
+
1364 this->value = this->value * 10 + dig;
+
1365 }
+ +
1367 this->interval.start = start;
+
1368 return true;
+
1369 }
+
1370 this->interval.invalidate();
+
1371 return false;
+
1372 }
+
1373
+
1374 std::shared_ptr<basic_parser<T>>
+
1375 m_digit_0,
+
1376 m_digit_1,
+
1377 m_digit_2,
+
1378 m_digit_3,
+
1379 m_digit_4,
+
1380 m_digit_5,
+
1381 m_digit_6,
+
1382 m_digit_7,
+
1383 m_digit_8,
+
1384 m_digit_9;
+
1385 };
-
1385
- - -
1388#ifdef _UNICODE
-
1389 using tinteger10 = winteger10;
-
1390#else
-
1391 using tinteger10 = integer10;
-
1392#endif
- -
1394
-
1398 template <class T>
-
- -
1400 {
-
1401 public:
- -
1403 _In_ const std::shared_ptr<basic_integer10<T>>& digits,
-
1404 _In_ const std::shared_ptr<basic_set<T>>& separator,
-
1405 _In_ const std::locale& locale = std::locale()) :
- -
1407 digit_count(0),
-
1408 has_separators(false),
-
1409 m_digits(digits),
-
1410 m_separator(separator)
-
1411 {}
-
1412
-
1413 virtual void invalidate()
-
1414 {
-
1415 digit_count = 0;
-
1416 has_separators = false;
- -
1418 }
-
1419
- - -
1422
-
1423 protected:
-
1424 virtual bool do_match(
-
1425 _In_reads_or_z_opt_(end) const T* text,
-
1426 _In_ size_t start = 0,
-
1427 _In_ size_t end = SIZE_MAX,
-
1428 _In_ int flags = match_default)
-
1429 {
-
1430 _Assume_(text || start >= end);
-
1431 if (m_digits->match(text, start, end, flags)) {
-
1432 // Leading part match.
-
1433 this->value = m_digits->value;
-
1434 digit_count = m_digits->interval.size();
-
1435 has_separators = false;
-
1436 this->interval.start = start;
-
1437 this->interval.end = m_digits->interval.end;
-
1438 if (m_digits->interval.size() <= 3) {
-
1439 // Maybe separated with thousand separators?
-
1440 size_t hit_offset = SIZE_MAX;
-
1441 while (m_separator->match(text, this->interval.end, end, flags) &&
-
1442 (hit_offset == SIZE_MAX || hit_offset == m_separator->hit_offset) && // All separators must be the same, no mixing.
-
1443 m_digits->match(text, m_separator->interval.end, end, flags) &&
-
1444 m_digits->interval.size() == 3)
-
1445 {
-
1446 // Thousand separator and three-digit integer followed.
-
1447 this->value = this->value * 1000 + m_digits->value;
-
1448 digit_count += 3;
-
1449 has_separators = true;
-
1450 this->interval.end = m_digits->interval.end;
-
1451 hit_offset = m_separator->hit_offset;
-
1452 }
-
1453 }
-
1454
-
1455 return true;
-
1456 }
-
1457 this->value = 0;
-
1458 this->interval.invalidate();
-
1459 return false;
-
1460 }
-
1461
-
1462 std::shared_ptr<basic_integer10<T>> m_digits;
-
1463 std::shared_ptr<basic_set<T>> m_separator;
-
1464 };
+
1386
+ + +
1389#ifdef _UNICODE
+
1390 using tinteger10 = winteger10;
+
1391#else
+
1392 using tinteger10 = integer10;
+
1393#endif
+ +
1395
+
1399 template <class T>
+
+ +
1401 {
+
1402 public:
+ +
1404 _In_ const std::shared_ptr<basic_integer10<T>>& digits,
+
1405 _In_ const std::shared_ptr<basic_set<T>>& separator,
+
1406 _In_ const std::locale& locale = std::locale()) :
+ +
1408 digit_count(0),
+
1409 has_separators(false),
+
1410 m_digits(digits),
+
1411 m_separator(separator)
+
1412 {}
+
1413
+
1414 virtual void invalidate()
+
1415 {
+
1416 digit_count = 0;
+
1417 has_separators = false;
+ +
1419 }
+
1420
+ + +
1423
+
1424 protected:
+
1425 virtual bool do_match(
+
1426 _In_reads_or_z_opt_(end) const T* text,
+
1427 _In_ size_t start = 0,
+
1428 _In_ size_t end = SIZE_MAX,
+
1429 _In_ int flags = match_default)
+
1430 {
+
1431 _Assume_(text || start >= end);
+
1432 if (m_digits->match(text, start, end, flags)) {
+
1433 // Leading part match.
+
1434 this->value = m_digits->value;
+
1435 digit_count = m_digits->interval.size();
+
1436 has_separators = false;
+
1437 this->interval.start = start;
+
1438 this->interval.end = m_digits->interval.end;
+
1439 if (m_digits->interval.size() <= 3) {
+
1440 // Maybe separated with thousand separators?
+
1441 size_t hit_offset = SIZE_MAX;
+
1442 while (m_separator->match(text, this->interval.end, end, flags) &&
+
1443 (hit_offset == SIZE_MAX || hit_offset == m_separator->hit_offset) && // All separators must be the same, no mixing.
+
1444 m_digits->match(text, m_separator->interval.end, end, flags) &&
+
1445 m_digits->interval.size() == 3)
+
1446 {
+
1447 // Thousand separator and three-digit integer followed.
+
1448 this->value = this->value * 1000 + m_digits->value;
+
1449 digit_count += 3;
+
1450 has_separators = true;
+
1451 this->interval.end = m_digits->interval.end;
+
1452 hit_offset = m_separator->hit_offset;
+
1453 }
+
1454 }
+
1455
+
1456 return true;
+
1457 }
+
1458 this->value = 0;
+
1459 this->interval.invalidate();
+
1460 return false;
+
1461 }
+
1462
+
1463 std::shared_ptr<basic_integer10<T>> m_digits;
+
1464 std::shared_ptr<basic_set<T>> m_separator;
+
1465 };
-
1465
-
1466 using integer10ts = basic_integer10ts<char>;
-
1467 using winteger10ts = basic_integer10ts<wchar_t>;
-
1468#ifdef _UNICODE
-
1469 using tinteger10ts = winteger10ts;
-
1470#else
-
1471 using tinteger10ts = integer10ts;
-
1472#endif
-
1473 using sgml_integer10ts = basic_integer10ts<char>;
-
1474
-
1478 template <class T>
-
- -
1480 {
-
1481 public:
- -
1483 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
-
1484 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
-
1485 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
-
1486 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
-
1487 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
-
1488 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
-
1489 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
-
1490 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
-
1491 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
-
1492 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
-
1493 _In_ const std::shared_ptr<basic_parser<T>>& digit_10,
-
1494 _In_ const std::shared_ptr<basic_parser<T>>& digit_11,
-
1495 _In_ const std::shared_ptr<basic_parser<T>>& digit_12,
-
1496 _In_ const std::shared_ptr<basic_parser<T>>& digit_13,
-
1497 _In_ const std::shared_ptr<basic_parser<T>>& digit_14,
-
1498 _In_ const std::shared_ptr<basic_parser<T>>& digit_15,
-
1499 _In_ const std::locale& locale = std::locale()) :
- -
1501 m_digit_0(digit_0),
-
1502 m_digit_1(digit_1),
-
1503 m_digit_2(digit_2),
-
1504 m_digit_3(digit_3),
-
1505 m_digit_4(digit_4),
-
1506 m_digit_5(digit_5),
-
1507 m_digit_6(digit_6),
-
1508 m_digit_7(digit_7),
-
1509 m_digit_8(digit_8),
-
1510 m_digit_9(digit_9),
-
1511 m_digit_10(digit_10),
-
1512 m_digit_11(digit_11),
-
1513 m_digit_12(digit_12),
-
1514 m_digit_13(digit_13),
-
1515 m_digit_14(digit_14),
-
1516 m_digit_15(digit_15)
-
1517 {}
-
1518
-
1519 protected:
-
1520 virtual bool do_match(
-
1521 _In_reads_or_z_opt_(end) const T* text,
-
1522 _In_ size_t start = 0,
-
1523 _In_ size_t end = SIZE_MAX,
-
1524 _In_ int flags = match_default)
-
1525 {
-
1526 _Assume_(text || start >= end);
-
1527 for (this->interval.end = start, this->value = 0; this->interval.end < end && text[this->interval.end];) {
-
1528 size_t dig;
-
1529 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; this->interval.end = m_digit_0->interval.end; }
-
1530 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; this->interval.end = m_digit_1->interval.end; }
-
1531 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; this->interval.end = m_digit_2->interval.end; }
-
1532 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; this->interval.end = m_digit_3->interval.end; }
-
1533 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; this->interval.end = m_digit_4->interval.end; }
-
1534 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; this->interval.end = m_digit_5->interval.end; }
-
1535 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; this->interval.end = m_digit_6->interval.end; }
-
1536 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; this->interval.end = m_digit_7->interval.end; }
-
1537 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; this->interval.end = m_digit_8->interval.end; }
-
1538 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; this->interval.end = m_digit_9->interval.end; }
-
1539 else if (m_digit_10->match(text, this->interval.end, end, flags)) { dig = 10; this->interval.end = m_digit_10->interval.end; }
-
1540 else if (m_digit_11->match(text, this->interval.end, end, flags)) { dig = 11; this->interval.end = m_digit_11->interval.end; }
-
1541 else if (m_digit_12->match(text, this->interval.end, end, flags)) { dig = 12; this->interval.end = m_digit_12->interval.end; }
-
1542 else if (m_digit_13->match(text, this->interval.end, end, flags)) { dig = 13; this->interval.end = m_digit_13->interval.end; }
-
1543 else if (m_digit_14->match(text, this->interval.end, end, flags)) { dig = 14; this->interval.end = m_digit_14->interval.end; }
-
1544 else if (m_digit_15->match(text, this->interval.end, end, flags)) { dig = 15; this->interval.end = m_digit_15->interval.end; }
-
1545 else break;
-
1546 this->value = this->value * 16 + dig;
-
1547 }
- -
1549 this->interval.start = start;
-
1550 return true;
-
1551 }
-
1552 this->interval.invalidate();
-
1553 return false;
-
1554 }
-
1555
-
1556 std::shared_ptr<basic_parser<T>>
-
1557 m_digit_0,
-
1558 m_digit_1,
-
1559 m_digit_2,
-
1560 m_digit_3,
-
1561 m_digit_4,
-
1562 m_digit_5,
-
1563 m_digit_6,
-
1564 m_digit_7,
-
1565 m_digit_8,
-
1566 m_digit_9,
-
1567 m_digit_10,
-
1568 m_digit_11,
-
1569 m_digit_12,
-
1570 m_digit_13,
-
1571 m_digit_14,
-
1572 m_digit_15;
-
1573 };
+
1466
+
1467 using integer10ts = basic_integer10ts<char>;
+
1468 using winteger10ts = basic_integer10ts<wchar_t>;
+
1469#ifdef _UNICODE
+
1470 using tinteger10ts = winteger10ts;
+
1471#else
+
1472 using tinteger10ts = integer10ts;
+
1473#endif
+
1474 using sgml_integer10ts = basic_integer10ts<char>;
+
1475
+
1479 template <class T>
+
+ +
1481 {
+
1482 public:
+ +
1484 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
+
1485 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
+
1486 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
+
1487 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
+
1488 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
+
1489 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
+
1490 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
+
1491 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
+
1492 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
+
1493 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
+
1494 _In_ const std::shared_ptr<basic_parser<T>>& digit_10,
+
1495 _In_ const std::shared_ptr<basic_parser<T>>& digit_11,
+
1496 _In_ const std::shared_ptr<basic_parser<T>>& digit_12,
+
1497 _In_ const std::shared_ptr<basic_parser<T>>& digit_13,
+
1498 _In_ const std::shared_ptr<basic_parser<T>>& digit_14,
+
1499 _In_ const std::shared_ptr<basic_parser<T>>& digit_15,
+
1500 _In_ const std::locale& locale = std::locale()) :
+ +
1502 m_digit_0(digit_0),
+
1503 m_digit_1(digit_1),
+
1504 m_digit_2(digit_2),
+
1505 m_digit_3(digit_3),
+
1506 m_digit_4(digit_4),
+
1507 m_digit_5(digit_5),
+
1508 m_digit_6(digit_6),
+
1509 m_digit_7(digit_7),
+
1510 m_digit_8(digit_8),
+
1511 m_digit_9(digit_9),
+
1512 m_digit_10(digit_10),
+
1513 m_digit_11(digit_11),
+
1514 m_digit_12(digit_12),
+
1515 m_digit_13(digit_13),
+
1516 m_digit_14(digit_14),
+
1517 m_digit_15(digit_15)
+
1518 {}
+
1519
+
1520 protected:
+
1521 virtual bool do_match(
+
1522 _In_reads_or_z_opt_(end) const T* text,
+
1523 _In_ size_t start = 0,
+
1524 _In_ size_t end = SIZE_MAX,
+
1525 _In_ int flags = match_default)
+
1526 {
+
1527 _Assume_(text || start >= end);
+
1528 for (this->interval.end = start, this->value = 0; this->interval.end < end && text[this->interval.end];) {
+
1529 size_t dig;
+
1530 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; this->interval.end = m_digit_0->interval.end; }
+
1531 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; this->interval.end = m_digit_1->interval.end; }
+
1532 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; this->interval.end = m_digit_2->interval.end; }
+
1533 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; this->interval.end = m_digit_3->interval.end; }
+
1534 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; this->interval.end = m_digit_4->interval.end; }
+
1535 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; this->interval.end = m_digit_5->interval.end; }
+
1536 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; this->interval.end = m_digit_6->interval.end; }
+
1537 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; this->interval.end = m_digit_7->interval.end; }
+
1538 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; this->interval.end = m_digit_8->interval.end; }
+
1539 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; this->interval.end = m_digit_9->interval.end; }
+
1540 else if (m_digit_10->match(text, this->interval.end, end, flags)) { dig = 10; this->interval.end = m_digit_10->interval.end; }
+
1541 else if (m_digit_11->match(text, this->interval.end, end, flags)) { dig = 11; this->interval.end = m_digit_11->interval.end; }
+
1542 else if (m_digit_12->match(text, this->interval.end, end, flags)) { dig = 12; this->interval.end = m_digit_12->interval.end; }
+
1543 else if (m_digit_13->match(text, this->interval.end, end, flags)) { dig = 13; this->interval.end = m_digit_13->interval.end; }
+
1544 else if (m_digit_14->match(text, this->interval.end, end, flags)) { dig = 14; this->interval.end = m_digit_14->interval.end; }
+
1545 else if (m_digit_15->match(text, this->interval.end, end, flags)) { dig = 15; this->interval.end = m_digit_15->interval.end; }
+
1546 else break;
+
1547 this->value = this->value * 16 + dig;
+
1548 }
+ +
1550 this->interval.start = start;
+
1551 return true;
+
1552 }
+
1553 this->interval.invalidate();
+
1554 return false;
+
1555 }
+
1556
+
1557 std::shared_ptr<basic_parser<T>>
+
1558 m_digit_0,
+
1559 m_digit_1,
+
1560 m_digit_2,
+
1561 m_digit_3,
+
1562 m_digit_4,
+
1563 m_digit_5,
+
1564 m_digit_6,
+
1565 m_digit_7,
+
1566 m_digit_8,
+
1567 m_digit_9,
+
1568 m_digit_10,
+
1569 m_digit_11,
+
1570 m_digit_12,
+
1571 m_digit_13,
+
1572 m_digit_14,
+
1573 m_digit_15;
+
1574 };
-
1574
- - -
1577#ifdef _UNICODE
-
1578 using tinteger16 = winteger16;
-
1579#else
-
1580 using tinteger16 = integer16;
-
1581#endif
- -
1583
-
1587 template <class T>
-
- -
1589 {
-
1590 public:
- -
1592 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
-
1593 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
-
1594 _In_ const std::shared_ptr<basic_parser<T>>& digit_10,
-
1595 _In_ const std::shared_ptr<basic_parser<T>>& digit_50,
-
1596 _In_ const std::shared_ptr<basic_parser<T>>& digit_100,
-
1597 _In_ const std::shared_ptr<basic_parser<T>>& digit_500,
-
1598 _In_ const std::shared_ptr<basic_parser<T>>& digit_1000,
-
1599 _In_ const std::shared_ptr<basic_parser<T>>& digit_5000,
-
1600 _In_ const std::shared_ptr<basic_parser<T>>& digit_10000,
-
1601 _In_ const std::locale& locale = std::locale()) :
- -
1603 m_digit_1(digit_1),
-
1604 m_digit_5(digit_5),
-
1605 m_digit_10(digit_10),
-
1606 m_digit_50(digit_50),
-
1607 m_digit_100(digit_100),
-
1608 m_digit_500(digit_500),
-
1609 m_digit_1000(digit_1000),
-
1610 m_digit_5000(digit_5000),
-
1611 m_digit_10000(digit_10000)
-
1612 {}
-
1613
-
1614 protected:
-
1615 virtual bool do_match(
-
1616 _In_reads_or_z_opt_(end) const T* text,
-
1617 _In_ size_t start = 0,
-
1618 _In_ size_t end = SIZE_MAX,
-
1619 _In_ int flags = match_default)
-
1620 {
-
1621 _Assume_(text || start >= end);
-
1622 size_t
- -
1624 end2;
-
1625
-
1626 for (this->interval.end = start, this->value = 0; this->interval.end < end && text[this->interval.end]; dig[3] = dig[2], dig[2] = dig[1], dig[1] = dig[0], this->interval.end = end2) {
-
1627 if (m_digit_1 && m_digit_1->match(text, this->interval.end, end, flags)) { dig[0] = 1; end2 = m_digit_1->interval.end; }
-
1628 else if (m_digit_5 && m_digit_5->match(text, this->interval.end, end, flags)) { dig[0] = 5; end2 = m_digit_5->interval.end; }
-
1629 else if (m_digit_10 && m_digit_10->match(text, this->interval.end, end, flags)) { dig[0] = 10; end2 = m_digit_10->interval.end; }
-
1630 else if (m_digit_50 && m_digit_50->match(text, this->interval.end, end, flags)) { dig[0] = 50; end2 = m_digit_50->interval.end; }
-
1631 else if (m_digit_100 && m_digit_100->match(text, this->interval.end, end, flags)) { dig[0] = 100; end2 = m_digit_100->interval.end; }
-
1632 else if (m_digit_500 && m_digit_500->match(text, this->interval.end, end, flags)) { dig[0] = 500; end2 = m_digit_500->interval.end; }
-
1633 else if (m_digit_1000 && m_digit_1000->match(text, this->interval.end, end, flags)) { dig[0] = 1000; end2 = m_digit_1000->interval.end; }
-
1634 else if (m_digit_5000 && m_digit_5000->match(text, this->interval.end, end, flags)) { dig[0] = 5000; end2 = m_digit_5000->interval.end; }
-
1635 else if (m_digit_10000 && m_digit_10000->match(text, this->interval.end, end, flags)) { dig[0] = 10000; end2 = m_digit_10000->interval.end; }
-
1636 else break;
-
1637
-
1638 // Store first digit.
-
1639 if (dig[4] == SIZE_MAX) dig[4] = dig[0];
-
1640
-
1641 if (dig[3] == dig[2] && dig[2] == dig[1] && dig[1] == dig[0] && dig[0] != dig[4]) {
-
1642 // Same digit repeated four times. No-go, unless first digit. E.g. XIIII vs. XIV. MMMMMCD allowed, IIII also...
-
1643 break;
-
1644 }
-
1645 if (dig[0] <= dig[1]) {
-
1646 // Digit is less or equal previous one: add.
-
1647 this->value += dig[0];
-
1648 }
-
1649 else if (
-
1650 (dig[1] == 1 && (dig[0] == 5 || dig[0] == 10)) ||
-
1651 (dig[1] == 10 && (dig[0] == 50 || dig[0] == 100)) ||
-
1652 (dig[1] == 100 && (dig[0] == 500 || dig[0] == 1000)) ||
-
1653 (dig[1] == 1000 && (dig[0] == 5000 || dig[0] == 10000)))
-
1654 {
-
1655 // Digit is up to two orders bigger than previous one: subtract. But...
-
1656 if (dig[2] < dig[0]) {
-
1657 // Digit is also bigger than pre-previous one. E.g. VIX (V < X => invalid)
-
1658 break;
-
1659 }
-
1660 this->value -= dig[1]; // Cancel addition in the previous step.
-
1661 dig[0] -= dig[1]; // Combine last two digits.
-
1662 dig[1] = dig[2]; // The true previous digit is now pre-previous one. :)
-
1663 dig[2] = dig[3]; // The true pre-previous digit is now pre-pre-previous one. :)
-
1664 this->value += dig[0]; // Add combined value.
-
1665 }
-
1666 else {
-
1667 // New digit is too big than the previous one. E.g. VX (V < X => invalid)
-
1668 break;
-
1669 }
-
1670 }
-
1671 if (this->value) {
-
1672 this->interval.start = start;
-
1673 return true;
-
1674 }
-
1675 this->interval.invalidate();
-
1676 return false;
-
1677 }
-
1678
-
1679 std::shared_ptr<basic_parser<T>>
-
1680 m_digit_1,
-
1681 m_digit_5,
-
1682 m_digit_10,
-
1683 m_digit_50,
-
1684 m_digit_100,
-
1685 m_digit_500,
-
1686 m_digit_1000,
-
1687 m_digit_5000,
-
1688 m_digit_10000;
-
1689 };
+
1575
+ + +
1578#ifdef _UNICODE
+
1579 using tinteger16 = winteger16;
+
1580#else
+
1581 using tinteger16 = integer16;
+
1582#endif
+ +
1584
+
1588 template <class T>
+
+ +
1590 {
+
1591 public:
+ +
1593 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
+
1594 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
+
1595 _In_ const std::shared_ptr<basic_parser<T>>& digit_10,
+
1596 _In_ const std::shared_ptr<basic_parser<T>>& digit_50,
+
1597 _In_ const std::shared_ptr<basic_parser<T>>& digit_100,
+
1598 _In_ const std::shared_ptr<basic_parser<T>>& digit_500,
+
1599 _In_ const std::shared_ptr<basic_parser<T>>& digit_1000,
+
1600 _In_ const std::shared_ptr<basic_parser<T>>& digit_5000,
+
1601 _In_ const std::shared_ptr<basic_parser<T>>& digit_10000,
+
1602 _In_ const std::locale& locale = std::locale()) :
+ +
1604 m_digit_1(digit_1),
+
1605 m_digit_5(digit_5),
+
1606 m_digit_10(digit_10),
+
1607 m_digit_50(digit_50),
+
1608 m_digit_100(digit_100),
+
1609 m_digit_500(digit_500),
+
1610 m_digit_1000(digit_1000),
+
1611 m_digit_5000(digit_5000),
+
1612 m_digit_10000(digit_10000)
+
1613 {}
+
1614
+
1615 protected:
+
1616 virtual bool do_match(
+
1617 _In_reads_or_z_opt_(end) const T* text,
+
1618 _In_ size_t start = 0,
+
1619 _In_ size_t end = SIZE_MAX,
+
1620 _In_ int flags = match_default)
+
1621 {
+
1622 _Assume_(text || start >= end);
+
1623 size_t
+ +
1625 end2;
+
1626
+
1627 for (this->interval.end = start, this->value = 0; this->interval.end < end && text[this->interval.end]; dig[3] = dig[2], dig[2] = dig[1], dig[1] = dig[0], this->interval.end = end2) {
+
1628 if (m_digit_1 && m_digit_1->match(text, this->interval.end, end, flags)) { dig[0] = 1; end2 = m_digit_1->interval.end; }
+
1629 else if (m_digit_5 && m_digit_5->match(text, this->interval.end, end, flags)) { dig[0] = 5; end2 = m_digit_5->interval.end; }
+
1630 else if (m_digit_10 && m_digit_10->match(text, this->interval.end, end, flags)) { dig[0] = 10; end2 = m_digit_10->interval.end; }
+
1631 else if (m_digit_50 && m_digit_50->match(text, this->interval.end, end, flags)) { dig[0] = 50; end2 = m_digit_50->interval.end; }
+
1632 else if (m_digit_100 && m_digit_100->match(text, this->interval.end, end, flags)) { dig[0] = 100; end2 = m_digit_100->interval.end; }
+
1633 else if (m_digit_500 && m_digit_500->match(text, this->interval.end, end, flags)) { dig[0] = 500; end2 = m_digit_500->interval.end; }
+
1634 else if (m_digit_1000 && m_digit_1000->match(text, this->interval.end, end, flags)) { dig[0] = 1000; end2 = m_digit_1000->interval.end; }
+
1635 else if (m_digit_5000 && m_digit_5000->match(text, this->interval.end, end, flags)) { dig[0] = 5000; end2 = m_digit_5000->interval.end; }
+
1636 else if (m_digit_10000 && m_digit_10000->match(text, this->interval.end, end, flags)) { dig[0] = 10000; end2 = m_digit_10000->interval.end; }
+
1637 else break;
+
1638
+
1639 // Store first digit.
+
1640 if (dig[4] == SIZE_MAX) dig[4] = dig[0];
+
1641
+
1642 if (dig[3] == dig[2] && dig[2] == dig[1] && dig[1] == dig[0] && dig[0] != dig[4]) {
+
1643 // Same digit repeated four times. No-go, unless first digit. E.g. XIIII vs. XIV. MMMMMCD allowed, IIII also...
+
1644 break;
+
1645 }
+
1646 if (dig[0] <= dig[1]) {
+
1647 // Digit is less or equal previous one: add.
+
1648 this->value += dig[0];
+
1649 }
+
1650 else if (
+
1651 (dig[1] == 1 && (dig[0] == 5 || dig[0] == 10)) ||
+
1652 (dig[1] == 10 && (dig[0] == 50 || dig[0] == 100)) ||
+
1653 (dig[1] == 100 && (dig[0] == 500 || dig[0] == 1000)) ||
+
1654 (dig[1] == 1000 && (dig[0] == 5000 || dig[0] == 10000)))
+
1655 {
+
1656 // Digit is up to two orders bigger than previous one: subtract. But...
+
1657 if (dig[2] < dig[0]) {
+
1658 // Digit is also bigger than pre-previous one. E.g. VIX (V < X => invalid)
+
1659 break;
+
1660 }
+
1661 this->value -= dig[1]; // Cancel addition in the previous step.
+
1662 dig[0] -= dig[1]; // Combine last two digits.
+
1663 dig[1] = dig[2]; // The true previous digit is now pre-previous one. :)
+
1664 dig[2] = dig[3]; // The true pre-previous digit is now pre-pre-previous one. :)
+
1665 this->value += dig[0]; // Add combined value.
+
1666 }
+
1667 else {
+
1668 // New digit is too big than the previous one. E.g. VX (V < X => invalid)
+
1669 break;
+
1670 }
+
1671 }
+
1672 if (this->value) {
+
1673 this->interval.start = start;
+
1674 return true;
+
1675 }
+
1676 this->interval.invalidate();
+
1677 return false;
+
1678 }
+
1679
+
1680 std::shared_ptr<basic_parser<T>>
+
1681 m_digit_1,
+
1682 m_digit_5,
+
1683 m_digit_10,
+
1684 m_digit_50,
+
1685 m_digit_100,
+
1686 m_digit_500,
+
1687 m_digit_1000,
+
1688 m_digit_5000,
+
1689 m_digit_10000;
+
1690 };
-
1690
- - -
1693#ifdef _UNICODE
- -
1695#else
- -
1697#endif
- -
1699
-
1703 template <class T>
-
- -
1705 {
-
1706 public:
- -
1708 _In_ const std::shared_ptr<basic_parser<T>>& _numerator,
-
1709 _In_ const std::shared_ptr<basic_parser<T>>& _fraction_line,
-
1710 _In_ const std::shared_ptr<basic_parser<T>>& _denominator,
-
1711 _In_ const std::locale& locale = std::locale()) :
- -
1713 numerator(_numerator),
-
1714 fraction_line(_fraction_line),
-
1715 denominator(_denominator)
-
1716 {}
-
1717
-
1718 virtual void invalidate()
-
1719 {
-
1720 numerator->invalidate();
-
1721 fraction_line->invalidate();
-
1722 denominator->invalidate();
- -
1724 }
-
1725
-
1726 std::shared_ptr<basic_parser<T>> numerator;
-
1727 std::shared_ptr<basic_parser<T>> fraction_line;
-
1728 std::shared_ptr<basic_parser<T>> denominator;
-
1729
-
1730 protected:
-
1731 virtual bool do_match(
-
1732 _In_reads_or_z_opt_(end) const T* text,
-
1733 _In_ size_t start = 0,
-
1734 _In_ size_t end = SIZE_MAX,
-
1735 _In_ int flags = match_default)
-
1736 {
-
1737 _Assume_(text || start >= end);
-
1738 if (numerator->match(text, start, end, flags) &&
-
1739 fraction_line->match(text, numerator->interval.end, end, flags) &&
-
1740 denominator->match(text, fraction_line->interval.end, end, flags))
-
1741 {
-
1742 this->interval.start = start;
-
1743 this->interval.end = denominator->interval.end;
-
1744 return true;
-
1745 }
-
1746 numerator->invalidate();
-
1747 fraction_line->invalidate();
-
1748 denominator->invalidate();
-
1749 this->interval.invalidate();
-
1750 return false;
-
1751 }
-
1752 };
+
1691
+ + +
1694#ifdef _UNICODE
+ +
1696#else
+ +
1698#endif
+ +
1700
+
1704 template <class T>
+
+ +
1706 {
+
1707 public:
+ +
1709 _In_ const std::shared_ptr<basic_parser<T>>& _numerator,
+
1710 _In_ const std::shared_ptr<basic_parser<T>>& _fraction_line,
+
1711 _In_ const std::shared_ptr<basic_parser<T>>& _denominator,
+
1712 _In_ const std::locale& locale = std::locale()) :
+ +
1714 numerator(_numerator),
+
1715 fraction_line(_fraction_line),
+
1716 denominator(_denominator)
+
1717 {}
+
1718
+
1719 virtual void invalidate()
+
1720 {
+
1721 numerator->invalidate();
+
1722 fraction_line->invalidate();
+
1723 denominator->invalidate();
+ +
1725 }
+
1726
+
1727 std::shared_ptr<basic_parser<T>> numerator;
+
1728 std::shared_ptr<basic_parser<T>> fraction_line;
+
1729 std::shared_ptr<basic_parser<T>> denominator;
+
1730
+
1731 protected:
+
1732 virtual bool do_match(
+
1733 _In_reads_or_z_opt_(end) const T* text,
+
1734 _In_ size_t start = 0,
+
1735 _In_ size_t end = SIZE_MAX,
+
1736 _In_ int flags = match_default)
+
1737 {
+
1738 _Assume_(text || start >= end);
+
1739 if (numerator->match(text, start, end, flags) &&
+
1740 fraction_line->match(text, numerator->interval.end, end, flags) &&
+
1741 denominator->match(text, fraction_line->interval.end, end, flags))
+
1742 {
+
1743 this->interval.start = start;
+
1744 this->interval.end = denominator->interval.end;
+
1745 return true;
+
1746 }
+
1747 numerator->invalidate();
+
1748 fraction_line->invalidate();
+
1749 denominator->invalidate();
+
1750 this->interval.invalidate();
+
1751 return false;
+
1752 }
+
1753 };
-
1753
- - -
1756#ifdef _UNICODE
-
1757 using tfraction = wfraction;
-
1758#else
-
1759 using tfraction = fraction;
-
1760#endif
- -
1762
-
1766 template <class T>
-
-
1767 class basic_score : public basic_parser<T>
-
1768 {
-
1769 public:
- -
1771 _In_ const std::shared_ptr<basic_parser<T>>& _home,
-
1772 _In_ const std::shared_ptr<basic_parser<T>>& _separator,
-
1773 _In_ const std::shared_ptr<basic_parser<T>>& _guest,
-
1774 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
1775 _In_ const std::locale& locale = std::locale()) :
- -
1777 home(_home),
-
1778 separator(_separator),
-
1779 guest(_guest),
-
1780 m_space(space)
-
1781 {}
-
1782
-
1783 virtual void invalidate()
-
1784 {
-
1785 home->invalidate();
-
1786 separator->invalidate();
-
1787 guest->invalidate();
- -
1789 }
-
1790
-
1791 std::shared_ptr<basic_parser<T>> home;
-
1792 std::shared_ptr<basic_parser<T>> separator;
-
1793 std::shared_ptr<basic_parser<T>> guest;
-
1794
-
1795 protected:
-
1796 virtual bool do_match(
-
1797 _In_reads_or_z_opt_(end) const T* text,
-
1798 _In_ size_t start = 0,
-
1799 _In_ size_t end = SIZE_MAX,
-
1800 _In_ int flags = match_default)
-
1801 {
-
1802 _Assume_(text || start >= end);
-
1803 this->interval.end = start;
-
1804
-
1805 const int space_match_flags = flags & ~match_multiline; // Spaces in score must never be broken in new line.
-
1806
-
1807 if (home->match(text, this->interval.end, end, flags))
-
1808 this->interval.end = home->interval.end;
-
1809 else
-
1810 goto end;
-
1811
-
1812 for (; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
1813
-
1814 if (separator->match(text, this->interval.end, end, flags))
-
1815 this->interval.end = separator->interval.end;
-
1816 else
-
1817 goto end;
-
1818
-
1819 for (; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
1820
-
1821 if (guest->match(text, this->interval.end, end, flags))
-
1822 this->interval.end = guest->interval.end;
-
1823 else
-
1824 goto end;
-
1825
-
1826 this->interval.start = start;
-
1827 return true;
-
1828
-
1829 end:
-
1830 home->invalidate();
-
1831 separator->invalidate();
-
1832 guest->invalidate();
-
1833 this->interval.invalidate();
-
1834 return false;
-
1835 }
-
1836
-
1837 std::shared_ptr<basic_parser<T>> m_space;
-
1838 };
+
1754
+ + +
1757#ifdef _UNICODE
+
1758 using tfraction = wfraction;
+
1759#else
+
1760 using tfraction = fraction;
+
1761#endif
+ +
1763
+
1767 template <class T>
+
+
1768 class basic_score : public basic_parser<T>
+
1769 {
+
1770 public:
+ +
1772 _In_ const std::shared_ptr<basic_parser<T>>& _home,
+
1773 _In_ const std::shared_ptr<basic_parser<T>>& _separator,
+
1774 _In_ const std::shared_ptr<basic_parser<T>>& _guest,
+
1775 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
1776 _In_ const std::locale& locale = std::locale()) :
+ +
1778 home(_home),
+
1779 separator(_separator),
+
1780 guest(_guest),
+
1781 m_space(space)
+
1782 {}
+
1783
+
1784 virtual void invalidate()
+
1785 {
+
1786 home->invalidate();
+
1787 separator->invalidate();
+
1788 guest->invalidate();
+ +
1790 }
+
1791
+
1792 std::shared_ptr<basic_parser<T>> home;
+
1793 std::shared_ptr<basic_parser<T>> separator;
+
1794 std::shared_ptr<basic_parser<T>> guest;
+
1795
+
1796 protected:
+
1797 virtual bool do_match(
+
1798 _In_reads_or_z_opt_(end) const T* text,
+
1799 _In_ size_t start = 0,
+
1800 _In_ size_t end = SIZE_MAX,
+
1801 _In_ int flags = match_default)
+
1802 {
+
1803 _Assume_(text || start >= end);
+
1804 this->interval.end = start;
+
1805
+
1806 const int space_match_flags = flags & ~match_multiline; // Spaces in score must never be broken in new line.
+
1807
+
1808 if (home->match(text, this->interval.end, end, flags))
+
1809 this->interval.end = home->interval.end;
+
1810 else
+
1811 goto end;
+
1812
+
1813 for (; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
1814
+
1815 if (separator->match(text, this->interval.end, end, flags))
+
1816 this->interval.end = separator->interval.end;
+
1817 else
+
1818 goto end;
+
1819
+
1820 for (; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
1821
+
1822 if (guest->match(text, this->interval.end, end, flags))
+
1823 this->interval.end = guest->interval.end;
+
1824 else
+
1825 goto end;
+
1826
+
1827 this->interval.start = start;
+
1828 return true;
+
1829
+
1830 end:
+
1831 home->invalidate();
+
1832 separator->invalidate();
+
1833 guest->invalidate();
+
1834 this->interval.invalidate();
+
1835 return false;
+
1836 }
+
1837
+
1838 std::shared_ptr<basic_parser<T>> m_space;
+
1839 };
-
1839
-
1840 using score = basic_score<char>;
- -
1842#ifdef _UNICODE
-
1843 using tscore = wscore;
-
1844#else
-
1845 using tscore = score;
-
1846#endif
- -
1848
-
1852 template <class T>
-
- -
1854 {
-
1855 public:
- -
1857 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
-
1858 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
-
1859 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
-
1860 _In_ const std::shared_ptr<basic_parser<T>>& _number,
-
1861 _In_ const std::locale& locale = std::locale()) :
- - - - - -
1867 {}
-
1868
-
1869 virtual void invalidate()
-
1870 {
-
1871 if (positive_sign) positive_sign->invalidate();
-
1872 if (negative_sign) negative_sign->invalidate();
-
1873 if (special_sign) special_sign->invalidate();
-
1874 number->invalidate();
- -
1876 }
-
1877
-
1878 std::shared_ptr<basic_parser<T>> positive_sign;
-
1879 std::shared_ptr<basic_parser<T>> negative_sign;
-
1880 std::shared_ptr<basic_parser<T>> special_sign;
-
1881 std::shared_ptr<basic_parser<T>> number;
-
1882
-
1883 protected:
-
1884 virtual bool do_match(
-
1885 _In_reads_or_z_opt_(end) const T* text,
-
1886 _In_ size_t start = 0,
-
1887 _In_ size_t end = SIZE_MAX,
-
1888 _In_ int flags = match_default)
-
1889 {
-
1890 _Assume_(text || start >= end);
-
1891 this->interval.end = start;
-
1892 if (positive_sign && positive_sign->match(text, this->interval.end, end, flags)) {
-
1893 this->interval.end = positive_sign->interval.end;
-
1894 if (negative_sign) negative_sign->invalidate();
-
1895 if (special_sign) special_sign->invalidate();
-
1896 }
-
1897 else if (negative_sign && negative_sign->match(text, this->interval.end, end, flags)) {
-
1898 this->interval.end = negative_sign->interval.end;
-
1899 if (positive_sign) positive_sign->invalidate();
-
1900 if (special_sign) special_sign->invalidate();
-
1901 }
-
1902 else if (special_sign && special_sign->match(text, this->interval.end, end, flags)) {
-
1903 this->interval.end = special_sign->interval.end;
-
1904 if (positive_sign) positive_sign->invalidate();
-
1905 if (negative_sign) negative_sign->invalidate();
-
1906 }
-
1907 else {
-
1908 if (positive_sign) positive_sign->invalidate();
-
1909 if (negative_sign) negative_sign->invalidate();
-
1910 if (special_sign) special_sign->invalidate();
-
1911 }
-
1912 if (number->match(text, this->interval.end, end, flags)) {
-
1913 this->interval.start = start;
-
1914 this->interval.end = number->interval.end;
-
1915 return true;
-
1916 }
-
1917 if (positive_sign) positive_sign->invalidate();
-
1918 if (negative_sign) negative_sign->invalidate();
-
1919 if (special_sign) special_sign->invalidate();
-
1920 number->invalidate();
-
1921 this->interval.invalidate();
-
1922 return false;
-
1923 }
-
1924 };
+
1840
+
1841 using score = basic_score<char>;
+ +
1843#ifdef _UNICODE
+
1844 using tscore = wscore;
+
1845#else
+
1846 using tscore = score;
+
1847#endif
+ +
1849
+
1853 template <class T>
+
+ +
1855 {
+
1856 public:
+ +
1858 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
+
1859 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
+
1860 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
+
1861 _In_ const std::shared_ptr<basic_parser<T>>& _number,
+
1862 _In_ const std::locale& locale = std::locale()) :
+ + + + + +
1868 {}
+
1869
+
1870 virtual void invalidate()
+
1871 {
+
1872 if (positive_sign) positive_sign->invalidate();
+
1873 if (negative_sign) negative_sign->invalidate();
+
1874 if (special_sign) special_sign->invalidate();
+
1875 number->invalidate();
+ +
1877 }
+
1878
+
1879 std::shared_ptr<basic_parser<T>> positive_sign;
+
1880 std::shared_ptr<basic_parser<T>> negative_sign;
+
1881 std::shared_ptr<basic_parser<T>> special_sign;
+
1882 std::shared_ptr<basic_parser<T>> number;
+
1883
+
1884 protected:
+
1885 virtual bool do_match(
+
1886 _In_reads_or_z_opt_(end) const T* text,
+
1887 _In_ size_t start = 0,
+
1888 _In_ size_t end = SIZE_MAX,
+
1889 _In_ int flags = match_default)
+
1890 {
+
1891 _Assume_(text || start >= end);
+
1892 this->interval.end = start;
+
1893 if (positive_sign && positive_sign->match(text, this->interval.end, end, flags)) {
+
1894 this->interval.end = positive_sign->interval.end;
+
1895 if (negative_sign) negative_sign->invalidate();
+
1896 if (special_sign) special_sign->invalidate();
+
1897 }
+
1898 else if (negative_sign && negative_sign->match(text, this->interval.end, end, flags)) {
+
1899 this->interval.end = negative_sign->interval.end;
+
1900 if (positive_sign) positive_sign->invalidate();
+
1901 if (special_sign) special_sign->invalidate();
+
1902 }
+
1903 else if (special_sign && special_sign->match(text, this->interval.end, end, flags)) {
+
1904 this->interval.end = special_sign->interval.end;
+
1905 if (positive_sign) positive_sign->invalidate();
+
1906 if (negative_sign) negative_sign->invalidate();
+
1907 }
+
1908 else {
+
1909 if (positive_sign) positive_sign->invalidate();
+
1910 if (negative_sign) negative_sign->invalidate();
+
1911 if (special_sign) special_sign->invalidate();
+
1912 }
+
1913 if (number->match(text, this->interval.end, end, flags)) {
+
1914 this->interval.start = start;
+
1915 this->interval.end = number->interval.end;
+
1916 return true;
+
1917 }
+
1918 if (positive_sign) positive_sign->invalidate();
+
1919 if (negative_sign) negative_sign->invalidate();
+
1920 if (special_sign) special_sign->invalidate();
+
1921 number->invalidate();
+
1922 this->interval.invalidate();
+
1923 return false;
+
1924 }
+
1925 };
-
1925
-
1926 using signed_numeral = basic_signed_numeral<char>;
-
1927 using wsigned_numeral = basic_signed_numeral<wchar_t>;
-
1928#ifdef _UNICODE
-
1929 using tsigned_numeral = wsigned_numeral;
-
1930#else
-
1931 using tsigned_numeral = signed_numeral;
-
1932#endif
-
1933 using sgml_signed_numeral = basic_signed_numeral<char>;
-
1934
-
1938 template <class T>
-
- -
1940 {
-
1941 public:
- -
1943 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
-
1944 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
-
1945 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
-
1946 _In_ const std::shared_ptr<basic_parser<T>>& _integer,
-
1947 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
1948 _In_ const std::shared_ptr<basic_parser<T>>& _fraction,
-
1949 _In_ const std::locale& locale = std::locale()) :
- - - - - - -
1956 m_space(space)
-
1957 {}
-
1958
-
1959 virtual void invalidate()
-
1960 {
-
1961 if (positive_sign) positive_sign->invalidate();
-
1962 if (negative_sign) negative_sign->invalidate();
-
1963 if (special_sign) special_sign->invalidate();
-
1964 integer->invalidate();
-
1965 fraction->invalidate();
- -
1967 }
-
1968
-
1969 std::shared_ptr<basic_parser<T>> positive_sign;
-
1970 std::shared_ptr<basic_parser<T>> negative_sign;
-
1971 std::shared_ptr<basic_parser<T>> special_sign;
-
1972 std::shared_ptr<basic_parser<T>> integer;
-
1973 std::shared_ptr<basic_parser<T>> fraction;
-
1974
-
1975 protected:
-
1976 virtual bool do_match(
-
1977 _In_reads_or_z_opt_(end) const T* text,
-
1978 _In_ size_t start = 0,
-
1979 _In_ size_t end = SIZE_MAX,
-
1980 _In_ int flags = match_default)
-
1981 {
-
1982 _Assume_(text || start >= end);
-
1983 this->interval.end = start;
-
1984
-
1985 if (positive_sign && positive_sign->match(text, this->interval.end, end, flags)) {
-
1986 this->interval.end = positive_sign->interval.end;
-
1987 if (negative_sign) negative_sign->invalidate();
-
1988 if (special_sign) special_sign->invalidate();
-
1989 }
-
1990 else if (negative_sign && negative_sign->match(text, this->interval.end, end, flags)) {
-
1991 this->interval.end = negative_sign->interval.end;
-
1992 if (positive_sign) positive_sign->invalidate();
-
1993 if (special_sign) special_sign->invalidate();
-
1994 }
-
1995 else if (special_sign && special_sign->match(text, this->interval.end, end, flags)) {
-
1996 this->interval.end = special_sign->interval.end;
-
1997 if (positive_sign) positive_sign->invalidate();
-
1998 if (negative_sign) negative_sign->invalidate();
-
1999 }
-
2000 else {
-
2001 if (positive_sign) positive_sign->invalidate();
-
2002 if (negative_sign) negative_sign->invalidate();
-
2003 if (special_sign) special_sign->invalidate();
-
2004 }
-
2005
-
2006 // Check for <integer> <fraction>
-
2007 const int space_match_flags = flags & ~match_multiline; // Spaces in fractions must never be broken in new line.
-
2008 if (integer->match(text, this->interval.end, end, flags) &&
-
2009 m_space->match(text, integer->interval.end, end, space_match_flags))
-
2010 {
-
2011 for (this->interval.end = m_space->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
2012 if (fraction->match(text, this->interval.end, end, flags)) {
-
2013 this->interval.start = start;
-
2014 this->interval.end = fraction->interval.end;
-
2015 return true;
-
2016 }
-
2017 fraction->invalidate();
-
2018 this->interval.start = start;
-
2019 this->interval.end = integer->interval.end;
-
2020 return true;
-
2021 }
-
2022
-
2023 // Check for <fraction>
-
2024 if (fraction->match(text, this->interval.end, end, flags)) {
-
2025 integer->invalidate();
-
2026 this->interval.start = start;
-
2027 this->interval.end = fraction->interval.end;
-
2028 return true;
-
2029 }
-
2030
-
2031 // Check for <integer>
-
2032 if (integer->match(text, this->interval.end, end, flags)) {
-
2033 fraction->invalidate();
-
2034 this->interval.start = start;
-
2035 this->interval.end = integer->interval.end;
-
2036 return true;
-
2037 }
-
2038
-
2039 if (positive_sign) positive_sign->invalidate();
-
2040 if (negative_sign) negative_sign->invalidate();
-
2041 if (special_sign) special_sign->invalidate();
-
2042 integer->invalidate();
-
2043 fraction->invalidate();
-
2044 this->interval.invalidate();
-
2045 return false;
-
2046 }
-
2047
-
2048 std::shared_ptr<basic_parser<T>> m_space;
-
2049 };
+
1926
+
1927 using signed_numeral = basic_signed_numeral<char>;
+
1928 using wsigned_numeral = basic_signed_numeral<wchar_t>;
+
1929#ifdef _UNICODE
+
1930 using tsigned_numeral = wsigned_numeral;
+
1931#else
+
1932 using tsigned_numeral = signed_numeral;
+
1933#endif
+
1934 using sgml_signed_numeral = basic_signed_numeral<char>;
+
1935
+
1939 template <class T>
+
+ +
1941 {
+
1942 public:
+ +
1944 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
+
1945 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
+
1946 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
+
1947 _In_ const std::shared_ptr<basic_parser<T>>& _integer,
+
1948 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
1949 _In_ const std::shared_ptr<basic_parser<T>>& _fraction,
+
1950 _In_ const std::locale& locale = std::locale()) :
+ + + + + + +
1957 m_space(space)
+
1958 {}
+
1959
+
1960 virtual void invalidate()
+
1961 {
+
1962 if (positive_sign) positive_sign->invalidate();
+
1963 if (negative_sign) negative_sign->invalidate();
+
1964 if (special_sign) special_sign->invalidate();
+
1965 integer->invalidate();
+
1966 fraction->invalidate();
+ +
1968 }
+
1969
+
1970 std::shared_ptr<basic_parser<T>> positive_sign;
+
1971 std::shared_ptr<basic_parser<T>> negative_sign;
+
1972 std::shared_ptr<basic_parser<T>> special_sign;
+
1973 std::shared_ptr<basic_parser<T>> integer;
+
1974 std::shared_ptr<basic_parser<T>> fraction;
+
1975
+
1976 protected:
+
1977 virtual bool do_match(
+
1978 _In_reads_or_z_opt_(end) const T* text,
+
1979 _In_ size_t start = 0,
+
1980 _In_ size_t end = SIZE_MAX,
+
1981 _In_ int flags = match_default)
+
1982 {
+
1983 _Assume_(text || start >= end);
+
1984 this->interval.end = start;
+
1985
+
1986 if (positive_sign && positive_sign->match(text, this->interval.end, end, flags)) {
+
1987 this->interval.end = positive_sign->interval.end;
+
1988 if (negative_sign) negative_sign->invalidate();
+
1989 if (special_sign) special_sign->invalidate();
+
1990 }
+
1991 else if (negative_sign && negative_sign->match(text, this->interval.end, end, flags)) {
+
1992 this->interval.end = negative_sign->interval.end;
+
1993 if (positive_sign) positive_sign->invalidate();
+
1994 if (special_sign) special_sign->invalidate();
+
1995 }
+
1996 else if (special_sign && special_sign->match(text, this->interval.end, end, flags)) {
+
1997 this->interval.end = special_sign->interval.end;
+
1998 if (positive_sign) positive_sign->invalidate();
+
1999 if (negative_sign) negative_sign->invalidate();
+
2000 }
+
2001 else {
+
2002 if (positive_sign) positive_sign->invalidate();
+
2003 if (negative_sign) negative_sign->invalidate();
+
2004 if (special_sign) special_sign->invalidate();
+
2005 }
+
2006
+
2007 // Check for <integer> <fraction>
+
2008 const int space_match_flags = flags & ~match_multiline; // Spaces in fractions must never be broken in new line.
+
2009 if (integer->match(text, this->interval.end, end, flags) &&
+
2010 m_space->match(text, integer->interval.end, end, space_match_flags))
+
2011 {
+
2012 for (this->interval.end = m_space->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
2013 if (fraction->match(text, this->interval.end, end, flags)) {
+
2014 this->interval.start = start;
+
2015 this->interval.end = fraction->interval.end;
+
2016 return true;
+
2017 }
+
2018 fraction->invalidate();
+
2019 this->interval.start = start;
+
2020 this->interval.end = integer->interval.end;
+
2021 return true;
+
2022 }
+
2023
+
2024 // Check for <fraction>
+
2025 if (fraction->match(text, this->interval.end, end, flags)) {
+
2026 integer->invalidate();
+
2027 this->interval.start = start;
+
2028 this->interval.end = fraction->interval.end;
+
2029 return true;
+
2030 }
+
2031
+
2032 // Check for <integer>
+
2033 if (integer->match(text, this->interval.end, end, flags)) {
+
2034 fraction->invalidate();
+
2035 this->interval.start = start;
+
2036 this->interval.end = integer->interval.end;
+
2037 return true;
+
2038 }
+
2039
+
2040 if (positive_sign) positive_sign->invalidate();
+
2041 if (negative_sign) negative_sign->invalidate();
+
2042 if (special_sign) special_sign->invalidate();
+
2043 integer->invalidate();
+
2044 fraction->invalidate();
+
2045 this->interval.invalidate();
+
2046 return false;
+
2047 }
+
2048
+
2049 std::shared_ptr<basic_parser<T>> m_space;
+
2050 };
-
2050
-
2051 using mixed_numeral = basic_mixed_numeral<char>;
-
2052 using wmixed_numeral = basic_mixed_numeral<wchar_t>;
-
2053#ifdef _UNICODE
-
2054 using tmixed_numeral = wmixed_numeral;
-
2055#else
-
2056 using tmixed_numeral = mixed_numeral;
-
2057#endif
-
2058 using sgml_mixed_numeral = basic_mixed_numeral<char>;
-
2059
-
2063 template <class T>
-
- -
2065 {
-
2066 public:
- -
2068 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
-
2069 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
-
2070 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
-
2071 _In_ const std::shared_ptr<basic_integer<T>>& _integer,
-
2072 _In_ const std::shared_ptr<basic_parser<T>>& _decimal_separator,
-
2073 _In_ const std::shared_ptr<basic_integer<T>>& _decimal,
-
2074 _In_ const std::shared_ptr<basic_parser<T>>& _exponent_symbol,
-
2075 _In_ const std::shared_ptr<basic_parser<T>>& _positive_exp_sign,
-
2076 _In_ const std::shared_ptr<basic_parser<T>>& _negative_exp_sign,
-
2077 _In_ const std::shared_ptr<basic_integer<T>>& _exponent,
-
2078 _In_ const std::locale& locale = std::locale()) :
- - - - - - - - - - - -
2090 value(std::numeric_limits<double>::quiet_NaN())
-
2091 {}
-
2092
-
2093 virtual void invalidate()
-
2094 {
-
2095 if (positive_sign) positive_sign->invalidate();
-
2096 if (negative_sign) negative_sign->invalidate();
-
2097 if (special_sign) special_sign->invalidate();
-
2098 integer->invalidate();
-
2099 decimal_separator->invalidate();
-
2100 decimal->invalidate();
-
2101 if (exponent_symbol) exponent_symbol->invalidate();
-
2102 if (positive_exp_sign) positive_exp_sign->invalidate();
-
2103 if (negative_exp_sign) negative_exp_sign->invalidate();
-
2104 if (exponent) exponent->invalidate();
-
2105 value = std::numeric_limits<double>::quiet_NaN();
- -
2107 }
-
2108
-
2109 std::shared_ptr<basic_parser<T>> positive_sign;
-
2110 std::shared_ptr<basic_parser<T>> negative_sign;
-
2111 std::shared_ptr<basic_parser<T>> special_sign;
-
2112 std::shared_ptr<basic_integer<T>> integer;
-
2113 std::shared_ptr<basic_parser<T>> decimal_separator;
-
2114 std::shared_ptr<basic_integer<T>> decimal;
-
2115 std::shared_ptr<basic_parser<T>> exponent_symbol;
-
2116 std::shared_ptr<basic_parser<T>> positive_exp_sign;
-
2117 std::shared_ptr<basic_parser<T>> negative_exp_sign;
-
2118 std::shared_ptr<basic_integer<T>> exponent;
-
2119 double value;
-
2120
-
2121 protected:
-
2122 virtual bool do_match(
-
2123 _In_reads_or_z_opt_(end) const T* text,
-
2124 _In_ size_t start = 0,
-
2125 _In_ size_t end = SIZE_MAX,
-
2126 _In_ int flags = match_default)
-
2127 {
-
2128 _Assume_(text || start >= end);
-
2129 this->interval.end = start;
-
2130
-
2131 if (positive_sign && positive_sign->match(text, this->interval.end, end, flags)) {
-
2132 this->interval.end = positive_sign->interval.end;
-
2133 if (negative_sign) negative_sign->invalidate();
-
2134 if (special_sign) special_sign->invalidate();
-
2135 }
-
2136 else if (negative_sign && negative_sign->match(text, this->interval.end, end, flags)) {
-
2137 this->interval.end = negative_sign->interval.end;
-
2138 if (positive_sign) positive_sign->invalidate();
-
2139 if (special_sign) special_sign->invalidate();
-
2140 }
-
2141 else if (special_sign && special_sign->match(text, this->interval.end, end, flags)) {
-
2142 this->interval.end = special_sign->interval.end;
-
2143 if (positive_sign) positive_sign->invalidate();
-
2144 if (negative_sign) negative_sign->invalidate();
-
2145 }
-
2146 else {
-
2147 if (positive_sign) positive_sign->invalidate();
-
2148 if (negative_sign) negative_sign->invalidate();
-
2149 if (special_sign) special_sign->invalidate();
-
2150 }
-
2151
-
2152 if (integer->match(text, this->interval.end, end, flags))
-
2153 this->interval.end = integer->interval.end;
-
2154
-
2155 if (decimal_separator->match(text, this->interval.end, end, flags) &&
-
2156 decimal->match(text, decimal_separator->interval.end, end, flags))
-
2157 this->interval.end = decimal->interval.end;
-
2158 else {
-
2159 decimal_separator->invalidate();
-
2160 decimal->invalidate();
-
2161 }
-
2162
-
2163 if (integer->interval.empty() &&
-
2164 decimal->interval.empty())
-
2165 {
-
2166 // No integer part, no decimal part.
-
2167 if (positive_sign) positive_sign->invalidate();
-
2168 if (negative_sign) negative_sign->invalidate();
-
2169 if (special_sign) special_sign->invalidate();
-
2170 integer->invalidate();
-
2171 decimal_separator->invalidate();
-
2172 decimal->invalidate();
-
2173 if (exponent_symbol) exponent_symbol->invalidate();
-
2174 if (positive_exp_sign) positive_exp_sign->invalidate();
-
2175 if (negative_exp_sign) negative_exp_sign->invalidate();
-
2176 if (exponent) exponent->invalidate();
-
2177 this->interval.invalidate();
-
2178 return false;
-
2179 }
-
2180
-
2181 if (exponent_symbol && exponent_symbol->match(text, this->interval.end, end, flags) &&
-
2182 ((positive_exp_sign && positive_exp_sign->match(text, exponent_symbol->interval.end, end, flags) &&
-
2183 exponent && exponent->match(text, positive_exp_sign->interval.end, end, flags)) ||
-
2184 (exponent && exponent->match(text, exponent_symbol->interval.end, end, flags))))
-
2185 {
-
2186 this->interval.end = exponent->interval.end;
-
2187 if (negative_exp_sign) negative_exp_sign->invalidate();
-
2188 }
-
2189 else if (exponent_symbol && exponent_symbol->match(text, this->interval.end, end, flags) &&
-
2190 negative_exp_sign && negative_exp_sign->match(text, exponent_symbol->interval.end, end, flags) &&
-
2191 exponent && exponent->match(text, negative_exp_sign->interval.end, end, flags))
-
2192 {
-
2193 this->interval.end = exponent->interval.end;
-
2194 if (positive_exp_sign) positive_exp_sign->invalidate();
-
2195 }
-
2196 else {
-
2197 if (exponent_symbol) exponent_symbol->invalidate();
-
2198 if (positive_exp_sign) positive_exp_sign->invalidate();
-
2199 if (negative_exp_sign) negative_exp_sign->invalidate();
-
2200 if (exponent) exponent->invalidate();
-
2201 }
-
2202
-
2203 value = (double)integer->value;
-
2204 if (decimal->interval)
-
2205 value += (double)decimal->value * pow(10.0, -(double)decimal->interval.size());
-
2206 if (negative_sign && negative_sign->interval)
-
2207 value = -value;
-
2208 if (exponent && exponent->interval) {
-
2209 double e = (double)exponent->value;
-
2210 if (negative_exp_sign && negative_exp_sign->interval)
-
2211 e = -e;
-
2212 value *= pow(10.0, e);
-
2213 }
-
2214
-
2215 this->interval.start = start;
-
2216 return true;
-
2217 }
-
2218 };
+
2051
+
2052 using mixed_numeral = basic_mixed_numeral<char>;
+
2053 using wmixed_numeral = basic_mixed_numeral<wchar_t>;
+
2054#ifdef _UNICODE
+
2055 using tmixed_numeral = wmixed_numeral;
+
2056#else
+
2057 using tmixed_numeral = mixed_numeral;
+
2058#endif
+
2059 using sgml_mixed_numeral = basic_mixed_numeral<char>;
+
2060
+
2064 template <class T>
+
+ +
2066 {
+
2067 public:
+ +
2069 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
+
2070 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
+
2071 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
+
2072 _In_ const std::shared_ptr<basic_integer<T>>& _integer,
+
2073 _In_ const std::shared_ptr<basic_parser<T>>& _decimal_separator,
+
2074 _In_ const std::shared_ptr<basic_integer<T>>& _decimal,
+
2075 _In_ const std::shared_ptr<basic_parser<T>>& _exponent_symbol,
+
2076 _In_ const std::shared_ptr<basic_parser<T>>& _positive_exp_sign,
+
2077 _In_ const std::shared_ptr<basic_parser<T>>& _negative_exp_sign,
+
2078 _In_ const std::shared_ptr<basic_integer<T>>& _exponent,
+
2079 _In_ const std::locale& locale = std::locale()) :
+ + + + + + + + + + + +
2091 value(std::numeric_limits<double>::quiet_NaN())
+
2092 {}
+
2093
+
2094 virtual void invalidate()
+
2095 {
+
2096 if (positive_sign) positive_sign->invalidate();
+
2097 if (negative_sign) negative_sign->invalidate();
+
2098 if (special_sign) special_sign->invalidate();
+
2099 integer->invalidate();
+
2100 decimal_separator->invalidate();
+
2101 decimal->invalidate();
+
2102 if (exponent_symbol) exponent_symbol->invalidate();
+
2103 if (positive_exp_sign) positive_exp_sign->invalidate();
+
2104 if (negative_exp_sign) negative_exp_sign->invalidate();
+
2105 if (exponent) exponent->invalidate();
+
2106 value = std::numeric_limits<double>::quiet_NaN();
+ +
2108 }
+
2109
+
2110 std::shared_ptr<basic_parser<T>> positive_sign;
+
2111 std::shared_ptr<basic_parser<T>> negative_sign;
+
2112 std::shared_ptr<basic_parser<T>> special_sign;
+
2113 std::shared_ptr<basic_integer<T>> integer;
+
2114 std::shared_ptr<basic_parser<T>> decimal_separator;
+
2115 std::shared_ptr<basic_integer<T>> decimal;
+
2116 std::shared_ptr<basic_parser<T>> exponent_symbol;
+
2117 std::shared_ptr<basic_parser<T>> positive_exp_sign;
+
2118 std::shared_ptr<basic_parser<T>> negative_exp_sign;
+
2119 std::shared_ptr<basic_integer<T>> exponent;
+
2120 double value;
+
2121
+
2122 protected:
+
2123 virtual bool do_match(
+
2124 _In_reads_or_z_opt_(end) const T* text,
+
2125 _In_ size_t start = 0,
+
2126 _In_ size_t end = SIZE_MAX,
+
2127 _In_ int flags = match_default)
+
2128 {
+
2129 _Assume_(text || start >= end);
+
2130 this->interval.end = start;
+
2131
+
2132 if (positive_sign && positive_sign->match(text, this->interval.end, end, flags)) {
+
2133 this->interval.end = positive_sign->interval.end;
+
2134 if (negative_sign) negative_sign->invalidate();
+
2135 if (special_sign) special_sign->invalidate();
+
2136 }
+
2137 else if (negative_sign && negative_sign->match(text, this->interval.end, end, flags)) {
+
2138 this->interval.end = negative_sign->interval.end;
+
2139 if (positive_sign) positive_sign->invalidate();
+
2140 if (special_sign) special_sign->invalidate();
+
2141 }
+
2142 else if (special_sign && special_sign->match(text, this->interval.end, end, flags)) {
+
2143 this->interval.end = special_sign->interval.end;
+
2144 if (positive_sign) positive_sign->invalidate();
+
2145 if (negative_sign) negative_sign->invalidate();
+
2146 }
+
2147 else {
+
2148 if (positive_sign) positive_sign->invalidate();
+
2149 if (negative_sign) negative_sign->invalidate();
+
2150 if (special_sign) special_sign->invalidate();
+
2151 }
+
2152
+
2153 if (integer->match(text, this->interval.end, end, flags))
+
2154 this->interval.end = integer->interval.end;
+
2155
+
2156 if (decimal_separator->match(text, this->interval.end, end, flags) &&
+
2157 decimal->match(text, decimal_separator->interval.end, end, flags))
+
2158 this->interval.end = decimal->interval.end;
+
2159 else {
+
2160 decimal_separator->invalidate();
+
2161 decimal->invalidate();
+
2162 }
+
2163
+
2164 if (integer->interval.empty() &&
+
2165 decimal->interval.empty())
+
2166 {
+
2167 // No integer part, no decimal part.
+
2168 if (positive_sign) positive_sign->invalidate();
+
2169 if (negative_sign) negative_sign->invalidate();
+
2170 if (special_sign) special_sign->invalidate();
+
2171 integer->invalidate();
+
2172 decimal_separator->invalidate();
+
2173 decimal->invalidate();
+
2174 if (exponent_symbol) exponent_symbol->invalidate();
+
2175 if (positive_exp_sign) positive_exp_sign->invalidate();
+
2176 if (negative_exp_sign) negative_exp_sign->invalidate();
+
2177 if (exponent) exponent->invalidate();
+
2178 this->interval.invalidate();
+
2179 return false;
+
2180 }
+
2181
+
2182 if (exponent_symbol && exponent_symbol->match(text, this->interval.end, end, flags) &&
+
2183 ((positive_exp_sign && positive_exp_sign->match(text, exponent_symbol->interval.end, end, flags) &&
+
2184 exponent && exponent->match(text, positive_exp_sign->interval.end, end, flags)) ||
+
2185 (exponent && exponent->match(text, exponent_symbol->interval.end, end, flags))))
+
2186 {
+
2187 this->interval.end = exponent->interval.end;
+
2188 if (negative_exp_sign) negative_exp_sign->invalidate();
+
2189 }
+
2190 else if (exponent_symbol && exponent_symbol->match(text, this->interval.end, end, flags) &&
+
2191 negative_exp_sign && negative_exp_sign->match(text, exponent_symbol->interval.end, end, flags) &&
+
2192 exponent && exponent->match(text, negative_exp_sign->interval.end, end, flags))
+
2193 {
+
2194 this->interval.end = exponent->interval.end;
+
2195 if (positive_exp_sign) positive_exp_sign->invalidate();
+
2196 }
+
2197 else {
+
2198 if (exponent_symbol) exponent_symbol->invalidate();
+
2199 if (positive_exp_sign) positive_exp_sign->invalidate();
+
2200 if (negative_exp_sign) negative_exp_sign->invalidate();
+
2201 if (exponent) exponent->invalidate();
+
2202 }
+
2203
+
2204 value = (double)integer->value;
+
2205 if (decimal->interval)
+
2206 value += (double)decimal->value * pow(10.0, -(double)decimal->interval.size());
+
2207 if (negative_sign && negative_sign->interval)
+
2208 value = -value;
+
2209 if (exponent && exponent->interval) {
+
2210 double e = (double)exponent->value;
+
2211 if (negative_exp_sign && negative_exp_sign->interval)
+
2212 e = -e;
+
2213 value *= pow(10.0, e);
+
2214 }
+
2215
+
2216 this->interval.start = start;
+
2217 return true;
+
2218 }
+
2219 };
-
2219
-
2220 using scientific_numeral = basic_scientific_numeral<char>;
-
2221 using wscientific_numeral = basic_scientific_numeral<wchar_t>;
-
2222#ifdef _UNICODE
-
2223 using tscientific_numeral = wscientific_numeral;
-
2224#else
-
2225 using tscientific_numeral = scientific_numeral;
-
2226#endif
-
2227 using sgml_scientific_numeral = basic_scientific_numeral<char>;
-
2228
-
2232 template <class T>
-
- -
2234 {
-
2235 public:
- -
2237 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
-
2238 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
-
2239 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
-
2240 _In_ const std::shared_ptr<basic_parser<T>>& _currency,
-
2241 _In_ const std::shared_ptr<basic_parser<T>>& _integer,
-
2242 _In_ const std::shared_ptr<basic_parser<T>>& _decimal_separator,
-
2243 _In_ const std::shared_ptr<basic_parser<T>>& _decimal,
-
2244 _In_ const std::locale& locale = std::locale()) :
- - - - - - - - -
2253 {}
-
2254
-
2255 virtual void invalidate()
-
2256 {
-
2257 if (positive_sign) positive_sign->invalidate();
-
2258 if (negative_sign) negative_sign->invalidate();
-
2259 if (special_sign) special_sign->invalidate();
-
2260 currency->invalidate();
-
2261 integer->invalidate();
-
2262 decimal_separator->invalidate();
-
2263 decimal->invalidate();
- -
2265 }
-
2266
-
2267 std::shared_ptr<basic_parser<T>> positive_sign;
-
2268 std::shared_ptr<basic_parser<T>> negative_sign;
-
2269 std::shared_ptr<basic_parser<T>> special_sign;
-
2270 std::shared_ptr<basic_parser<T>> currency;
-
2271 std::shared_ptr<basic_parser<T>> integer;
-
2272 std::shared_ptr<basic_parser<T>> decimal_separator;
-
2273 std::shared_ptr<basic_parser<T>> decimal;
-
2274
-
2275 protected:
-
2276 virtual bool do_match(
-
2277 _In_reads_or_z_opt_(end) const T* text,
-
2278 _In_ size_t start = 0,
-
2279 _In_ size_t end = SIZE_MAX,
-
2280 _In_ int flags = match_default)
-
2281 {
-
2282 _Assume_(text || start >= end);
-
2283 this->interval.end = start;
-
2284
-
2285 if (positive_sign->match(text, this->interval.end, end, flags)) {
-
2286 this->interval.end = positive_sign->interval.end;
-
2287 if (negative_sign) negative_sign->invalidate();
-
2288 if (special_sign) special_sign->invalidate();
-
2289 }
-
2290 else if (negative_sign->match(text, this->interval.end, end, flags)) {
-
2291 this->interval.end = negative_sign->interval.end;
-
2292 if (positive_sign) positive_sign->invalidate();
-
2293 if (special_sign) special_sign->invalidate();
-
2294 }
-
2295 else if (special_sign->match(text, this->interval.end, end, flags)) {
-
2296 this->interval.end = special_sign->interval.end;
-
2297 if (positive_sign) positive_sign->invalidate();
-
2298 if (negative_sign) negative_sign->invalidate();
-
2299 }
-
2300 else {
-
2301 if (positive_sign) positive_sign->invalidate();
-
2302 if (negative_sign) negative_sign->invalidate();
-
2303 if (special_sign) special_sign->invalidate();
-
2304 }
-
2305
-
2306 if (currency->match(text, this->interval.end, end, flags))
-
2307 this->interval.end = currency->interval.end;
-
2308 else {
-
2309 if (positive_sign) positive_sign->invalidate();
-
2310 if (negative_sign) negative_sign->invalidate();
-
2311 if (special_sign) special_sign->invalidate();
-
2312 integer->invalidate();
-
2313 decimal_separator->invalidate();
-
2314 decimal->invalidate();
-
2315 this->interval.invalidate();
-
2316 return false;
-
2317 }
-
2318
-
2319 if (integer->match(text, this->interval.end, end, flags))
-
2320 this->interval.end = integer->interval.end;
-
2321 if (decimal_separator->match(text, this->interval.end, end, flags) &&
-
2322 decimal->match(text, decimal_separator->interval.end, end, flags))
-
2323 this->interval.end = decimal->interval.end;
-
2324 else {
-
2325 decimal_separator->invalidate();
-
2326 decimal->invalidate();
-
2327 }
-
2328
-
2329 if (integer->interval.empty() &&
-
2330 decimal->interval.empty())
-
2331 {
-
2332 // No integer part, no decimal part.
-
2333 if (positive_sign) positive_sign->invalidate();
-
2334 if (negative_sign) negative_sign->invalidate();
-
2335 if (special_sign) special_sign->invalidate();
-
2336 currency->invalidate();
-
2337 integer->invalidate();
-
2338 decimal_separator->invalidate();
-
2339 decimal->invalidate();
-
2340 this->interval.invalidate();
-
2341 return false;
-
2342 }
-
2343
-
2344 this->interval.start = start;
-
2345 return true;
-
2346 }
-
2347 };
+
2220
+
2221 using scientific_numeral = basic_scientific_numeral<char>;
+
2222 using wscientific_numeral = basic_scientific_numeral<wchar_t>;
+
2223#ifdef _UNICODE
+
2224 using tscientific_numeral = wscientific_numeral;
+
2225#else
+
2226 using tscientific_numeral = scientific_numeral;
+
2227#endif
+
2228 using sgml_scientific_numeral = basic_scientific_numeral<char>;
+
2229
+
2233 template <class T>
+
+ +
2235 {
+
2236 public:
+ +
2238 _In_ const std::shared_ptr<basic_parser<T>>& _positive_sign,
+
2239 _In_ const std::shared_ptr<basic_parser<T>>& _negative_sign,
+
2240 _In_ const std::shared_ptr<basic_parser<T>>& _special_sign,
+
2241 _In_ const std::shared_ptr<basic_parser<T>>& _currency,
+
2242 _In_ const std::shared_ptr<basic_parser<T>>& _integer,
+
2243 _In_ const std::shared_ptr<basic_parser<T>>& _decimal_separator,
+
2244 _In_ const std::shared_ptr<basic_parser<T>>& _decimal,
+
2245 _In_ const std::locale& locale = std::locale()) :
+ + + + + + + + +
2254 {}
+
2255
+
2256 virtual void invalidate()
+
2257 {
+
2258 if (positive_sign) positive_sign->invalidate();
+
2259 if (negative_sign) negative_sign->invalidate();
+
2260 if (special_sign) special_sign->invalidate();
+
2261 currency->invalidate();
+
2262 integer->invalidate();
+
2263 decimal_separator->invalidate();
+
2264 decimal->invalidate();
+ +
2266 }
+
2267
+
2268 std::shared_ptr<basic_parser<T>> positive_sign;
+
2269 std::shared_ptr<basic_parser<T>> negative_sign;
+
2270 std::shared_ptr<basic_parser<T>> special_sign;
+
2271 std::shared_ptr<basic_parser<T>> currency;
+
2272 std::shared_ptr<basic_parser<T>> integer;
+
2273 std::shared_ptr<basic_parser<T>> decimal_separator;
+
2274 std::shared_ptr<basic_parser<T>> decimal;
+
2275
+
2276 protected:
+
2277 virtual bool do_match(
+
2278 _In_reads_or_z_opt_(end) const T* text,
+
2279 _In_ size_t start = 0,
+
2280 _In_ size_t end = SIZE_MAX,
+
2281 _In_ int flags = match_default)
+
2282 {
+
2283 _Assume_(text || start >= end);
+
2284 this->interval.end = start;
+
2285
+
2286 if (positive_sign->match(text, this->interval.end, end, flags)) {
+
2287 this->interval.end = positive_sign->interval.end;
+
2288 if (negative_sign) negative_sign->invalidate();
+
2289 if (special_sign) special_sign->invalidate();
+
2290 }
+
2291 else if (negative_sign->match(text, this->interval.end, end, flags)) {
+
2292 this->interval.end = negative_sign->interval.end;
+
2293 if (positive_sign) positive_sign->invalidate();
+
2294 if (special_sign) special_sign->invalidate();
+
2295 }
+
2296 else if (special_sign->match(text, this->interval.end, end, flags)) {
+
2297 this->interval.end = special_sign->interval.end;
+
2298 if (positive_sign) positive_sign->invalidate();
+
2299 if (negative_sign) negative_sign->invalidate();
+
2300 }
+
2301 else {
+
2302 if (positive_sign) positive_sign->invalidate();
+
2303 if (negative_sign) negative_sign->invalidate();
+
2304 if (special_sign) special_sign->invalidate();
+
2305 }
+
2306
+
2307 if (currency->match(text, this->interval.end, end, flags))
+
2308 this->interval.end = currency->interval.end;
+
2309 else {
+
2310 if (positive_sign) positive_sign->invalidate();
+
2311 if (negative_sign) negative_sign->invalidate();
+
2312 if (special_sign) special_sign->invalidate();
+
2313 integer->invalidate();
+
2314 decimal_separator->invalidate();
+
2315 decimal->invalidate();
+
2316 this->interval.invalidate();
+
2317 return false;
+
2318 }
+
2319
+
2320 if (integer->match(text, this->interval.end, end, flags))
+
2321 this->interval.end = integer->interval.end;
+
2322 if (decimal_separator->match(text, this->interval.end, end, flags) &&
+
2323 decimal->match(text, decimal_separator->interval.end, end, flags))
+
2324 this->interval.end = decimal->interval.end;
+
2325 else {
+
2326 decimal_separator->invalidate();
+
2327 decimal->invalidate();
+
2328 }
+
2329
+
2330 if (integer->interval.empty() &&
+
2331 decimal->interval.empty())
+
2332 {
+
2333 // No integer part, no decimal part.
+
2334 if (positive_sign) positive_sign->invalidate();
+
2335 if (negative_sign) negative_sign->invalidate();
+
2336 if (special_sign) special_sign->invalidate();
+
2337 currency->invalidate();
+
2338 integer->invalidate();
+
2339 decimal_separator->invalidate();
+
2340 decimal->invalidate();
+
2341 this->interval.invalidate();
+
2342 return false;
+
2343 }
+
2344
+
2345 this->interval.start = start;
+
2346 return true;
+
2347 }
+
2348 };
-
2348
-
2349 using monetary_numeral = basic_monetary_numeral<char>;
-
2350 using wmonetary_numeral = basic_monetary_numeral<wchar_t>;
-
2351#ifdef _UNICODE
-
2352 using tmonetary_numeral = wmonetary_numeral;
-
2353#else
-
2354 using tmonetary_numeral = monetary_numeral;
-
2355#endif
-
2356 using sgml_monetary_numeral = basic_monetary_numeral<char>;
-
2357
-
2361 template <class T>
-
- -
2363 {
-
2364 public:
- -
2366 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
-
2367 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
-
2368 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
-
2369 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
-
2370 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
-
2371 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
-
2372 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
-
2373 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
-
2374 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
-
2375 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
-
2376 _In_ const std::shared_ptr<basic_parser<T>>& separator,
-
2377 _In_ const std::locale& locale = std::locale()) :
- -
2379 m_digit_0(digit_0),
-
2380 m_digit_1(digit_1),
-
2381 m_digit_2(digit_2),
-
2382 m_digit_3(digit_3),
-
2383 m_digit_4(digit_4),
-
2384 m_digit_5(digit_5),
-
2385 m_digit_6(digit_6),
-
2386 m_digit_7(digit_7),
-
2387 m_digit_8(digit_8),
-
2388 m_digit_9(digit_9),
-
2389 m_separator(separator)
-
2390 {
-
2391 value.s_addr = 0;
-
2392 }
-
2393
-
2394 virtual void invalidate()
-
2395 {
-
2396 components[0].start = 1;
-
2397 components[0].end = 0;
-
2398 components[1].start = 1;
-
2399 components[1].end = 0;
-
2400 components[2].start = 1;
-
2401 components[2].end = 0;
-
2402 components[3].start = 1;
-
2403 components[3].end = 0;
-
2404 value.s_addr = 0;
- -
2406 }
-
2407
- - -
2410
-
2411 protected:
-
2412 virtual bool do_match(
-
2413 _In_reads_or_z_opt_(end) const T* text,
-
2414 _In_ size_t start = 0,
-
2415 _In_ size_t end = SIZE_MAX,
-
2416 _In_ int flags = match_default)
-
2417 {
-
2418 _Assume_(text || start >= end);
-
2419 this->interval.end = start;
-
2420 value.s_addr = 0;
-
2421
-
2422 size_t i;
-
2423 for (i = 0; i < 4; i++) {
-
2424 if (i) {
-
2425 if (m_separator->match(text, this->interval.end, end, flags))
-
2426 this->interval.end = m_separator->interval.end;
-
2427 else
-
2428 goto error;
-
2429 }
-
2430
-
2431 components[i].start = this->interval.end;
-
2432 bool is_empty = true;
-
2433 size_t x;
-
2434 for (x = 0; this->interval.end < end && text[this->interval.end];) {
-
2435 size_t dig, digit_end;
-
2436 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; digit_end = m_digit_0->interval.end; }
-
2437 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; digit_end = m_digit_1->interval.end; }
-
2438 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; digit_end = m_digit_2->interval.end; }
-
2439 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; digit_end = m_digit_3->interval.end; }
-
2440 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; digit_end = m_digit_4->interval.end; }
-
2441 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; digit_end = m_digit_5->interval.end; }
-
2442 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; digit_end = m_digit_6->interval.end; }
-
2443 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; digit_end = m_digit_7->interval.end; }
-
2444 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; digit_end = m_digit_8->interval.end; }
-
2445 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; digit_end = m_digit_9->interval.end; }
-
2446 else break;
-
2447 size_t x_n = x * 10 + dig;
-
2448 if (x_n <= 255) {
-
2449 x = x_n;
-
2450 this->interval.end = digit_end;
-
2451 is_empty = false;
-
2452 }
-
2453 else
-
2454 break;
-
2455 }
-
2456 if (is_empty)
-
2457 goto error;
-
2458 components[i].end = this->interval.end;
-
2459 value.s_addr = (value.s_addr << 8) | (uint8_t)x;
-
2460 }
-
2461 if (i < 4)
-
2462 goto error;
-
2463
-
2464 HE2BE(reinterpret_cast<uint32_t&>(value.s_addr));
-
2465 this->interval.start = start;
-
2466 return true;
-
2467
-
2468 error:
-
2469 invalidate();
-
2470 return false;
-
2471 }
-
2472
-
2473 std::shared_ptr<basic_parser<T>>
-
2474 m_digit_0,
-
2475 m_digit_1,
-
2476 m_digit_2,
-
2477 m_digit_3,
-
2478 m_digit_4,
-
2479 m_digit_5,
-
2480 m_digit_6,
-
2481 m_digit_7,
-
2482 m_digit_8,
-
2483 m_digit_9;
-
2484 std::shared_ptr<basic_parser<T>> m_separator;
-
2485 };
+
2349
+
2350 using monetary_numeral = basic_monetary_numeral<char>;
+
2351 using wmonetary_numeral = basic_monetary_numeral<wchar_t>;
+
2352#ifdef _UNICODE
+
2353 using tmonetary_numeral = wmonetary_numeral;
+
2354#else
+
2355 using tmonetary_numeral = monetary_numeral;
+
2356#endif
+
2357 using sgml_monetary_numeral = basic_monetary_numeral<char>;
+
2358
+
2362 template <class T>
+
+ +
2364 {
+
2365 public:
+ +
2367 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
+
2368 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
+
2369 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
+
2370 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
+
2371 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
+
2372 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
+
2373 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
+
2374 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
+
2375 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
+
2376 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
+
2377 _In_ const std::shared_ptr<basic_parser<T>>& separator,
+
2378 _In_ const std::locale& locale = std::locale()) :
+ +
2380 m_digit_0(digit_0),
+
2381 m_digit_1(digit_1),
+
2382 m_digit_2(digit_2),
+
2383 m_digit_3(digit_3),
+
2384 m_digit_4(digit_4),
+
2385 m_digit_5(digit_5),
+
2386 m_digit_6(digit_6),
+
2387 m_digit_7(digit_7),
+
2388 m_digit_8(digit_8),
+
2389 m_digit_9(digit_9),
+
2390 m_separator(separator)
+
2391 {
+
2392 value.s_addr = 0;
+
2393 }
+
2394
+
2395 virtual void invalidate()
+
2396 {
+
2397 components[0].start = 1;
+
2398 components[0].end = 0;
+
2399 components[1].start = 1;
+
2400 components[1].end = 0;
+
2401 components[2].start = 1;
+
2402 components[2].end = 0;
+
2403 components[3].start = 1;
+
2404 components[3].end = 0;
+
2405 value.s_addr = 0;
+ +
2407 }
+
2408
+ + +
2411
+
2412 protected:
+
2413 virtual bool do_match(
+
2414 _In_reads_or_z_opt_(end) const T* text,
+
2415 _In_ size_t start = 0,
+
2416 _In_ size_t end = SIZE_MAX,
+
2417 _In_ int flags = match_default)
+
2418 {
+
2419 _Assume_(text || start >= end);
+
2420 this->interval.end = start;
+
2421 value.s_addr = 0;
+
2422
+
2423 size_t i;
+
2424 for (i = 0; i < 4; i++) {
+
2425 if (i) {
+
2426 if (m_separator->match(text, this->interval.end, end, flags))
+
2427 this->interval.end = m_separator->interval.end;
+
2428 else
+
2429 goto error;
+
2430 }
+
2431
+
2432 components[i].start = this->interval.end;
+
2433 bool is_empty = true;
+
2434 size_t x;
+
2435 for (x = 0; this->interval.end < end && text[this->interval.end];) {
+
2436 size_t dig, digit_end;
+
2437 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; digit_end = m_digit_0->interval.end; }
+
2438 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; digit_end = m_digit_1->interval.end; }
+
2439 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; digit_end = m_digit_2->interval.end; }
+
2440 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; digit_end = m_digit_3->interval.end; }
+
2441 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; digit_end = m_digit_4->interval.end; }
+
2442 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; digit_end = m_digit_5->interval.end; }
+
2443 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; digit_end = m_digit_6->interval.end; }
+
2444 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; digit_end = m_digit_7->interval.end; }
+
2445 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; digit_end = m_digit_8->interval.end; }
+
2446 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; digit_end = m_digit_9->interval.end; }
+
2447 else break;
+
2448 size_t x_n = x * 10 + dig;
+
2449 if (x_n <= 255) {
+
2450 x = x_n;
+
2451 this->interval.end = digit_end;
+
2452 is_empty = false;
+
2453 }
+
2454 else
+
2455 break;
+
2456 }
+
2457 if (is_empty)
+
2458 goto error;
+
2459 components[i].end = this->interval.end;
+
2460 value.s_addr = (value.s_addr << 8) | (uint8_t)x;
+
2461 }
+
2462 if (i < 4)
+
2463 goto error;
+
2464
+
2465 HE2BE(reinterpret_cast<uint32_t&>(value.s_addr));
+
2466 this->interval.start = start;
+
2467 return true;
+
2468
+
2469 error:
+
2470 invalidate();
+
2471 return false;
+
2472 }
+
2473
+
2474 std::shared_ptr<basic_parser<T>>
+
2475 m_digit_0,
+
2476 m_digit_1,
+
2477 m_digit_2,
+
2478 m_digit_3,
+
2479 m_digit_4,
+
2480 m_digit_5,
+
2481 m_digit_6,
+
2482 m_digit_7,
+
2483 m_digit_8,
+
2484 m_digit_9;
+
2485 std::shared_ptr<basic_parser<T>> m_separator;
+
2486 };
-
2486
-
2487 using ipv4_address = basic_ipv4_address<char>;
-
2488 using wipv4_address = basic_ipv4_address<wchar_t>;
-
2489#ifdef _UNICODE
-
2490 using tipv4_address = wipv4_address;
-
2491#else
-
2492 using tipv4_address = ipv4_address;
-
2493#endif
-
2494 using sgml_ipv4_address = basic_ipv4_address<char>;
-
2495
-
2499 template <class T>
-
- -
2501 {
-
2502 public:
-
2503 basic_ipv6_scope_id_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
2504
-
2505 protected:
-
2506 virtual bool do_match(
-
2507 _In_reads_or_z_opt_(end) const T* text,
-
2508 _In_ size_t start = 0,
-
2509 _In_ size_t end = SIZE_MAX,
-
2510 _In_ int flags = match_default)
-
2511 {
-
2512 _Assume_(text || start >= end);
-
2513 if (start < end && text[start]) {
-
2514 if (text[start] == '-' ||
-
2515 text[start] == '_' ||
-
2516 text[start] == ':' ||
-
2517 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
-
2518 {
-
2519 this->interval.end = (this->interval.start = start) + 1;
-
2520 return true;
-
2521 }
-
2522 }
-
2523 this->interval.invalidate();
-
2524 return false;
-
2525 }
-
2526 };
+
2487
+
2488 using ipv4_address = basic_ipv4_address<char>;
+
2489 using wipv4_address = basic_ipv4_address<wchar_t>;
+
2490#ifdef _UNICODE
+
2491 using tipv4_address = wipv4_address;
+
2492#else
+
2493 using tipv4_address = ipv4_address;
+
2494#endif
+
2495 using sgml_ipv4_address = basic_ipv4_address<char>;
+
2496
+
2500 template <class T>
+
+ +
2502 {
+
2503 public:
+
2504 basic_ipv6_scope_id_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
2505
+
2506 protected:
+
2507 virtual bool do_match(
+
2508 _In_reads_or_z_opt_(end) const T* text,
+
2509 _In_ size_t start = 0,
+
2510 _In_ size_t end = SIZE_MAX,
+
2511 _In_ int flags = match_default)
+
2512 {
+
2513 _Assume_(text || start >= end);
+
2514 if (start < end && text[start]) {
+
2515 if (text[start] == '-' ||
+
2516 text[start] == '_' ||
+
2517 text[start] == ':' ||
+
2518 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
+
2519 {
+
2520 this->interval.end = (this->interval.start = start) + 1;
+
2521 return true;
+
2522 }
+
2523 }
+
2524 this->interval.invalidate();
+
2525 return false;
+
2526 }
+
2527 };
-
2527
- - -
2530#ifdef _UNICODE
- -
2532#else
- -
2534#endif
-
2535
-
- -
2540 {
-
2541 public:
-
2542 sgml_ipv6_scope_id_char(_In_ const std::locale& locale = std::locale()) : sgml_parser(locale) {}
-
2543
-
2544 protected:
-
2545 virtual bool do_match(
-
2546 _In_reads_or_z_(end) const char* text,
-
2547 _In_ size_t start = 0,
-
2548 _In_ size_t end = SIZE_MAX,
-
2549 _In_ int flags = match_default)
-
2550 {
-
2551 _Assume_(text || start >= end);
-
2552 if (start < end && text[start]) {
-
2553 wchar_t buf[3];
-
2554 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
2555 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
2556 if (((chr[0] == L'-' ||
-
2557 chr[0] == L'_' ||
-
2558 chr[0] == L':') && chr[1] == 0) ||
-
2559 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
-
2560 {
-
2561 this->interval.start = start;
-
2562 return true;
-
2563 }
-
2564 }
-
2565 this->interval.invalidate();
-
2566 return false;
-
2567 }
-
2568 };
+
2528
+ + +
2531#ifdef _UNICODE
+ +
2533#else
+ +
2535#endif
+
2536
+
+ +
2541 {
+
2542 public:
+
2543 sgml_ipv6_scope_id_char(_In_ const std::locale& locale = std::locale()) : sgml_parser(locale) {}
+
2544
+
2545 protected:
+
2546 virtual bool do_match(
+
2547 _In_reads_or_z_(end) const char* text,
+
2548 _In_ size_t start = 0,
+
2549 _In_ size_t end = SIZE_MAX,
+
2550 _In_ int flags = match_default)
+
2551 {
+
2552 _Assume_(text || start >= end);
+
2553 if (start < end && text[start]) {
+
2554 wchar_t buf[3];
+
2555 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
2556 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
2557 if (((chr[0] == L'-' ||
+
2558 chr[0] == L'_' ||
+
2559 chr[0] == L':') && chr[1] == 0) ||
+
2560 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
+
2561 {
+
2562 this->interval.start = start;
+
2563 return true;
+
2564 }
+
2565 }
+
2566 this->interval.invalidate();
+
2567 return false;
+
2568 }
+
2569 };
-
2569
-
2573 template <class T>
-
- -
2575 {
-
2576 public:
- -
2578 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
-
2579 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
-
2580 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
-
2581 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
-
2582 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
-
2583 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
-
2584 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
-
2585 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
-
2586 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
-
2587 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
-
2588 _In_ const std::shared_ptr<basic_parser<T>>& digit_10,
-
2589 _In_ const std::shared_ptr<basic_parser<T>>& digit_11,
-
2590 _In_ const std::shared_ptr<basic_parser<T>>& digit_12,
-
2591 _In_ const std::shared_ptr<basic_parser<T>>& digit_13,
-
2592 _In_ const std::shared_ptr<basic_parser<T>>& digit_14,
-
2593 _In_ const std::shared_ptr<basic_parser<T>>& digit_15,
-
2594 _In_ const std::shared_ptr<basic_parser<T>>& separator,
-
2595 _In_ const std::shared_ptr<basic_parser<T>>& scope_id_separator = nullptr,
-
2596 _In_ const std::shared_ptr<basic_parser<T>>& _scope_id = nullptr,
-
2597 _In_ const std::locale& locale = std::locale()) :
- -
2599 m_digit_0(digit_0),
-
2600 m_digit_1(digit_1),
-
2601 m_digit_2(digit_2),
-
2602 m_digit_3(digit_3),
-
2603 m_digit_4(digit_4),
-
2604 m_digit_5(digit_5),
-
2605 m_digit_6(digit_6),
-
2606 m_digit_7(digit_7),
-
2607 m_digit_8(digit_8),
-
2608 m_digit_9(digit_9),
-
2609 m_digit_10(digit_10),
-
2610 m_digit_11(digit_11),
-
2611 m_digit_12(digit_12),
-
2612 m_digit_13(digit_13),
-
2613 m_digit_14(digit_14),
-
2614 m_digit_15(digit_15),
-
2615 m_separator(separator),
-
2616 m_scope_id_separator(scope_id_separator),
- -
2618 {
-
2619 memset(&value, 0, sizeof(value));
-
2620 }
-
2621
-
2622 virtual void invalidate()
-
2623 {
-
2624 components[0].start = 1;
-
2625 components[0].end = 0;
-
2626 components[1].start = 1;
-
2627 components[1].end = 0;
-
2628 components[2].start = 1;
-
2629 components[2].end = 0;
-
2630 components[3].start = 1;
-
2631 components[3].end = 0;
-
2632 components[4].start = 1;
-
2633 components[4].end = 0;
-
2634 components[5].start = 1;
-
2635 components[5].end = 0;
-
2636 components[6].start = 1;
-
2637 components[6].end = 0;
-
2638 components[7].start = 1;
-
2639 components[7].end = 0;
-
2640 memset(&value, 0, sizeof(value));
-
2641 if (scope_id) scope_id->invalidate();
- -
2643 }
-
2644
- - -
2647 std::shared_ptr<basic_parser<T>> scope_id;
-
2648
-
2649 protected:
-
2650 virtual bool do_match(
-
2651 _In_reads_or_z_opt_(end) const T* text,
-
2652 _In_ size_t start = 0,
-
2653 _In_ size_t end = SIZE_MAX,
-
2654 _In_ int flags = match_default)
-
2655 {
-
2656 _Assume_(text || start >= end);
-
2657 this->interval.end = start;
-
2658 memset(&value, 0, sizeof(value));
-
2659
-
2660 size_t i, compaction_i = SIZE_MAX, compaction_start = start;
-
2661 for (i = 0; i < 8; i++) {
-
2662 bool is_empty = true;
-
2663
-
2664 if (m_separator->match(text, this->interval.end, end, flags)) {
-
2665 // : found
-
2666 this->interval.end = m_separator->interval.end;
-
2667 if (m_separator->match(text, this->interval.end, end, flags)) {
-
2668 // :: found
-
2669 if (compaction_i == SIZE_MAX) {
-
2670 // Zero compaction start
-
2671 compaction_i = i;
-
2672 compaction_start = m_separator->interval.start;
-
2673 this->interval.end = m_separator->interval.end;
-
2674 }
-
2675 else {
-
2676 // More than one zero compaction
-
2677 break;
-
2678 }
-
2679 }
-
2680 else if (!i) {
-
2681 // Leading : found
-
2682 goto error;
-
2683 }
-
2684 }
-
2685 else if (i) {
-
2686 // : missing
-
2687 break;
-
2688 }
-
2689
-
2690 components[i].start = this->interval.end;
-
2691 size_t x;
-
2692 for (x = 0; this->interval.end < end && text[this->interval.end];) {
-
2693 size_t dig, digit_end;
-
2694 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; digit_end = m_digit_0->interval.end; }
-
2695 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; digit_end = m_digit_1->interval.end; }
-
2696 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; digit_end = m_digit_2->interval.end; }
-
2697 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; digit_end = m_digit_3->interval.end; }
-
2698 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; digit_end = m_digit_4->interval.end; }
-
2699 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; digit_end = m_digit_5->interval.end; }
-
2700 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; digit_end = m_digit_6->interval.end; }
-
2701 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; digit_end = m_digit_7->interval.end; }
-
2702 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; digit_end = m_digit_8->interval.end; }
-
2703 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; digit_end = m_digit_9->interval.end; }
-
2704 else if (m_digit_10->match(text, this->interval.end, end, flags)) { dig = 10; digit_end = m_digit_10->interval.end; }
-
2705 else if (m_digit_11->match(text, this->interval.end, end, flags)) { dig = 11; digit_end = m_digit_11->interval.end; }
-
2706 else if (m_digit_12->match(text, this->interval.end, end, flags)) { dig = 12; digit_end = m_digit_12->interval.end; }
-
2707 else if (m_digit_13->match(text, this->interval.end, end, flags)) { dig = 13; digit_end = m_digit_13->interval.end; }
-
2708 else if (m_digit_14->match(text, this->interval.end, end, flags)) { dig = 14; digit_end = m_digit_14->interval.end; }
-
2709 else if (m_digit_15->match(text, this->interval.end, end, flags)) { dig = 15; digit_end = m_digit_15->interval.end; }
-
2710 else break;
-
2711 size_t x_n = x * 16 + dig;
-
2712 if (x_n <= 0xffff) {
-
2713 x = x_n;
-
2714 this->interval.end = digit_end;
-
2715 is_empty = false;
-
2716 }
-
2717 else
-
2718 break;
-
2719 }
-
2720 if (is_empty) {
-
2721 if (compaction_i != SIZE_MAX) {
-
2722 // Zero compaction active: no sweat.
-
2723 break;
-
2724 }
-
2725 goto error;
-
2726 }
-
2727 components[i].end = this->interval.end;
-
2728 HE2BE(reinterpret_cast<uint16_t&>(this->value.s6_words[i]));
-
2729 }
-
2730
-
2731 if (compaction_i != SIZE_MAX) {
-
2732 // Align components right due to zero compaction.
-
2733 size_t j, k;
-
2734 for (j = 8, k = i; k > compaction_i;) {
-
2735 this->value.s6_words[--j] = this->value.s6_words[--k];
- -
2737 }
-
2738 for (; j > compaction_i;) {
-
2739 this->value.s6_words[--j] = 0;
-
2740 components[j].start =
- -
2742 }
-
2743 }
-
2744 else if (i < 8)
-
2745 goto error;
-
2746
-
2747 if (m_scope_id_separator && m_scope_id_separator->match(text, this->interval.end, end, flags) &&
-
2748 scope_id && scope_id->match(text, m_scope_id_separator->interval.end, end, flags))
-
2749 this->interval.end = scope_id->interval.end;
-
2750 else if (scope_id)
-
2751 scope_id->invalidate();
-
2752
-
2753 this->interval.start = start;
-
2754 return true;
-
2755
-
2756 error:
-
2757 invalidate();
-
2758 return false;
-
2759 }
-
2760
-
2761 std::shared_ptr<basic_parser<T>>
-
2762 m_digit_0,
-
2763 m_digit_1,
-
2764 m_digit_2,
-
2765 m_digit_3,
-
2766 m_digit_4,
-
2767 m_digit_5,
-
2768 m_digit_6,
-
2769 m_digit_7,
-
2770 m_digit_8,
-
2771 m_digit_9,
-
2772 m_digit_10,
-
2773 m_digit_11,
-
2774 m_digit_12,
-
2775 m_digit_13,
-
2776 m_digit_14,
-
2777 m_digit_15;
-
2778 std::shared_ptr<basic_parser<T>> m_separator, m_scope_id_separator;
-
2779 };
+
2570
+
2574 template <class T>
+
+ +
2576 {
+
2577 public:
+ +
2579 _In_ const std::shared_ptr<basic_parser<T>>& digit_0,
+
2580 _In_ const std::shared_ptr<basic_parser<T>>& digit_1,
+
2581 _In_ const std::shared_ptr<basic_parser<T>>& digit_2,
+
2582 _In_ const std::shared_ptr<basic_parser<T>>& digit_3,
+
2583 _In_ const std::shared_ptr<basic_parser<T>>& digit_4,
+
2584 _In_ const std::shared_ptr<basic_parser<T>>& digit_5,
+
2585 _In_ const std::shared_ptr<basic_parser<T>>& digit_6,
+
2586 _In_ const std::shared_ptr<basic_parser<T>>& digit_7,
+
2587 _In_ const std::shared_ptr<basic_parser<T>>& digit_8,
+
2588 _In_ const std::shared_ptr<basic_parser<T>>& digit_9,
+
2589 _In_ const std::shared_ptr<basic_parser<T>>& digit_10,
+
2590 _In_ const std::shared_ptr<basic_parser<T>>& digit_11,
+
2591 _In_ const std::shared_ptr<basic_parser<T>>& digit_12,
+
2592 _In_ const std::shared_ptr<basic_parser<T>>& digit_13,
+
2593 _In_ const std::shared_ptr<basic_parser<T>>& digit_14,
+
2594 _In_ const std::shared_ptr<basic_parser<T>>& digit_15,
+
2595 _In_ const std::shared_ptr<basic_parser<T>>& separator,
+
2596 _In_ const std::shared_ptr<basic_parser<T>>& scope_id_separator = nullptr,
+
2597 _In_ const std::shared_ptr<basic_parser<T>>& _scope_id = nullptr,
+
2598 _In_ const std::locale& locale = std::locale()) :
+ +
2600 m_digit_0(digit_0),
+
2601 m_digit_1(digit_1),
+
2602 m_digit_2(digit_2),
+
2603 m_digit_3(digit_3),
+
2604 m_digit_4(digit_4),
+
2605 m_digit_5(digit_5),
+
2606 m_digit_6(digit_6),
+
2607 m_digit_7(digit_7),
+
2608 m_digit_8(digit_8),
+
2609 m_digit_9(digit_9),
+
2610 m_digit_10(digit_10),
+
2611 m_digit_11(digit_11),
+
2612 m_digit_12(digit_12),
+
2613 m_digit_13(digit_13),
+
2614 m_digit_14(digit_14),
+
2615 m_digit_15(digit_15),
+
2616 m_separator(separator),
+
2617 m_scope_id_separator(scope_id_separator),
+ +
2619 {
+
2620 memset(&value, 0, sizeof(value));
+
2621 }
+
2622
+
2623 virtual void invalidate()
+
2624 {
+
2625 components[0].start = 1;
+
2626 components[0].end = 0;
+
2627 components[1].start = 1;
+
2628 components[1].end = 0;
+
2629 components[2].start = 1;
+
2630 components[2].end = 0;
+
2631 components[3].start = 1;
+
2632 components[3].end = 0;
+
2633 components[4].start = 1;
+
2634 components[4].end = 0;
+
2635 components[5].start = 1;
+
2636 components[5].end = 0;
+
2637 components[6].start = 1;
+
2638 components[6].end = 0;
+
2639 components[7].start = 1;
+
2640 components[7].end = 0;
+
2641 memset(&value, 0, sizeof(value));
+
2642 if (scope_id) scope_id->invalidate();
+ +
2644 }
+
2645
+ + +
2648 std::shared_ptr<basic_parser<T>> scope_id;
+
2649
+
2650 protected:
+
2651 virtual bool do_match(
+
2652 _In_reads_or_z_opt_(end) const T* text,
+
2653 _In_ size_t start = 0,
+
2654 _In_ size_t end = SIZE_MAX,
+
2655 _In_ int flags = match_default)
+
2656 {
+
2657 _Assume_(text || start >= end);
+
2658 this->interval.end = start;
+
2659 memset(&value, 0, sizeof(value));
+
2660
+
2661 size_t i, compaction_i = SIZE_MAX, compaction_start = start;
+
2662 for (i = 0; i < 8; i++) {
+
2663 bool is_empty = true;
+
2664
+
2665 if (m_separator->match(text, this->interval.end, end, flags)) {
+
2666 // : found
+
2667 this->interval.end = m_separator->interval.end;
+
2668 if (m_separator->match(text, this->interval.end, end, flags)) {
+
2669 // :: found
+
2670 if (compaction_i == SIZE_MAX) {
+
2671 // Zero compaction start
+
2672 compaction_i = i;
+
2673 compaction_start = m_separator->interval.start;
+
2674 this->interval.end = m_separator->interval.end;
+
2675 }
+
2676 else {
+
2677 // More than one zero compaction
+
2678 break;
+
2679 }
+
2680 }
+
2681 else if (!i) {
+
2682 // Leading : found
+
2683 goto error;
+
2684 }
+
2685 }
+
2686 else if (i) {
+
2687 // : missing
+
2688 break;
+
2689 }
+
2690
+
2691 components[i].start = this->interval.end;
+
2692 size_t x;
+
2693 for (x = 0; this->interval.end < end && text[this->interval.end];) {
+
2694 size_t dig, digit_end;
+
2695 if (m_digit_0->match(text, this->interval.end, end, flags)) { dig = 0; digit_end = m_digit_0->interval.end; }
+
2696 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; digit_end = m_digit_1->interval.end; }
+
2697 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; digit_end = m_digit_2->interval.end; }
+
2698 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; digit_end = m_digit_3->interval.end; }
+
2699 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; digit_end = m_digit_4->interval.end; }
+
2700 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; digit_end = m_digit_5->interval.end; }
+
2701 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; digit_end = m_digit_6->interval.end; }
+
2702 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; digit_end = m_digit_7->interval.end; }
+
2703 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; digit_end = m_digit_8->interval.end; }
+
2704 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; digit_end = m_digit_9->interval.end; }
+
2705 else if (m_digit_10->match(text, this->interval.end, end, flags)) { dig = 10; digit_end = m_digit_10->interval.end; }
+
2706 else if (m_digit_11->match(text, this->interval.end, end, flags)) { dig = 11; digit_end = m_digit_11->interval.end; }
+
2707 else if (m_digit_12->match(text, this->interval.end, end, flags)) { dig = 12; digit_end = m_digit_12->interval.end; }
+
2708 else if (m_digit_13->match(text, this->interval.end, end, flags)) { dig = 13; digit_end = m_digit_13->interval.end; }
+
2709 else if (m_digit_14->match(text, this->interval.end, end, flags)) { dig = 14; digit_end = m_digit_14->interval.end; }
+
2710 else if (m_digit_15->match(text, this->interval.end, end, flags)) { dig = 15; digit_end = m_digit_15->interval.end; }
+
2711 else break;
+
2712 size_t x_n = x * 16 + dig;
+
2713 if (x_n <= 0xffff) {
+
2714 x = x_n;
+
2715 this->interval.end = digit_end;
+
2716 is_empty = false;
+
2717 }
+
2718 else
+
2719 break;
+
2720 }
+
2721 if (is_empty) {
+
2722 if (compaction_i != SIZE_MAX) {
+
2723 // Zero compaction active: no sweat.
+
2724 break;
+
2725 }
+
2726 goto error;
+
2727 }
+
2728 components[i].end = this->interval.end;
+
2729 HE2BE(reinterpret_cast<uint16_t&>(this->value.s6_words[i]));
+
2730 }
+
2731
+
2732 if (compaction_i != SIZE_MAX) {
+
2733 // Align components right due to zero compaction.
+
2734 size_t j, k;
+
2735 for (j = 8, k = i; k > compaction_i;) {
+
2736 this->value.s6_words[--j] = this->value.s6_words[--k];
+ +
2738 }
+
2739 for (; j > compaction_i;) {
+
2740 this->value.s6_words[--j] = 0;
+
2741 components[j].start =
+ +
2743 }
+
2744 }
+
2745 else if (i < 8)
+
2746 goto error;
+
2747
+
2748 if (m_scope_id_separator && m_scope_id_separator->match(text, this->interval.end, end, flags) &&
+
2749 scope_id && scope_id->match(text, m_scope_id_separator->interval.end, end, flags))
+
2750 this->interval.end = scope_id->interval.end;
+
2751 else if (scope_id)
+
2752 scope_id->invalidate();
+
2753
+
2754 this->interval.start = start;
+
2755 return true;
+
2756
+
2757 error:
+
2758 invalidate();
+
2759 return false;
+
2760 }
+
2761
+
2762 std::shared_ptr<basic_parser<T>>
+
2763 m_digit_0,
+
2764 m_digit_1,
+
2765 m_digit_2,
+
2766 m_digit_3,
+
2767 m_digit_4,
+
2768 m_digit_5,
+
2769 m_digit_6,
+
2770 m_digit_7,
+
2771 m_digit_8,
+
2772 m_digit_9,
+
2773 m_digit_10,
+
2774 m_digit_11,
+
2775 m_digit_12,
+
2776 m_digit_13,
+
2777 m_digit_14,
+
2778 m_digit_15;
+
2779 std::shared_ptr<basic_parser<T>> m_separator, m_scope_id_separator;
+
2780 };
-
2780
-
2781 using ipv6_address = basic_ipv6_address<char>;
-
2782 using wipv6_address = basic_ipv6_address<wchar_t>;
-
2783#ifdef _UNICODE
-
2784 using tipv6_address = wipv6_address;
-
2785#else
-
2786 using tipv6_address = ipv6_address;
-
2787#endif
-
2788 using sgml_ipv6_address = basic_ipv6_address<char>;
-
2789
-
2793 template <class T>
-
- -
2795 {
-
2796 public:
- -
2798 _In_ bool allow_idn,
-
2799 _In_ const std::locale& locale = std::locale()) :
- -
2801 m_allow_idn(allow_idn),
-
2802 allow_on_edge(true)
-
2803 {}
-
2804
- -
2806
-
2807 protected:
-
2808 virtual bool do_match(
-
2809 _In_reads_or_z_opt_(end) const T* text,
-
2810 _In_ size_t start = 0,
-
2811 _In_ size_t end = SIZE_MAX,
-
2812 _In_ int flags = match_default)
-
2813 {
-
2814 _Assume_(text || start >= end);
-
2815 if (start < end && text[start]) {
-
2816 if (('A' <= text[start] && text[start] <= 'Z') ||
-
2817 ('a' <= text[start] && text[start] <= 'z') ||
-
2818 ('0' <= text[start] && text[start] <= '9'))
-
2819 allow_on_edge = true;
-
2820 else if (text[start] == '-')
-
2821 allow_on_edge = false;
-
2822 else if (m_allow_idn && std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
-
2823 allow_on_edge = true;
-
2824 else {
-
2825 this->interval.invalidate();
-
2826 return false;
-
2827 }
-
2828 this->interval.end = (this->interval.start = start) + 1;
-
2829 return true;
-
2830 }
-
2831 this->interval.invalidate();
-
2832 return false;
-
2833 }
-
2834
-
2835 bool m_allow_idn;
-
2836 };
+
2781
+
2782 using ipv6_address = basic_ipv6_address<char>;
+
2783 using wipv6_address = basic_ipv6_address<wchar_t>;
+
2784#ifdef _UNICODE
+
2785 using tipv6_address = wipv6_address;
+
2786#else
+
2787 using tipv6_address = ipv6_address;
+
2788#endif
+
2789 using sgml_ipv6_address = basic_ipv6_address<char>;
+
2790
+
2794 template <class T>
+
+ +
2796 {
+
2797 public:
+ +
2799 _In_ bool allow_idn,
+
2800 _In_ const std::locale& locale = std::locale()) :
+ +
2802 m_allow_idn(allow_idn),
+
2803 allow_on_edge(true)
+
2804 {}
+
2805
+ +
2807
+
2808 protected:
+
2809 virtual bool do_match(
+
2810 _In_reads_or_z_opt_(end) const T* text,
+
2811 _In_ size_t start = 0,
+
2812 _In_ size_t end = SIZE_MAX,
+
2813 _In_ int flags = match_default)
+
2814 {
+
2815 _Assume_(text || start >= end);
+
2816 if (start < end && text[start]) {
+
2817 if (('A' <= text[start] && text[start] <= 'Z') ||
+
2818 ('a' <= text[start] && text[start] <= 'z') ||
+
2819 ('0' <= text[start] && text[start] <= '9'))
+
2820 allow_on_edge = true;
+
2821 else if (text[start] == '-')
+
2822 allow_on_edge = false;
+
2823 else if (m_allow_idn && std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
+
2824 allow_on_edge = true;
+
2825 else {
+
2826 this->interval.invalidate();
+
2827 return false;
+
2828 }
+
2829 this->interval.end = (this->interval.start = start) + 1;
+
2830 return true;
+
2831 }
+
2832 this->interval.invalidate();
+
2833 return false;
+
2834 }
+
2835
+
2836 bool m_allow_idn;
+
2837 };
-
2837
-
2838 using dns_domain_char = basic_dns_domain_char<char>;
-
2839 using wdns_domain_char = basic_dns_domain_char<wchar_t>;
-
2840#ifdef _UNICODE
-
2841 using tdns_domain_char = wdns_domain_char;
-
2842#else
-
2843 using tdns_domain_char = dns_domain_char;
-
2844#endif
-
2845
-
- -
2850 {
-
2851 public:
- -
2853 _In_ bool allow_idn,
-
2854 _In_ const std::locale& locale = std::locale()) :
- -
2856 {}
-
2857
-
2858 protected:
-
2859 virtual bool do_match(
-
2860 _In_reads_or_z_(end) const char* text,
-
2861 _In_ size_t start = 0,
-
2862 _In_ size_t end = SIZE_MAX,
-
2863 _In_ int flags = match_default)
-
2864 {
-
2865 _Assume_(text || start >= end);
-
2866 if (start < end && text[start]) {
-
2867 wchar_t buf[3];
-
2868 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
2869 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
2870 if ((('A' <= chr[0] && chr[0] <= 'Z') ||
-
2871 ('a' <= chr[0] && chr[0] <= 'z') ||
-
2872 ('0' <= chr[0] && chr[0] <= '9')) && chr[1] == 0)
-
2873 allow_on_edge = true;
-
2874 else if (chr[0] == '-' && chr[1] == 0)
-
2875 allow_on_edge = false;
-
2876 else if (m_allow_idn && std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
-
2877 allow_on_edge = true;
-
2878 else {
-
2879 this->interval.invalidate();
-
2880 return false;
-
2881 }
-
2882 this->interval.start = start;
-
2883 return true;
-
2884 }
-
2885 this->interval.invalidate();
-
2886 return false;
-
2887 }
-
2888 };
+
2838
+
2839 using dns_domain_char = basic_dns_domain_char<char>;
+
2840 using wdns_domain_char = basic_dns_domain_char<wchar_t>;
+
2841#ifdef _UNICODE
+
2842 using tdns_domain_char = wdns_domain_char;
+
2843#else
+
2844 using tdns_domain_char = dns_domain_char;
+
2845#endif
+
2846
+
+ +
2851 {
+
2852 public:
+ +
2854 _In_ bool allow_idn,
+
2855 _In_ const std::locale& locale = std::locale()) :
+ +
2857 {}
+
2858
+
2859 protected:
+
2860 virtual bool do_match(
+
2861 _In_reads_or_z_(end) const char* text,
+
2862 _In_ size_t start = 0,
+
2863 _In_ size_t end = SIZE_MAX,
+
2864 _In_ int flags = match_default)
+
2865 {
+
2866 _Assume_(text || start >= end);
+
2867 if (start < end && text[start]) {
+
2868 wchar_t buf[3];
+
2869 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
2870 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
2871 if ((('A' <= chr[0] && chr[0] <= 'Z') ||
+
2872 ('a' <= chr[0] && chr[0] <= 'z') ||
+
2873 ('0' <= chr[0] && chr[0] <= '9')) && chr[1] == 0)
+
2874 allow_on_edge = true;
+
2875 else if (chr[0] == '-' && chr[1] == 0)
+
2876 allow_on_edge = false;
+
2877 else if (m_allow_idn && std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
+
2878 allow_on_edge = true;
+
2879 else {
+
2880 this->interval.invalidate();
+
2881 return false;
+
2882 }
+
2883 this->interval.start = start;
+
2884 return true;
+
2885 }
+
2886 this->interval.invalidate();
+
2887 return false;
+
2888 }
+
2889 };
-
2889
-
2893 template <class T>
-
- -
2895 {
-
2896 public:
- -
2898 _In_ bool allow_absolute,
-
2899 _In_ const std::shared_ptr<basic_dns_domain_char<T>>& domain_char,
-
2900 _In_ const std::shared_ptr<basic_parser<T>>& separator,
-
2901 _In_ const std::locale& locale = std::locale()) :
- - -
2904 m_domain_char(domain_char),
-
2905 m_separator(separator)
-
2906 {}
-
2907
-
2908 protected:
-
2909 virtual bool do_match(
-
2910 _In_reads_or_z_opt_(end) const T* text,
-
2911 _In_ size_t start = 0,
-
2912 _In_ size_t end = SIZE_MAX,
-
2913 _In_ int flags = match_default)
-
2914 {
-
2915 _Assume_(text || start >= end);
-
2916 size_t i = start, count;
-
2917 for (count = 0; i < end && text[i] && count < 127; count++) {
-
2918 if (m_domain_char->match(text, i, end, flags) &&
-
2919 m_domain_char->allow_on_edge)
-
2920 {
-
2921 // Domain start
-
2922 this->interval.end = i = m_domain_char->interval.end;
-
2923 while (i < end && text[i]) {
-
2924 if (m_domain_char->allow_on_edge &&
-
2925 m_separator->match(text, i, end, flags))
-
2926 {
-
2927 // Domain end
-
2928 if (m_allow_absolute)
-
2929 this->interval.end = i = m_separator->interval.end;
-
2930 else {
-
2931 this->interval.end = i;
-
2932 i = m_separator->interval.end;
-
2933 }
-
2934 break;
-
2935 }
-
2936 if (m_domain_char->match(text, i, end, flags)) {
-
2937 if (m_domain_char->allow_on_edge)
-
2938 this->interval.end = i = m_domain_char->interval.end;
-
2939 else
-
2940 i = m_domain_char->interval.end;
-
2941 }
-
2942 else {
-
2943 this->interval.start = start;
-
2944 return true;
-
2945 }
-
2946 }
-
2947 }
-
2948 else
-
2949 break;
-
2950 }
-
2951 if (count) {
-
2952 this->interval.start = start;
-
2953 return true;
-
2954 }
-
2955 this->interval.invalidate();
-
2956 return false;
-
2957 }
-
2958
- -
2960 std::shared_ptr<basic_dns_domain_char<T>> m_domain_char;
-
2961 std::shared_ptr<basic_parser<T>> m_separator;
-
2962 };
+
2890
+
2894 template <class T>
+
+ +
2896 {
+
2897 public:
+ +
2899 _In_ bool allow_absolute,
+
2900 _In_ const std::shared_ptr<basic_dns_domain_char<T>>& domain_char,
+
2901 _In_ const std::shared_ptr<basic_parser<T>>& separator,
+
2902 _In_ const std::locale& locale = std::locale()) :
+ + +
2905 m_domain_char(domain_char),
+
2906 m_separator(separator)
+
2907 {}
+
2908
+
2909 protected:
+
2910 virtual bool do_match(
+
2911 _In_reads_or_z_opt_(end) const T* text,
+
2912 _In_ size_t start = 0,
+
2913 _In_ size_t end = SIZE_MAX,
+
2914 _In_ int flags = match_default)
+
2915 {
+
2916 _Assume_(text || start >= end);
+
2917 size_t i = start, count;
+
2918 for (count = 0; i < end && text[i] && count < 127; count++) {
+
2919 if (m_domain_char->match(text, i, end, flags) &&
+
2920 m_domain_char->allow_on_edge)
+
2921 {
+
2922 // Domain start
+
2923 this->interval.end = i = m_domain_char->interval.end;
+
2924 while (i < end && text[i]) {
+
2925 if (m_domain_char->allow_on_edge &&
+
2926 m_separator->match(text, i, end, flags))
+
2927 {
+
2928 // Domain end
+
2929 if (m_allow_absolute)
+
2930 this->interval.end = i = m_separator->interval.end;
+
2931 else {
+
2932 this->interval.end = i;
+
2933 i = m_separator->interval.end;
+
2934 }
+
2935 break;
+
2936 }
+
2937 if (m_domain_char->match(text, i, end, flags)) {
+
2938 if (m_domain_char->allow_on_edge)
+
2939 this->interval.end = i = m_domain_char->interval.end;
+
2940 else
+
2941 i = m_domain_char->interval.end;
+
2942 }
+
2943 else {
+
2944 this->interval.start = start;
+
2945 return true;
+
2946 }
+
2947 }
+
2948 }
+
2949 else
+
2950 break;
+
2951 }
+
2952 if (count) {
+
2953 this->interval.start = start;
+
2954 return true;
+
2955 }
+
2956 this->interval.invalidate();
+
2957 return false;
+
2958 }
+
2959
+ +
2961 std::shared_ptr<basic_dns_domain_char<T>> m_domain_char;
+
2962 std::shared_ptr<basic_parser<T>> m_separator;
+
2963 };
-
2963
- - -
2966#ifdef _UNICODE
-
2967 using tdns_name = wdns_name;
-
2968#else
-
2969 using tdns_name = dns_name;
-
2970#endif
- -
2972
-
2976 template <class T>
-
- -
2978 {
-
2979 public:
-
2980 basic_url_username_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
2981
-
2982 protected:
-
2983 virtual bool do_match(
-
2984 _In_reads_or_z_opt_(end) const T* text,
-
2985 _In_ size_t start = 0,
-
2986 _In_ size_t end = SIZE_MAX,
-
2987 _In_ int flags = match_default)
-
2988 {
-
2989 _Assume_(text || start >= end);
-
2990 if (start < end && text[start]) {
-
2991 if (text[start] == '-' ||
-
2992 text[start] == '.' ||
-
2993 text[start] == '_' ||
-
2994 text[start] == '~' ||
-
2995 text[start] == '%' ||
-
2996 text[start] == '!' ||
-
2997 text[start] == '$' ||
-
2998 text[start] == '&' ||
-
2999 text[start] == '\'' ||
-
3000 //text[start] == '(' ||
-
3001 //text[start] == ')' ||
-
3002 text[start] == '*' ||
-
3003 text[start] == '+' ||
-
3004 text[start] == ',' ||
-
3005 text[start] == ';' ||
-
3006 text[start] == '=' ||
-
3007 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
-
3008 {
-
3009 this->interval.end = (this->interval.start = start) + 1;
-
3010 return true;
-
3011 }
-
3012 }
-
3013 this->interval.invalidate();
-
3014 return false;
-
3015 }
-
3016 };
+
2964
+ + +
2967#ifdef _UNICODE
+
2968 using tdns_name = wdns_name;
+
2969#else
+
2970 using tdns_name = dns_name;
+
2971#endif
+ +
2973
+
2977 template <class T>
+
+ +
2979 {
+
2980 public:
+
2981 basic_url_username_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
2982
+
2983 protected:
+
2984 virtual bool do_match(
+
2985 _In_reads_or_z_opt_(end) const T* text,
+
2986 _In_ size_t start = 0,
+
2987 _In_ size_t end = SIZE_MAX,
+
2988 _In_ int flags = match_default)
+
2989 {
+
2990 _Assume_(text || start >= end);
+
2991 if (start < end && text[start]) {
+
2992 if (text[start] == '-' ||
+
2993 text[start] == '.' ||
+
2994 text[start] == '_' ||
+
2995 text[start] == '~' ||
+
2996 text[start] == '%' ||
+
2997 text[start] == '!' ||
+
2998 text[start] == '$' ||
+
2999 text[start] == '&' ||
+
3000 text[start] == '\'' ||
+
3001 //text[start] == '(' ||
+
3002 //text[start] == ')' ||
+
3003 text[start] == '*' ||
+
3004 text[start] == '+' ||
+
3005 text[start] == ',' ||
+
3006 text[start] == ';' ||
+
3007 text[start] == '=' ||
+
3008 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
+
3009 {
+
3010 this->interval.end = (this->interval.start = start) + 1;
+
3011 return true;
+
3012 }
+
3013 }
+
3014 this->interval.invalidate();
+
3015 return false;
+
3016 }
+
3017 };
-
3017
- - -
3020#ifdef _UNICODE
- -
3022#else
- -
3024#endif
-
3025
-
- -
3030 {
-
3031 public:
-
3032 sgml_url_username_char(_In_ const std::locale& locale = std::locale()) : basic_url_username_char<char>(locale) {}
-
3033
-
3034 protected:
-
3035 virtual bool do_match(
-
3036 _In_reads_or_z_(end) const char* text,
-
3037 _In_ size_t start = 0,
-
3038 _In_ size_t end = SIZE_MAX,
-
3039 _In_ int flags = match_default)
-
3040 {
-
3041 _Assume_(text || start >= end);
-
3042 if (start < end && text[start]) {
-
3043 wchar_t buf[3];
-
3044 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
3045 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
3046 if (((chr[0] == L'-' ||
-
3047 chr[0] == L'.' ||
-
3048 chr[0] == L'_' ||
-
3049 chr[0] == L'~' ||
-
3050 chr[0] == L'%' ||
-
3051 chr[0] == L'!' ||
-
3052 chr[0] == L'$' ||
-
3053 chr[0] == L'&' ||
-
3054 chr[0] == L'\'' ||
-
3055 //chr[0] == L'(' ||
-
3056 //chr[0] == L')' ||
-
3057 chr[0] == L'*' ||
-
3058 chr[0] == L'+' ||
-
3059 chr[0] == L',' ||
-
3060 chr[0] == L';' ||
-
3061 chr[0] == L'=') && chr[1] == 0) ||
-
3062 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
-
3063 {
-
3064 this->interval.start = start;
-
3065 return true;
-
3066 }
-
3067 }
-
3068
-
3069 this->interval.invalidate();
-
3070 return false;
-
3071 }
-
3072 };
+
3018
+ + +
3021#ifdef _UNICODE
+ +
3023#else
+ +
3025#endif
+
3026
+
+ +
3031 {
+
3032 public:
+
3033 sgml_url_username_char(_In_ const std::locale& locale = std::locale()) : basic_url_username_char<char>(locale) {}
+
3034
+
3035 protected:
+
3036 virtual bool do_match(
+
3037 _In_reads_or_z_(end) const char* text,
+
3038 _In_ size_t start = 0,
+
3039 _In_ size_t end = SIZE_MAX,
+
3040 _In_ int flags = match_default)
+
3041 {
+
3042 _Assume_(text || start >= end);
+
3043 if (start < end && text[start]) {
+
3044 wchar_t buf[3];
+
3045 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
3046 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
3047 if (((chr[0] == L'-' ||
+
3048 chr[0] == L'.' ||
+
3049 chr[0] == L'_' ||
+
3050 chr[0] == L'~' ||
+
3051 chr[0] == L'%' ||
+
3052 chr[0] == L'!' ||
+
3053 chr[0] == L'$' ||
+
3054 chr[0] == L'&' ||
+
3055 chr[0] == L'\'' ||
+
3056 //chr[0] == L'(' ||
+
3057 //chr[0] == L')' ||
+
3058 chr[0] == L'*' ||
+
3059 chr[0] == L'+' ||
+
3060 chr[0] == L',' ||
+
3061 chr[0] == L';' ||
+
3062 chr[0] == L'=') && chr[1] == 0) ||
+
3063 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
+
3064 {
+
3065 this->interval.start = start;
+
3066 return true;
+
3067 }
+
3068 }
+
3069
+
3070 this->interval.invalidate();
+
3071 return false;
+
3072 }
+
3073 };
-
3073
-
3077 template <class T>
-
- -
3079 {
-
3080 public:
-
3081 basic_url_password_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
3082
-
3083 protected:
-
3084 virtual bool do_match(
-
3085 _In_reads_or_z_opt_(end) const T* text,
-
3086 _In_ size_t start = 0,
-
3087 _In_ size_t end = SIZE_MAX,
-
3088 _In_ int flags = match_default)
-
3089 {
-
3090 _Assume_(text || start >= end);
-
3091 if (start < end && text[start]) {
-
3092 if (text[start] == '-' ||
-
3093 text[start] == '.' ||
-
3094 text[start] == '_' ||
-
3095 text[start] == '~' ||
-
3096 text[start] == '%' ||
-
3097 text[start] == '!' ||
-
3098 text[start] == '$' ||
-
3099 text[start] == '&' ||
-
3100 text[start] == '\'' ||
-
3101 text[start] == '(' ||
-
3102 text[start] == ')' ||
-
3103 text[start] == '*' ||
-
3104 text[start] == '+' ||
-
3105 text[start] == ',' ||
-
3106 text[start] == ';' ||
-
3107 text[start] == '=' ||
-
3108 text[start] == ':' ||
-
3109 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
-
3110 {
-
3111 this->interval.end = (this->interval.start = start) + 1;
-
3112 return true;
-
3113 }
-
3114 }
-
3115 this->interval.invalidate();
-
3116 return false;
-
3117 }
-
3118 };
+
3074
+
3078 template <class T>
+
+ +
3080 {
+
3081 public:
+
3082 basic_url_password_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
3083
+
3084 protected:
+
3085 virtual bool do_match(
+
3086 _In_reads_or_z_opt_(end) const T* text,
+
3087 _In_ size_t start = 0,
+
3088 _In_ size_t end = SIZE_MAX,
+
3089 _In_ int flags = match_default)
+
3090 {
+
3091 _Assume_(text || start >= end);
+
3092 if (start < end && text[start]) {
+
3093 if (text[start] == '-' ||
+
3094 text[start] == '.' ||
+
3095 text[start] == '_' ||
+
3096 text[start] == '~' ||
+
3097 text[start] == '%' ||
+
3098 text[start] == '!' ||
+
3099 text[start] == '$' ||
+
3100 text[start] == '&' ||
+
3101 text[start] == '\'' ||
+
3102 text[start] == '(' ||
+
3103 text[start] == ')' ||
+
3104 text[start] == '*' ||
+
3105 text[start] == '+' ||
+
3106 text[start] == ',' ||
+
3107 text[start] == ';' ||
+
3108 text[start] == '=' ||
+
3109 text[start] == ':' ||
+
3110 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
+
3111 {
+
3112 this->interval.end = (this->interval.start = start) + 1;
+
3113 return true;
+
3114 }
+
3115 }
+
3116 this->interval.invalidate();
+
3117 return false;
+
3118 }
+
3119 };
-
3119
- - -
3122#ifdef _UNICODE
- -
3124#else
- -
3126#endif
-
3127
-
- -
3132 {
-
3133 public:
-
3134 sgml_url_password_char(_In_ const std::locale& locale = std::locale()) : basic_url_password_char<char>(locale) {}
-
3135
-
3136 protected:
-
3137 virtual bool do_match(
-
3138 _In_reads_or_z_(end) const char* text,
-
3139 _In_ size_t start = 0,
-
3140 _In_ size_t end = SIZE_MAX,
-
3141 _In_ int flags = match_default)
-
3142 {
-
3143 _Assume_(text || start >= end);
-
3144 if (start < end && text[start]) {
-
3145 wchar_t buf[3];
-
3146 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
3147 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
3148 if (((chr[0] == L'-' ||
-
3149 chr[0] == L'.' ||
-
3150 chr[0] == L'_' ||
-
3151 chr[0] == L'~' ||
-
3152 chr[0] == L'%' ||
-
3153 chr[0] == L'!' ||
-
3154 chr[0] == L'$' ||
-
3155 chr[0] == L'&' ||
-
3156 chr[0] == L'\'' ||
-
3157 chr[0] == L'(' ||
-
3158 chr[0] == L')' ||
-
3159 chr[0] == L'*' ||
-
3160 chr[0] == L'+' ||
-
3161 chr[0] == L',' ||
-
3162 chr[0] == L';' ||
-
3163 chr[0] == L'=' ||
-
3164 chr[0] == L':') && chr[1] == 0) ||
-
3165 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
-
3166 {
-
3167 this->interval.start = start;
-
3168 return true;
-
3169 }
-
3170 }
-
3171 this->interval.invalidate();
-
3172 return false;
-
3173 }
-
3174 };
+
3120
+ + +
3123#ifdef _UNICODE
+ +
3125#else
+ +
3127#endif
+
3128
+
+ +
3133 {
+
3134 public:
+
3135 sgml_url_password_char(_In_ const std::locale& locale = std::locale()) : basic_url_password_char<char>(locale) {}
+
3136
+
3137 protected:
+
3138 virtual bool do_match(
+
3139 _In_reads_or_z_(end) const char* text,
+
3140 _In_ size_t start = 0,
+
3141 _In_ size_t end = SIZE_MAX,
+
3142 _In_ int flags = match_default)
+
3143 {
+
3144 _Assume_(text || start >= end);
+
3145 if (start < end && text[start]) {
+
3146 wchar_t buf[3];
+
3147 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
3148 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
3149 if (((chr[0] == L'-' ||
+
3150 chr[0] == L'.' ||
+
3151 chr[0] == L'_' ||
+
3152 chr[0] == L'~' ||
+
3153 chr[0] == L'%' ||
+
3154 chr[0] == L'!' ||
+
3155 chr[0] == L'$' ||
+
3156 chr[0] == L'&' ||
+
3157 chr[0] == L'\'' ||
+
3158 chr[0] == L'(' ||
+
3159 chr[0] == L')' ||
+
3160 chr[0] == L'*' ||
+
3161 chr[0] == L'+' ||
+
3162 chr[0] == L',' ||
+
3163 chr[0] == L';' ||
+
3164 chr[0] == L'=' ||
+
3165 chr[0] == L':') && chr[1] == 0) ||
+
3166 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
+
3167 {
+
3168 this->interval.start = start;
+
3169 return true;
+
3170 }
+
3171 }
+
3172 this->interval.invalidate();
+
3173 return false;
+
3174 }
+
3175 };
-
3175
-
3179 template <class T>
-
- -
3181 {
-
3182 public:
-
3183 basic_url_path_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
3184
-
3185 protected:
-
3186 virtual bool do_match(
-
3187 _In_reads_or_z_opt_(end) const T* text,
-
3188 _In_ size_t start = 0,
-
3189 _In_ size_t end = SIZE_MAX,
-
3190 _In_ int flags = match_default)
-
3191 {
-
3192 _Assume_(text || start >= end);
-
3193 if (start < end && text[start]) {
-
3194 if (text[start] == '/' ||
-
3195 text[start] == '-' ||
-
3196 text[start] == '.' ||
-
3197 text[start] == '_' ||
-
3198 text[start] == '~' ||
-
3199 text[start] == '%' ||
-
3200 text[start] == '!' ||
-
3201 text[start] == '$' ||
-
3202 text[start] == '&' ||
-
3203 text[start] == '\'' ||
-
3204 text[start] == '(' ||
-
3205 text[start] == ')' ||
-
3206 text[start] == '*' ||
-
3207 text[start] == '+' ||
-
3208 text[start] == ',' ||
-
3209 text[start] == ';' ||
-
3210 text[start] == '=' ||
-
3211 text[start] == ':' ||
-
3212 text[start] == '@' ||
-
3213 text[start] == '?' ||
-
3214 text[start] == '#' ||
-
3215 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
-
3216 {
-
3217 this->interval.end = (this->interval.start = start) + 1;
-
3218 return true;
-
3219 }
-
3220 }
-
3221 this->interval.invalidate();
-
3222 return false;
-
3223 }
-
3224 };
+
3176
+
3180 template <class T>
+
+ +
3182 {
+
3183 public:
+
3184 basic_url_path_char(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
3185
+
3186 protected:
+
3187 virtual bool do_match(
+
3188 _In_reads_or_z_opt_(end) const T* text,
+
3189 _In_ size_t start = 0,
+
3190 _In_ size_t end = SIZE_MAX,
+
3191 _In_ int flags = match_default)
+
3192 {
+
3193 _Assume_(text || start >= end);
+
3194 if (start < end && text[start]) {
+
3195 if (text[start] == '/' ||
+
3196 text[start] == '-' ||
+
3197 text[start] == '.' ||
+
3198 text[start] == '_' ||
+
3199 text[start] == '~' ||
+
3200 text[start] == '%' ||
+
3201 text[start] == '!' ||
+
3202 text[start] == '$' ||
+
3203 text[start] == '&' ||
+
3204 text[start] == '\'' ||
+
3205 text[start] == '(' ||
+
3206 text[start] == ')' ||
+
3207 text[start] == '*' ||
+
3208 text[start] == '+' ||
+
3209 text[start] == ',' ||
+
3210 text[start] == ';' ||
+
3211 text[start] == '=' ||
+
3212 text[start] == ':' ||
+
3213 text[start] == '@' ||
+
3214 text[start] == '?' ||
+
3215 text[start] == '#' ||
+
3216 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::alnum, text[start]))
+
3217 {
+
3218 this->interval.end = (this->interval.start = start) + 1;
+
3219 return true;
+
3220 }
+
3221 }
+
3222 this->interval.invalidate();
+
3223 return false;
+
3224 }
+
3225 };
-
3225
- - -
3228#ifdef _UNICODE
- -
3230#else
- -
3232#endif
-
3233
-
- -
3238 {
-
3239 public:
-
3240 sgml_url_path_char(_In_ const std::locale& locale = std::locale()) : basic_url_path_char<char>(locale) {}
-
3241
-
3242 protected:
-
3243 virtual bool do_match(
-
3244 _In_reads_or_z_(end) const char* text,
-
3245 _In_ size_t start = 0,
-
3246 _In_ size_t end = SIZE_MAX,
-
3247 _In_ int flags = match_default)
-
3248 {
-
3249 _Assume_(text || start >= end);
-
3250 if (start < end && text[start]) {
-
3251 wchar_t buf[3];
-
3252 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
-
3253 const wchar_t* chr_end = chr + stdex::strlen(chr);
-
3254 if (((chr[0] == L'/' ||
-
3255 chr[0] == L'-' ||
-
3256 chr[0] == L'.' ||
-
3257 chr[0] == L'_' ||
-
3258 chr[0] == L'~' ||
-
3259 chr[0] == L'%' ||
-
3260 chr[0] == L'!' ||
-
3261 chr[0] == L'$' ||
-
3262 chr[0] == L'&' ||
-
3263 chr[0] == L'\'' ||
-
3264 chr[0] == L'(' ||
-
3265 chr[0] == L')' ||
-
3266 chr[0] == L'*' ||
-
3267 chr[0] == L'+' ||
-
3268 chr[0] == L',' ||
-
3269 chr[0] == L';' ||
-
3270 chr[0] == L'=' ||
-
3271 chr[0] == L':' ||
-
3272 chr[0] == L'@' ||
-
3273 chr[0] == L'?' ||
-
3274 chr[0] == L'#') && chr[1] == 0) ||
-
3275 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
-
3276 {
-
3277 this->interval.start = start;
-
3278 return true;
-
3279 }
-
3280 }
-
3281 this->interval.invalidate();
-
3282 return false;
-
3283 }
-
3284 };
+
3226
+ + +
3229#ifdef _UNICODE
+ +
3231#else
+ +
3233#endif
+
3234
+
+ +
3239 {
+
3240 public:
+
3241 sgml_url_path_char(_In_ const std::locale& locale = std::locale()) : basic_url_path_char<char>(locale) {}
+
3242
+
3243 protected:
+
3244 virtual bool do_match(
+
3245 _In_reads_or_z_(end) const char* text,
+
3246 _In_ size_t start = 0,
+
3247 _In_ size_t end = SIZE_MAX,
+
3248 _In_ int flags = match_default)
+
3249 {
+
3250 _Assume_(text || start >= end);
+
3251 if (start < end && text[start]) {
+
3252 wchar_t buf[3];
+
3253 const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
+
3254 const wchar_t* chr_end = chr + stdex::strlen(chr);
+
3255 if (((chr[0] == L'/' ||
+
3256 chr[0] == L'-' ||
+
3257 chr[0] == L'.' ||
+
3258 chr[0] == L'_' ||
+
3259 chr[0] == L'~' ||
+
3260 chr[0] == L'%' ||
+
3261 chr[0] == L'!' ||
+
3262 chr[0] == L'$' ||
+
3263 chr[0] == L'&' ||
+
3264 chr[0] == L'\'' ||
+
3265 chr[0] == L'(' ||
+
3266 chr[0] == L')' ||
+
3267 chr[0] == L'*' ||
+
3268 chr[0] == L'+' ||
+
3269 chr[0] == L',' ||
+
3270 chr[0] == L';' ||
+
3271 chr[0] == L'=' ||
+
3272 chr[0] == L':' ||
+
3273 chr[0] == L'@' ||
+
3274 chr[0] == L'?' ||
+
3275 chr[0] == L'#') && chr[1] == 0) ||
+
3276 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::alnum, chr, chr_end) == chr_end)
+
3277 {
+
3278 this->interval.start = start;
+
3279 return true;
+
3280 }
+
3281 }
+
3282 this->interval.invalidate();
+
3283 return false;
+
3284 }
+
3285 };
-
3285
-
3289 template <class T>
-
- -
3291 {
-
3292 public:
- -
3294 _In_ const std::shared_ptr<basic_parser<T>>& path_char,
-
3295 _In_ const std::shared_ptr<basic_parser<T>>& query_start,
-
3296 _In_ const std::shared_ptr<basic_parser<T>>& bookmark_start,
-
3297 _In_ const std::locale& locale = std::locale()) :
- -
3299 m_path_char(path_char),
-
3300 m_query_start(query_start),
-
3301 m_bookmark_start(bookmark_start)
-
3302 {}
-
3303
-
3304 virtual void invalidate()
-
3305 {
-
3306 path.start = 1;
-
3307 path.end = 0;
-
3308 query.start = 1;
-
3309 query.end = 0;
-
3310 bookmark.start = 1;
-
3311 bookmark.end = 0;
- -
3313 }
-
3314
- - -
3317 stdex::interval<size_t> bookmark;
-
3318
-
3319 protected:
-
3320 virtual bool do_match(
-
3321 _In_reads_or_z_opt_(end) const T* text,
-
3322 _In_ size_t start = 0,
-
3323 _In_ size_t end = SIZE_MAX,
-
3324 _In_ int flags = match_default)
-
3325 {
-
3326 _Assume_(text || start >= end);
-
3327
-
3328 this->interval.end = start;
-
3329 path.start = start;
-
3330 query.start = 1;
-
3331 query.end = 0;
-
3332 bookmark.start = 1;
-
3333 bookmark.end = 0;
-
3334
-
3335 for (;;) {
-
3336 if (this->interval.end >= end || !text[this->interval.end])
-
3337 break;
-
3338 if (m_query_start->match(text, this->interval.end, end, flags)) {
-
3339 path.end = this->interval.end;
-
3340 query.start = this->interval.end = m_query_start->interval.end;
-
3341 for (;;) {
-
3342 if (this->interval.end >= end || !text[this->interval.end]) {
-
3343 query.end = this->interval.end;
-
3344 break;
-
3345 }
-
3346 if (m_bookmark_start->match(text, this->interval.end, end, flags)) {
-
3347 query.end = this->interval.end;
-
3348 bookmark.start = this->interval.end = m_bookmark_start->interval.end;
-
3349 for (;;) {
-
3350 if (this->interval.end >= end || !text[this->interval.end]) {
-
3351 bookmark.end = this->interval.end;
-
3352 break;
-
3353 }
-
3354 if (m_path_char->match(text, this->interval.end, end, flags))
-
3355 this->interval.end = m_path_char->interval.end;
-
3356 else {
-
3357 bookmark.end = this->interval.end;
-
3358 break;
-
3359 }
-
3360 }
-
3361 this->interval.start = start;
-
3362 return true;
-
3363 }
-
3364 if (m_path_char->match(text, this->interval.end, end, flags))
-
3365 this->interval.end = m_path_char->interval.end;
-
3366 else {
-
3367 query.end = this->interval.end;
-
3368 break;
-
3369 }
-
3370 }
-
3371 this->interval.start = start;
-
3372 return true;
-
3373 }
-
3374 if (m_bookmark_start->match(text, this->interval.end, end, flags)) {
-
3375 path.end = this->interval.end;
-
3376 bookmark.start = this->interval.end = m_bookmark_start->interval.end;
-
3377 for (;;) {
-
3378 if (this->interval.end >= end || !text[this->interval.end]) {
-
3379 bookmark.end = this->interval.end;
-
3380 break;
-
3381 }
-
3382 if (m_path_char->match(text, this->interval.end, end, flags))
-
3383 this->interval.end = m_path_char->interval.end;
-
3384 else {
-
3385 bookmark.end = this->interval.end;
-
3386 break;
-
3387 }
-
3388 }
-
3389 this->interval.start = start;
-
3390 return true;
-
3391 }
-
3392 if (m_path_char->match(text, this->interval.end, end, flags))
-
3393 this->interval.end = m_path_char->interval.end;
-
3394 else
-
3395 break;
-
3396 }
-
3397
- -
3399 path.end = this->interval.end;
-
3400 this->interval.start = start;
-
3401 return true;
-
3402 }
-
3403
-
3404 path.start = 1;
-
3405 path.end = 0;
-
3406 bookmark.start = 1;
-
3407 bookmark.end = 0;
-
3408 this->interval.invalidate();
-
3409 return false;
-
3410 }
-
3411
-
3412 std::shared_ptr<basic_parser<T>> m_path_char;
-
3413 std::shared_ptr<basic_parser<T>> m_query_start;
-
3414 std::shared_ptr<basic_parser<T>> m_bookmark_start;
-
3415 };
+
3286
+
3290 template <class T>
+
+ +
3292 {
+
3293 public:
+ +
3295 _In_ const std::shared_ptr<basic_parser<T>>& path_char,
+
3296 _In_ const std::shared_ptr<basic_parser<T>>& query_start,
+
3297 _In_ const std::shared_ptr<basic_parser<T>>& bookmark_start,
+
3298 _In_ const std::locale& locale = std::locale()) :
+ +
3300 m_path_char(path_char),
+
3301 m_query_start(query_start),
+
3302 m_bookmark_start(bookmark_start)
+
3303 {}
+
3304
+
3305 virtual void invalidate()
+
3306 {
+
3307 path.start = 1;
+
3308 path.end = 0;
+
3309 query.start = 1;
+
3310 query.end = 0;
+
3311 bookmark.start = 1;
+
3312 bookmark.end = 0;
+ +
3314 }
+
3315
+ + +
3318 stdex::interval<size_t> bookmark;
+
3319
+
3320 protected:
+
3321 virtual bool do_match(
+
3322 _In_reads_or_z_opt_(end) const T* text,
+
3323 _In_ size_t start = 0,
+
3324 _In_ size_t end = SIZE_MAX,
+
3325 _In_ int flags = match_default)
+
3326 {
+
3327 _Assume_(text || start >= end);
+
3328
+
3329 this->interval.end = start;
+
3330 path.start = start;
+
3331 query.start = 1;
+
3332 query.end = 0;
+
3333 bookmark.start = 1;
+
3334 bookmark.end = 0;
+
3335
+
3336 for (;;) {
+
3337 if (this->interval.end >= end || !text[this->interval.end])
+
3338 break;
+
3339 if (m_query_start->match(text, this->interval.end, end, flags)) {
+
3340 path.end = this->interval.end;
+
3341 query.start = this->interval.end = m_query_start->interval.end;
+
3342 for (;;) {
+
3343 if (this->interval.end >= end || !text[this->interval.end]) {
+
3344 query.end = this->interval.end;
+
3345 break;
+
3346 }
+
3347 if (m_bookmark_start->match(text, this->interval.end, end, flags)) {
+
3348 query.end = this->interval.end;
+
3349 bookmark.start = this->interval.end = m_bookmark_start->interval.end;
+
3350 for (;;) {
+
3351 if (this->interval.end >= end || !text[this->interval.end]) {
+
3352 bookmark.end = this->interval.end;
+
3353 break;
+
3354 }
+
3355 if (m_path_char->match(text, this->interval.end, end, flags))
+
3356 this->interval.end = m_path_char->interval.end;
+
3357 else {
+
3358 bookmark.end = this->interval.end;
+
3359 break;
+
3360 }
+
3361 }
+
3362 this->interval.start = start;
+
3363 return true;
+
3364 }
+
3365 if (m_path_char->match(text, this->interval.end, end, flags))
+
3366 this->interval.end = m_path_char->interval.end;
+
3367 else {
+
3368 query.end = this->interval.end;
+
3369 break;
+
3370 }
+
3371 }
+
3372 this->interval.start = start;
+
3373 return true;
+
3374 }
+
3375 if (m_bookmark_start->match(text, this->interval.end, end, flags)) {
+
3376 path.end = this->interval.end;
+
3377 bookmark.start = this->interval.end = m_bookmark_start->interval.end;
+
3378 for (;;) {
+
3379 if (this->interval.end >= end || !text[this->interval.end]) {
+
3380 bookmark.end = this->interval.end;
+
3381 break;
+
3382 }
+
3383 if (m_path_char->match(text, this->interval.end, end, flags))
+
3384 this->interval.end = m_path_char->interval.end;
+
3385 else {
+
3386 bookmark.end = this->interval.end;
+
3387 break;
+
3388 }
+
3389 }
+
3390 this->interval.start = start;
+
3391 return true;
+
3392 }
+
3393 if (m_path_char->match(text, this->interval.end, end, flags))
+
3394 this->interval.end = m_path_char->interval.end;
+
3395 else
+
3396 break;
+
3397 }
+
3398
+ +
3400 path.end = this->interval.end;
+
3401 this->interval.start = start;
+
3402 return true;
+
3403 }
+
3404
+
3405 path.start = 1;
+
3406 path.end = 0;
+
3407 bookmark.start = 1;
+
3408 bookmark.end = 0;
+
3409 this->interval.invalidate();
+
3410 return false;
+
3411 }
+
3412
+
3413 std::shared_ptr<basic_parser<T>> m_path_char;
+
3414 std::shared_ptr<basic_parser<T>> m_query_start;
+
3415 std::shared_ptr<basic_parser<T>> m_bookmark_start;
+
3416 };
-
3416
- - -
3419#ifdef _UNICODE
-
3420 using turl_path = wurl_path;
-
3421#else
-
3422 using turl_path = url_path;
-
3423#endif
- -
3425
-
3429 template <class T>
-
-
3430 class basic_url : public basic_parser<T>
-
3431 {
-
3432 public:
-
3433 basic_url(
-
3434 _In_ const std::shared_ptr<basic_parser<T>>& _http_scheme,
-
3435 _In_ const std::shared_ptr<basic_parser<T>>& _ftp_scheme,
-
3436 _In_ const std::shared_ptr<basic_parser<T>>& _mailto_scheme,
-
3437 _In_ const std::shared_ptr<basic_parser<T>>& _file_scheme,
-
3438 _In_ const std::shared_ptr<basic_parser<T>>& colon,
-
3439 _In_ const std::shared_ptr<basic_parser<T>>& slash,
-
3440 _In_ const std::shared_ptr<basic_parser<T>>& _username,
-
3441 _In_ const std::shared_ptr<basic_parser<T>>& _password,
-
3442 _In_ const std::shared_ptr<basic_parser<T>>& at,
-
3443 _In_ const std::shared_ptr<basic_parser<T>>& ip_lbracket,
-
3444 _In_ const std::shared_ptr<basic_parser<T>>& ip_rbracket,
-
3445 _In_ const std::shared_ptr<basic_parser<T>>& _ipv4_host,
-
3446 _In_ const std::shared_ptr<basic_parser<T>>& _ipv6_host,
-
3447 _In_ const std::shared_ptr<basic_parser<T>>& _dns_host,
-
3448 _In_ const std::shared_ptr<basic_parser<T>>& _port,
-
3449 _In_ const std::shared_ptr<basic_parser<T>>& _path,
-
3450 _In_ const std::locale& locale = std::locale()) :
- -
3452 http_scheme(_http_scheme),
-
3453 ftp_scheme(_ftp_scheme),
-
3454 mailto_scheme(_mailto_scheme),
-
3455 file_scheme(_file_scheme),
-
3456 m_colon(colon),
-
3457 m_slash(slash),
-
3458 username(_username),
-
3459 password(_password),
-
3460 m_at(at),
-
3461 m_ip_lbracket(ip_lbracket),
-
3462 m_ip_rbracket(ip_rbracket),
-
3463 ipv4_host(_ipv4_host),
-
3464 ipv6_host(_ipv6_host),
-
3465 dns_host(_dns_host),
-
3466 port(_port),
-
3467 path(_path)
-
3468 {}
-
3469
-
3470 virtual void invalidate()
-
3471 {
-
3472 http_scheme->invalidate();
-
3473 ftp_scheme->invalidate();
-
3474 mailto_scheme->invalidate();
-
3475 file_scheme->invalidate();
-
3476 username->invalidate();
-
3477 password->invalidate();
-
3478 ipv4_host->invalidate();
-
3479 ipv6_host->invalidate();
-
3480 dns_host->invalidate();
-
3481 port->invalidate();
-
3482 path->invalidate();
- -
3484 }
-
3485
-
3486 std::shared_ptr<basic_parser<T>> http_scheme;
-
3487 std::shared_ptr<basic_parser<T>> ftp_scheme;
-
3488 std::shared_ptr<basic_parser<T>> mailto_scheme;
-
3489 std::shared_ptr<basic_parser<T>> file_scheme;
-
3490 std::shared_ptr<basic_parser<T>> username;
-
3491 std::shared_ptr<basic_parser<T>> password;
-
3492 std::shared_ptr<basic_parser<T>> ipv4_host;
-
3493 std::shared_ptr<basic_parser<T>> ipv6_host;
-
3494 std::shared_ptr<basic_parser<T>> dns_host;
-
3495 std::shared_ptr<basic_parser<T>> port;
-
3496 std::shared_ptr<basic_parser<T>> path;
-
3497
-
3498 protected:
-
3499 virtual bool do_match(
-
3500 _In_reads_or_z_opt_(end) const T* text,
-
3501 _In_ size_t start = 0,
-
3502 _In_ size_t end = SIZE_MAX,
-
3503 _In_ int flags = match_default)
-
3504 {
-
3505 _Assume_(text || start >= end);
-
3506
-
3507 this->interval.end = start;
-
3508
-
3509 if (http_scheme->match(text, this->interval.end, end, flags) &&
-
3510 m_colon->match(text, http_scheme->interval.end, end, flags) &&
-
3511 m_slash->match(text, m_colon->interval.end, end, flags) &&
-
3512 m_slash->match(text, m_slash->interval.end, end, flags))
-
3513 {
-
3514 // http://
-
3515 this->interval.end = m_slash->interval.end;
-
3516 ftp_scheme->invalidate();
-
3517 mailto_scheme->invalidate();
-
3518 file_scheme->invalidate();
-
3519 }
-
3520 else if (ftp_scheme->match(text, this->interval.end, end, flags) &&
-
3521 m_colon->match(text, ftp_scheme->interval.end, end, flags) &&
-
3522 m_slash->match(text, m_colon->interval.end, end, flags) &&
-
3523 m_slash->match(text, m_slash->interval.end, end, flags))
-
3524 {
-
3525 // ftp://
-
3526 this->interval.end = m_slash->interval.end;
-
3527 http_scheme->invalidate();
-
3528 mailto_scheme->invalidate();
-
3529 file_scheme->invalidate();
-
3530 }
-
3531 else if (mailto_scheme->match(text, this->interval.end, end, flags) &&
-
3532 m_colon->match(text, mailto_scheme->interval.end, end, flags))
-
3533 {
-
3534 // mailto:
-
3535 this->interval.end = m_colon->interval.end;
-
3536 http_scheme->invalidate();
-
3537 ftp_scheme->invalidate();
-
3538 file_scheme->invalidate();
-
3539 }
-
3540 else if (file_scheme->match(text, this->interval.end, end, flags) &&
-
3541 m_colon->match(text, file_scheme->interval.end, end, flags) &&
-
3542 m_slash->match(text, m_colon->interval.end, end, flags) &&
-
3543 m_slash->match(text, m_slash->interval.end, end, flags))
-
3544 {
-
3545 // file://
-
3546 this->interval.end = m_slash->interval.end;
-
3547 http_scheme->invalidate();
-
3548 ftp_scheme->invalidate();
-
3549 mailto_scheme->invalidate();
-
3550 }
-
3551 else {
-
3552 // Default to http:
-
3553 http_scheme->invalidate();
-
3554 ftp_scheme->invalidate();
-
3555 mailto_scheme->invalidate();
-
3556 file_scheme->invalidate();
-
3557 }
-
3558
-
3559 if (ftp_scheme->interval) {
-
3560 if (username->match(text, this->interval.end, end, flags)) {
-
3561 if (m_colon->match(text, username->interval.end, end, flags) &&
-
3562 password->match(text, m_colon->interval.end, end, flags) &&
-
3563 m_at->match(text, password->interval.end, end, flags))
-
3564 {
-
3565 // Username and password
-
3566 this->interval.end = m_at->interval.end;
-
3567 }
-
3568 else if (m_at->match(text, this->interval.end, end, flags)) {
-
3569 // Username only
-
3570 this->interval.end = m_at->interval.end;
-
3571 password->invalidate();
-
3572 }
-
3573 else {
-
3574 username->invalidate();
-
3575 password->invalidate();
-
3576 }
-
3577 }
-
3578 else {
-
3579 username->invalidate();
-
3580 password->invalidate();
-
3581 }
-
3582
-
3583 if (ipv4_host->match(text, this->interval.end, end, flags)) {
-
3584 // Host is IPv4
-
3585 this->interval.end = ipv4_host->interval.end;
-
3586 ipv6_host->invalidate();
-
3587 dns_host->invalidate();
-
3588 }
-
3589 else if (
-
3590 m_ip_lbracket->match(text, this->interval.end, end, flags) &&
-
3591 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
-
3592 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
-
3593 {
-
3594 // Host is IPv6
-
3595 this->interval.end = m_ip_rbracket->interval.end;
-
3596 ipv4_host->invalidate();
-
3597 dns_host->invalidate();
-
3598 }
-
3599 else if (dns_host->match(text, this->interval.end, end, flags)) {
-
3600 // Host is hostname
-
3601 this->interval.end = dns_host->interval.end;
-
3602 ipv4_host->invalidate();
-
3603 ipv6_host->invalidate();
-
3604 }
-
3605 else {
-
3606 invalidate();
-
3607 return false;
-
3608 }
-
3609
-
3610 if (m_colon->match(text, this->interval.end, end, flags) &&
-
3611 port->match(text, m_colon->interval.end, end, flags))
-
3612 {
-
3613 // Port
-
3614 this->interval.end = port->interval.end;
-
3615 }
-
3616 else
-
3617 port->invalidate();
-
3618
-
3619 if (path->match(text, this->interval.end, end, flags)) {
-
3620 // Path
-
3621 this->interval.end = path->interval.end;
-
3622 }
-
3623
-
3624 this->interval.start = start;
-
3625 return true;
-
3626 }
-
3627
-
3628 if (mailto_scheme->interval) {
-
3629 if (username->match(text, this->interval.end, end, flags) &&
-
3630 m_at->match(text, username->interval.end, end, flags))
-
3631 {
-
3632 // Username
-
3633 this->interval.end = m_at->interval.end;
-
3634 }
-
3635 else {
-
3636 invalidate();
-
3637 return false;
-
3638 }
-
3639
-
3640 if (m_ip_lbracket->match(text, this->interval.end, end, flags) &&
-
3641 ipv4_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
-
3642 m_ip_rbracket->match(text, ipv4_host->interval.end, end, flags))
-
3643 {
-
3644 // Host is IPv4
-
3645 this->interval.end = m_ip_rbracket->interval.end;
-
3646 ipv6_host->invalidate();
-
3647 dns_host->invalidate();
-
3648 }
-
3649 else if (
-
3650 m_ip_lbracket->match(text, this->interval.end, end, flags) &&
-
3651 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
-
3652 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
-
3653 {
-
3654 // Host is IPv6
-
3655 this->interval.end = m_ip_rbracket->interval.end;
-
3656 ipv4_host->invalidate();
-
3657 dns_host->invalidate();
-
3658 }
-
3659 else if (dns_host->match(text, this->interval.end, end, flags)) {
-
3660 // Host is hostname
-
3661 this->interval.end = dns_host->interval.end;
-
3662 ipv4_host->invalidate();
-
3663 ipv6_host->invalidate();
-
3664 }
-
3665 else {
-
3666 invalidate();
-
3667 return false;
-
3668 }
-
3669
-
3670 password->invalidate();
-
3671 port->invalidate();
-
3672 path->invalidate();
-
3673 this->interval.start = start;
-
3674 return true;
-
3675 }
-
3676
-
3677 if (file_scheme->interval) {
-
3678 if (path->match(text, this->interval.end, end, flags)) {
-
3679 // Path
-
3680 this->interval.end = path->interval.end;
-
3681 }
-
3682
-
3683 username->invalidate();
-
3684 password->invalidate();
-
3685 ipv4_host->invalidate();
-
3686 ipv6_host->invalidate();
-
3687 dns_host->invalidate();
-
3688 port->invalidate();
-
3689 this->interval.start = start;
-
3690 return true;
-
3691 }
-
3692
-
3693 // "http://" found or defaulted to
-
3694
-
3695 // If "http://" explicit, test for username&password.
-
3696 if (http_scheme->interval &&
-
3697 username->match(text, this->interval.end, end, flags))
-
3698 {
-
3699 if (m_colon->match(text, username->interval.end, end, flags) &&
-
3700 password->match(text, m_colon->interval.end, end, flags) &&
-
3701 m_at->match(text, password->interval.end, end, flags))
-
3702 {
-
3703 // Username and password
-
3704 this->interval.end = m_at->interval.end;
-
3705 }
-
3706 else if (m_at->match(text, username->interval.end, end, flags)) {
-
3707 // Username only
-
3708 this->interval.end = m_at->interval.end;
-
3709 password->invalidate();
-
3710 }
-
3711 else {
-
3712 username->invalidate();
-
3713 password->invalidate();
-
3714 }
-
3715 }
-
3716 else {
-
3717 username->invalidate();
-
3718 password->invalidate();
-
3719 }
-
3720
-
3721 if (ipv4_host->match(text, this->interval.end, end, flags)) {
-
3722 // Host is IPv4
-
3723 this->interval.end = ipv4_host->interval.end;
-
3724 ipv6_host->invalidate();
-
3725 dns_host->invalidate();
-
3726 }
-
3727 else if (
-
3728 m_ip_lbracket->match(text, this->interval.end, end, flags) &&
-
3729 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
-
3730 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
-
3731 {
-
3732 // Host is IPv6
-
3733 this->interval.end = m_ip_rbracket->interval.end;
-
3734 ipv4_host->invalidate();
-
3735 dns_host->invalidate();
-
3736 }
-
3737 else if (dns_host->match(text, this->interval.end, end, flags)) {
-
3738 // Host is hostname
-
3739 this->interval.end = dns_host->interval.end;
-
3740 ipv4_host->invalidate();
-
3741 ipv6_host->invalidate();
-
3742 }
-
3743 else {
-
3744 invalidate();
-
3745 return false;
-
3746 }
-
3747
-
3748 if (m_colon->match(text, this->interval.end, end, flags) &&
-
3749 port->match(text, m_colon->interval.end, end, flags))
-
3750 {
-
3751 // Port
-
3752 this->interval.end = port->interval.end;
-
3753 }
-
3754 else
-
3755 port->invalidate();
-
3756
-
3757 if (path->match(text, this->interval.end, end, flags)) {
-
3758 // Path
-
3759 this->interval.end = path->interval.end;
-
3760 }
-
3761
-
3762 this->interval.start = start;
-
3763 return true;
-
3764 }
-
3765
-
3766 std::shared_ptr<basic_parser<T>> m_colon;
-
3767 std::shared_ptr<basic_parser<T>> m_slash;
-
3768 std::shared_ptr<basic_parser<T>> m_at;
-
3769 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
-
3770 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
-
3771 };
+
3417
+ + +
3420#ifdef _UNICODE
+
3421 using turl_path = wurl_path;
+
3422#else
+
3423 using turl_path = url_path;
+
3424#endif
+ +
3426
+
3430 template <class T>
+
+
3431 class basic_url : public basic_parser<T>
+
3432 {
+
3433 public:
+
3434 basic_url(
+
3435 _In_ const std::shared_ptr<basic_parser<T>>& _http_scheme,
+
3436 _In_ const std::shared_ptr<basic_parser<T>>& _ftp_scheme,
+
3437 _In_ const std::shared_ptr<basic_parser<T>>& _mailto_scheme,
+
3438 _In_ const std::shared_ptr<basic_parser<T>>& _file_scheme,
+
3439 _In_ const std::shared_ptr<basic_parser<T>>& colon,
+
3440 _In_ const std::shared_ptr<basic_parser<T>>& slash,
+
3441 _In_ const std::shared_ptr<basic_parser<T>>& _username,
+
3442 _In_ const std::shared_ptr<basic_parser<T>>& _password,
+
3443 _In_ const std::shared_ptr<basic_parser<T>>& at,
+
3444 _In_ const std::shared_ptr<basic_parser<T>>& ip_lbracket,
+
3445 _In_ const std::shared_ptr<basic_parser<T>>& ip_rbracket,
+
3446 _In_ const std::shared_ptr<basic_parser<T>>& _ipv4_host,
+
3447 _In_ const std::shared_ptr<basic_parser<T>>& _ipv6_host,
+
3448 _In_ const std::shared_ptr<basic_parser<T>>& _dns_host,
+
3449 _In_ const std::shared_ptr<basic_parser<T>>& _port,
+
3450 _In_ const std::shared_ptr<basic_parser<T>>& _path,
+
3451 _In_ const std::locale& locale = std::locale()) :
+ +
3453 http_scheme(_http_scheme),
+
3454 ftp_scheme(_ftp_scheme),
+
3455 mailto_scheme(_mailto_scheme),
+
3456 file_scheme(_file_scheme),
+
3457 m_colon(colon),
+
3458 m_slash(slash),
+
3459 username(_username),
+
3460 password(_password),
+
3461 m_at(at),
+
3462 m_ip_lbracket(ip_lbracket),
+
3463 m_ip_rbracket(ip_rbracket),
+
3464 ipv4_host(_ipv4_host),
+
3465 ipv6_host(_ipv6_host),
+
3466 dns_host(_dns_host),
+
3467 port(_port),
+
3468 path(_path)
+
3469 {}
+
3470
+
3471 virtual void invalidate()
+
3472 {
+
3473 http_scheme->invalidate();
+
3474 ftp_scheme->invalidate();
+
3475 mailto_scheme->invalidate();
+
3476 file_scheme->invalidate();
+
3477 username->invalidate();
+
3478 password->invalidate();
+
3479 ipv4_host->invalidate();
+
3480 ipv6_host->invalidate();
+
3481 dns_host->invalidate();
+
3482 port->invalidate();
+
3483 path->invalidate();
+ +
3485 }
+
3486
+
3487 std::shared_ptr<basic_parser<T>> http_scheme;
+
3488 std::shared_ptr<basic_parser<T>> ftp_scheme;
+
3489 std::shared_ptr<basic_parser<T>> mailto_scheme;
+
3490 std::shared_ptr<basic_parser<T>> file_scheme;
+
3491 std::shared_ptr<basic_parser<T>> username;
+
3492 std::shared_ptr<basic_parser<T>> password;
+
3493 std::shared_ptr<basic_parser<T>> ipv4_host;
+
3494 std::shared_ptr<basic_parser<T>> ipv6_host;
+
3495 std::shared_ptr<basic_parser<T>> dns_host;
+
3496 std::shared_ptr<basic_parser<T>> port;
+
3497 std::shared_ptr<basic_parser<T>> path;
+
3498
+
3499 protected:
+
3500 virtual bool do_match(
+
3501 _In_reads_or_z_opt_(end) const T* text,
+
3502 _In_ size_t start = 0,
+
3503 _In_ size_t end = SIZE_MAX,
+
3504 _In_ int flags = match_default)
+
3505 {
+
3506 _Assume_(text || start >= end);
+
3507
+
3508 this->interval.end = start;
+
3509
+
3510 if (http_scheme->match(text, this->interval.end, end, flags) &&
+
3511 m_colon->match(text, http_scheme->interval.end, end, flags) &&
+
3512 m_slash->match(text, m_colon->interval.end, end, flags) &&
+
3513 m_slash->match(text, m_slash->interval.end, end, flags))
+
3514 {
+
3515 // http://
+
3516 this->interval.end = m_slash->interval.end;
+
3517 ftp_scheme->invalidate();
+
3518 mailto_scheme->invalidate();
+
3519 file_scheme->invalidate();
+
3520 }
+
3521 else if (ftp_scheme->match(text, this->interval.end, end, flags) &&
+
3522 m_colon->match(text, ftp_scheme->interval.end, end, flags) &&
+
3523 m_slash->match(text, m_colon->interval.end, end, flags) &&
+
3524 m_slash->match(text, m_slash->interval.end, end, flags))
+
3525 {
+
3526 // ftp://
+
3527 this->interval.end = m_slash->interval.end;
+
3528 http_scheme->invalidate();
+
3529 mailto_scheme->invalidate();
+
3530 file_scheme->invalidate();
+
3531 }
+
3532 else if (mailto_scheme->match(text, this->interval.end, end, flags) &&
+
3533 m_colon->match(text, mailto_scheme->interval.end, end, flags))
+
3534 {
+
3535 // mailto:
+
3536 this->interval.end = m_colon->interval.end;
+
3537 http_scheme->invalidate();
+
3538 ftp_scheme->invalidate();
+
3539 file_scheme->invalidate();
+
3540 }
+
3541 else if (file_scheme->match(text, this->interval.end, end, flags) &&
+
3542 m_colon->match(text, file_scheme->interval.end, end, flags) &&
+
3543 m_slash->match(text, m_colon->interval.end, end, flags) &&
+
3544 m_slash->match(text, m_slash->interval.end, end, flags))
+
3545 {
+
3546 // file://
+
3547 this->interval.end = m_slash->interval.end;
+
3548 http_scheme->invalidate();
+
3549 ftp_scheme->invalidate();
+
3550 mailto_scheme->invalidate();
+
3551 }
+
3552 else {
+
3553 // Default to http:
+
3554 http_scheme->invalidate();
+
3555 ftp_scheme->invalidate();
+
3556 mailto_scheme->invalidate();
+
3557 file_scheme->invalidate();
+
3558 }
+
3559
+
3560 if (ftp_scheme->interval) {
+
3561 if (username->match(text, this->interval.end, end, flags)) {
+
3562 if (m_colon->match(text, username->interval.end, end, flags) &&
+
3563 password->match(text, m_colon->interval.end, end, flags) &&
+
3564 m_at->match(text, password->interval.end, end, flags))
+
3565 {
+
3566 // Username and password
+
3567 this->interval.end = m_at->interval.end;
+
3568 }
+
3569 else if (m_at->match(text, this->interval.end, end, flags)) {
+
3570 // Username only
+
3571 this->interval.end = m_at->interval.end;
+
3572 password->invalidate();
+
3573 }
+
3574 else {
+
3575 username->invalidate();
+
3576 password->invalidate();
+
3577 }
+
3578 }
+
3579 else {
+
3580 username->invalidate();
+
3581 password->invalidate();
+
3582 }
+
3583
+
3584 if (ipv4_host->match(text, this->interval.end, end, flags)) {
+
3585 // Host is IPv4
+
3586 this->interval.end = ipv4_host->interval.end;
+
3587 ipv6_host->invalidate();
+
3588 dns_host->invalidate();
+
3589 }
+
3590 else if (
+
3591 m_ip_lbracket->match(text, this->interval.end, end, flags) &&
+
3592 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
+
3593 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
+
3594 {
+
3595 // Host is IPv6
+
3596 this->interval.end = m_ip_rbracket->interval.end;
+
3597 ipv4_host->invalidate();
+
3598 dns_host->invalidate();
+
3599 }
+
3600 else if (dns_host->match(text, this->interval.end, end, flags)) {
+
3601 // Host is hostname
+
3602 this->interval.end = dns_host->interval.end;
+
3603 ipv4_host->invalidate();
+
3604 ipv6_host->invalidate();
+
3605 }
+
3606 else {
+
3607 invalidate();
+
3608 return false;
+
3609 }
+
3610
+
3611 if (m_colon->match(text, this->interval.end, end, flags) &&
+
3612 port->match(text, m_colon->interval.end, end, flags))
+
3613 {
+
3614 // Port
+
3615 this->interval.end = port->interval.end;
+
3616 }
+
3617 else
+
3618 port->invalidate();
+
3619
+
3620 if (path->match(text, this->interval.end, end, flags)) {
+
3621 // Path
+
3622 this->interval.end = path->interval.end;
+
3623 }
+
3624
+
3625 this->interval.start = start;
+
3626 return true;
+
3627 }
+
3628
+
3629 if (mailto_scheme->interval) {
+
3630 if (username->match(text, this->interval.end, end, flags) &&
+
3631 m_at->match(text, username->interval.end, end, flags))
+
3632 {
+
3633 // Username
+
3634 this->interval.end = m_at->interval.end;
+
3635 }
+
3636 else {
+
3637 invalidate();
+
3638 return false;
+
3639 }
+
3640
+
3641 if (m_ip_lbracket->match(text, this->interval.end, end, flags) &&
+
3642 ipv4_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
+
3643 m_ip_rbracket->match(text, ipv4_host->interval.end, end, flags))
+
3644 {
+
3645 // Host is IPv4
+
3646 this->interval.end = m_ip_rbracket->interval.end;
+
3647 ipv6_host->invalidate();
+
3648 dns_host->invalidate();
+
3649 }
+
3650 else if (
+
3651 m_ip_lbracket->match(text, this->interval.end, end, flags) &&
+
3652 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
+
3653 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
+
3654 {
+
3655 // Host is IPv6
+
3656 this->interval.end = m_ip_rbracket->interval.end;
+
3657 ipv4_host->invalidate();
+
3658 dns_host->invalidate();
+
3659 }
+
3660 else if (dns_host->match(text, this->interval.end, end, flags)) {
+
3661 // Host is hostname
+
3662 this->interval.end = dns_host->interval.end;
+
3663 ipv4_host->invalidate();
+
3664 ipv6_host->invalidate();
+
3665 }
+
3666 else {
+
3667 invalidate();
+
3668 return false;
+
3669 }
+
3670
+
3671 password->invalidate();
+
3672 port->invalidate();
+
3673 path->invalidate();
+
3674 this->interval.start = start;
+
3675 return true;
+
3676 }
+
3677
+
3678 if (file_scheme->interval) {
+
3679 if (path->match(text, this->interval.end, end, flags)) {
+
3680 // Path
+
3681 this->interval.end = path->interval.end;
+
3682 }
+
3683
+
3684 username->invalidate();
+
3685 password->invalidate();
+
3686 ipv4_host->invalidate();
+
3687 ipv6_host->invalidate();
+
3688 dns_host->invalidate();
+
3689 port->invalidate();
+
3690 this->interval.start = start;
+
3691 return true;
+
3692 }
+
3693
+
3694 // "http://" found or defaulted to
+
3695
+
3696 // If "http://" explicit, test for username&password.
+
3697 if (http_scheme->interval &&
+
3698 username->match(text, this->interval.end, end, flags))
+
3699 {
+
3700 if (m_colon->match(text, username->interval.end, end, flags) &&
+
3701 password->match(text, m_colon->interval.end, end, flags) &&
+
3702 m_at->match(text, password->interval.end, end, flags))
+
3703 {
+
3704 // Username and password
+
3705 this->interval.end = m_at->interval.end;
+
3706 }
+
3707 else if (m_at->match(text, username->interval.end, end, flags)) {
+
3708 // Username only
+
3709 this->interval.end = m_at->interval.end;
+
3710 password->invalidate();
+
3711 }
+
3712 else {
+
3713 username->invalidate();
+
3714 password->invalidate();
+
3715 }
+
3716 }
+
3717 else {
+
3718 username->invalidate();
+
3719 password->invalidate();
+
3720 }
+
3721
+
3722 if (ipv4_host->match(text, this->interval.end, end, flags)) {
+
3723 // Host is IPv4
+
3724 this->interval.end = ipv4_host->interval.end;
+
3725 ipv6_host->invalidate();
+
3726 dns_host->invalidate();
+
3727 }
+
3728 else if (
+
3729 m_ip_lbracket->match(text, this->interval.end, end, flags) &&
+
3730 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
+
3731 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
+
3732 {
+
3733 // Host is IPv6
+
3734 this->interval.end = m_ip_rbracket->interval.end;
+
3735 ipv4_host->invalidate();
+
3736 dns_host->invalidate();
+
3737 }
+
3738 else if (dns_host->match(text, this->interval.end, end, flags)) {
+
3739 // Host is hostname
+
3740 this->interval.end = dns_host->interval.end;
+
3741 ipv4_host->invalidate();
+
3742 ipv6_host->invalidate();
+
3743 }
+
3744 else {
+
3745 invalidate();
+
3746 return false;
+
3747 }
+
3748
+
3749 if (m_colon->match(text, this->interval.end, end, flags) &&
+
3750 port->match(text, m_colon->interval.end, end, flags))
+
3751 {
+
3752 // Port
+
3753 this->interval.end = port->interval.end;
+
3754 }
+
3755 else
+
3756 port->invalidate();
+
3757
+
3758 if (path->match(text, this->interval.end, end, flags)) {
+
3759 // Path
+
3760 this->interval.end = path->interval.end;
+
3761 }
+
3762
+
3763 this->interval.start = start;
+
3764 return true;
+
3765 }
+
3766
+
3767 std::shared_ptr<basic_parser<T>> m_colon;
+
3768 std::shared_ptr<basic_parser<T>> m_slash;
+
3769 std::shared_ptr<basic_parser<T>> m_at;
+
3770 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
+
3771 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
+
3772 };
-
3772
-
3773 using url = basic_url<char>;
-
3774 using wurl = basic_url<wchar_t>;
-
3775#ifdef _UNICODE
-
3776 using turl = wurl;
-
3777#else
-
3778 using turl = url;
-
3779#endif
-
3780 using sgml_url = basic_url<char>;
-
3781
-
3785 template <class T>
-
- -
3787 {
-
3788 public:
- -
3790 _In_ const std::shared_ptr<basic_parser<T>>& _username,
-
3791 _In_ const std::shared_ptr<basic_parser<T>>& at,
-
3792 _In_ const std::shared_ptr<basic_parser<T>>& ip_lbracket,
-
3793 _In_ const std::shared_ptr<basic_parser<T>>& ip_rbracket,
-
3794 _In_ const std::shared_ptr<basic_parser<T>>& _ipv4_host,
-
3795 _In_ const std::shared_ptr<basic_parser<T>>& _ipv6_host,
-
3796 _In_ const std::shared_ptr<basic_parser<T>>& _dns_host,
-
3797 _In_ const std::locale& locale = std::locale()) :
- -
3799 username(_username),
-
3800 m_at(at),
-
3801 m_ip_lbracket(ip_lbracket),
-
3802 m_ip_rbracket(ip_rbracket),
-
3803 ipv4_host(_ipv4_host),
-
3804 ipv6_host(_ipv6_host),
-
3805 dns_host(_dns_host)
-
3806 {}
-
3807
-
3808 virtual void invalidate()
-
3809 {
-
3810 username->invalidate();
-
3811 ipv4_host->invalidate();
-
3812 ipv6_host->invalidate();
-
3813 dns_host->invalidate();
- -
3815 }
-
3816
-
3817 std::shared_ptr<basic_parser<T>> username;
-
3818 std::shared_ptr<basic_parser<T>> ipv4_host;
-
3819 std::shared_ptr<basic_parser<T>> ipv6_host;
-
3820 std::shared_ptr<basic_parser<T>> dns_host;
-
3821
-
3822 protected:
-
3823 virtual bool do_match(
-
3824 _In_reads_or_z_opt_(end) const T* text,
-
3825 _In_ size_t start = 0,
-
3826 _In_ size_t end = SIZE_MAX,
-
3827 _In_ int flags = match_default)
-
3828 {
-
3829 _Assume_(text || start >= end);
-
3830
-
3831 if (username->match(text, start, end, flags) &&
-
3832 m_at->match(text, username->interval.end, end, flags))
-
3833 {
-
3834 // Username@
-
3835 if (m_ip_lbracket->match(text, m_at->interval.end, end, flags) &&
-
3836 ipv4_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
-
3837 m_ip_rbracket->match(text, ipv4_host->interval.end, end, flags))
-
3838 {
-
3839 // Host is IPv4
-
3840 this->interval.end = m_ip_rbracket->interval.end;
-
3841 ipv6_host->invalidate();
-
3842 dns_host->invalidate();
-
3843 }
-
3844 else if (
-
3845 m_ip_lbracket->match(text, m_at->interval.end, end, flags) &&
-
3846 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
-
3847 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
-
3848 {
-
3849 // Host is IPv6
-
3850 this->interval.end = m_ip_rbracket->interval.end;
-
3851 ipv4_host->invalidate();
-
3852 dns_host->invalidate();
-
3853 }
-
3854 else if (dns_host->match(text, m_at->interval.end, end, flags)) {
-
3855 // Host is hostname
-
3856 this->interval.end = dns_host->interval.end;
-
3857 ipv4_host->invalidate();
-
3858 ipv6_host->invalidate();
-
3859 }
-
3860 else
-
3861 goto error;
-
3862 this->interval.start = start;
-
3863 return true;
-
3864 }
-
3865
-
3866 error:
-
3867 invalidate();
-
3868 return false;
-
3869 }
-
3870
-
3871 std::shared_ptr<basic_parser<T>> m_at;
-
3872 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
-
3873 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
-
3874 };
+
3773
+
3774 using url = basic_url<char>;
+
3775 using wurl = basic_url<wchar_t>;
+
3776#ifdef _UNICODE
+
3777 using turl = wurl;
+
3778#else
+
3779 using turl = url;
+
3780#endif
+
3781 using sgml_url = basic_url<char>;
+
3782
+
3786 template <class T>
+
+ +
3788 {
+
3789 public:
+ +
3791 _In_ const std::shared_ptr<basic_parser<T>>& _username,
+
3792 _In_ const std::shared_ptr<basic_parser<T>>& at,
+
3793 _In_ const std::shared_ptr<basic_parser<T>>& ip_lbracket,
+
3794 _In_ const std::shared_ptr<basic_parser<T>>& ip_rbracket,
+
3795 _In_ const std::shared_ptr<basic_parser<T>>& _ipv4_host,
+
3796 _In_ const std::shared_ptr<basic_parser<T>>& _ipv6_host,
+
3797 _In_ const std::shared_ptr<basic_parser<T>>& _dns_host,
+
3798 _In_ const std::locale& locale = std::locale()) :
+ +
3800 username(_username),
+
3801 m_at(at),
+
3802 m_ip_lbracket(ip_lbracket),
+
3803 m_ip_rbracket(ip_rbracket),
+
3804 ipv4_host(_ipv4_host),
+
3805 ipv6_host(_ipv6_host),
+
3806 dns_host(_dns_host)
+
3807 {}
+
3808
+
3809 virtual void invalidate()
+
3810 {
+
3811 username->invalidate();
+
3812 ipv4_host->invalidate();
+
3813 ipv6_host->invalidate();
+
3814 dns_host->invalidate();
+ +
3816 }
+
3817
+
3818 std::shared_ptr<basic_parser<T>> username;
+
3819 std::shared_ptr<basic_parser<T>> ipv4_host;
+
3820 std::shared_ptr<basic_parser<T>> ipv6_host;
+
3821 std::shared_ptr<basic_parser<T>> dns_host;
+
3822
+
3823 protected:
+
3824 virtual bool do_match(
+
3825 _In_reads_or_z_opt_(end) const T* text,
+
3826 _In_ size_t start = 0,
+
3827 _In_ size_t end = SIZE_MAX,
+
3828 _In_ int flags = match_default)
+
3829 {
+
3830 _Assume_(text || start >= end);
+
3831
+
3832 if (username->match(text, start, end, flags) &&
+
3833 m_at->match(text, username->interval.end, end, flags))
+
3834 {
+
3835 // Username@
+
3836 if (m_ip_lbracket->match(text, m_at->interval.end, end, flags) &&
+
3837 ipv4_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
+
3838 m_ip_rbracket->match(text, ipv4_host->interval.end, end, flags))
+
3839 {
+
3840 // Host is IPv4
+
3841 this->interval.end = m_ip_rbracket->interval.end;
+
3842 ipv6_host->invalidate();
+
3843 dns_host->invalidate();
+
3844 }
+
3845 else if (
+
3846 m_ip_lbracket->match(text, m_at->interval.end, end, flags) &&
+
3847 ipv6_host->match(text, m_ip_lbracket->interval.end, end, flags) &&
+
3848 m_ip_rbracket->match(text, ipv6_host->interval.end, end, flags))
+
3849 {
+
3850 // Host is IPv6
+
3851 this->interval.end = m_ip_rbracket->interval.end;
+
3852 ipv4_host->invalidate();
+
3853 dns_host->invalidate();
+
3854 }
+
3855 else if (dns_host->match(text, m_at->interval.end, end, flags)) {
+
3856 // Host is hostname
+
3857 this->interval.end = dns_host->interval.end;
+
3858 ipv4_host->invalidate();
+
3859 ipv6_host->invalidate();
+
3860 }
+
3861 else
+
3862 goto error;
+
3863 this->interval.start = start;
+
3864 return true;
+
3865 }
+
3866
+
3867 error:
+
3868 invalidate();
+
3869 return false;
+
3870 }
+
3871
+
3872 std::shared_ptr<basic_parser<T>> m_at;
+
3873 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
+
3874 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
+
3875 };
-
3875
- - -
3878#ifdef _UNICODE
- -
3880#else
- -
3882#endif
- -
3884
-
3888 template <class T>
-
- -
3890 {
-
3891 public:
- -
3893 _In_ const std::shared_ptr<basic_parser<T>>& _emoticon,
-
3894 _In_ const std::shared_ptr<basic_parser<T>>& _apex,
-
3895 _In_ const std::shared_ptr<basic_parser<T>>& _eyes,
-
3896 _In_ const std::shared_ptr<basic_parser<T>>& _nose,
-
3897 _In_ const std::shared_ptr<basic_set<T>>& _mouth,
-
3898 _In_ const std::locale& locale = std::locale()) :
- - -
3901 apex(_apex),
-
3902 eyes(_eyes),
-
3903 nose(_nose),
-
3904 mouth(_mouth)
-
3905 {}
-
3906
-
3907 virtual void invalidate()
-
3908 {
-
3909 if (emoticon) emoticon->invalidate();
-
3910 if (apex) apex->invalidate();
-
3911 eyes->invalidate();
-
3912 if (nose) nose->invalidate();
-
3913 mouth->invalidate();
- -
3915 }
-
3916
-
3917 std::shared_ptr<basic_parser<T>> emoticon;
-
3918 std::shared_ptr<basic_parser<T>> apex;
-
3919 std::shared_ptr<basic_parser<T>> eyes;
-
3920 std::shared_ptr<basic_parser<T>> nose;
-
3921 std::shared_ptr<basic_set<T>> mouth;
-
3922
-
3923 protected:
-
3924 virtual bool do_match(
-
3925 _In_reads_or_z_opt_(end) const T* text,
-
3926 _In_ size_t start = 0,
-
3927 _In_ size_t end = SIZE_MAX,
-
3928 _In_ int flags = match_default)
-
3929 {
-
3930 _Assume_(text || start >= end);
-
3931
-
3932 if (emoticon && emoticon->match(text, start, end, flags)) {
-
3933 if (apex) apex->invalidate();
-
3934 eyes->invalidate();
-
3935 if (nose) nose->invalidate();
-
3936 mouth->invalidate();
-
3937 this->interval.start = start;
-
3938 this->interval.end = emoticon->interval.end;
-
3939 return true;
-
3940 }
-
3941
-
3942 this->interval.end = start;
-
3943
-
3944 if (apex && apex->match(text, this->interval.end, end, flags))
-
3945 this->interval.end = apex->interval.end;
-
3946
-
3947 if (eyes->match(text, this->interval.end, end, flags)) {
-
3948 if (nose && nose->match(text, eyes->interval.end, end, flags) &&
-
3949 mouth->match(text, nose->interval.end, end, flags))
-
3950 {
-
3951 size_t
- -
3953 hit_offset = mouth->hit_offset;
-
3954 // Mouth may repeat :-)))))))
-
3955 for (this->interval.end = mouth->interval.end; mouth->match(text, this->interval.end, end, flags) && mouth->hit_offset == hit_offset; this->interval.end = mouth->interval.end);
-
3956 mouth->interval.start = start_mouth;
-
3957 mouth->interval.end = this->interval.end;
-
3958 this->interval.start = start;
-
3959 return true;
-
3960 }
-
3961 if (mouth->match(text, eyes->interval.end, end, flags)) {
-
3962 size_t
- -
3964 hit_offset = mouth->hit_offset;
-
3965 // Mouth may repeat :-)))))))
-
3966 for (this->interval.end = mouth->interval.end; mouth->match(text, this->interval.end, end, flags) && mouth->hit_offset == hit_offset; this->interval.end = mouth->interval.end);
-
3967 if (nose) nose->invalidate();
-
3968 mouth->interval.start = start_mouth;
-
3969 mouth->interval.end = this->interval.end;
-
3970 this->interval.start = start;
-
3971 return true;
-
3972 }
-
3973 }
-
3974
-
3975 if (emoticon) emoticon->invalidate();
-
3976 if (apex) apex->invalidate();
-
3977 eyes->invalidate();
-
3978 if (nose) nose->invalidate();
-
3979 mouth->invalidate();
-
3980 this->interval.invalidate();
-
3981 return false;
-
3982 }
-
3983 };
+
3876
+ + +
3879#ifdef _UNICODE
+ +
3881#else
+ +
3883#endif
+ +
3885
+
3889 template <class T>
+
+ +
3891 {
+
3892 public:
+ +
3894 _In_ const std::shared_ptr<basic_parser<T>>& _emoticon,
+
3895 _In_ const std::shared_ptr<basic_parser<T>>& _apex,
+
3896 _In_ const std::shared_ptr<basic_parser<T>>& _eyes,
+
3897 _In_ const std::shared_ptr<basic_parser<T>>& _nose,
+
3898 _In_ const std::shared_ptr<basic_set<T>>& _mouth,
+
3899 _In_ const std::locale& locale = std::locale()) :
+ + +
3902 apex(_apex),
+
3903 eyes(_eyes),
+
3904 nose(_nose),
+
3905 mouth(_mouth)
+
3906 {}
+
3907
+
3908 virtual void invalidate()
+
3909 {
+
3910 if (emoticon) emoticon->invalidate();
+
3911 if (apex) apex->invalidate();
+
3912 eyes->invalidate();
+
3913 if (nose) nose->invalidate();
+
3914 mouth->invalidate();
+ +
3916 }
+
3917
+
3918 std::shared_ptr<basic_parser<T>> emoticon;
+
3919 std::shared_ptr<basic_parser<T>> apex;
+
3920 std::shared_ptr<basic_parser<T>> eyes;
+
3921 std::shared_ptr<basic_parser<T>> nose;
+
3922 std::shared_ptr<basic_set<T>> mouth;
+
3923
+
3924 protected:
+
3925 virtual bool do_match(
+
3926 _In_reads_or_z_opt_(end) const T* text,
+
3927 _In_ size_t start = 0,
+
3928 _In_ size_t end = SIZE_MAX,
+
3929 _In_ int flags = match_default)
+
3930 {
+
3931 _Assume_(text || start >= end);
+
3932
+
3933 if (emoticon && emoticon->match(text, start, end, flags)) {
+
3934 if (apex) apex->invalidate();
+
3935 eyes->invalidate();
+
3936 if (nose) nose->invalidate();
+
3937 mouth->invalidate();
+
3938 this->interval.start = start;
+
3939 this->interval.end = emoticon->interval.end;
+
3940 return true;
+
3941 }
+
3942
+
3943 this->interval.end = start;
+
3944
+
3945 if (apex && apex->match(text, this->interval.end, end, flags))
+
3946 this->interval.end = apex->interval.end;
+
3947
+
3948 if (eyes->match(text, this->interval.end, end, flags)) {
+
3949 if (nose && nose->match(text, eyes->interval.end, end, flags) &&
+
3950 mouth->match(text, nose->interval.end, end, flags))
+
3951 {
+
3952 size_t
+ +
3954 hit_offset = mouth->hit_offset;
+
3955 // Mouth may repeat :-)))))))
+
3956 for (this->interval.end = mouth->interval.end; mouth->match(text, this->interval.end, end, flags) && mouth->hit_offset == hit_offset; this->interval.end = mouth->interval.end);
+
3957 mouth->interval.start = start_mouth;
+
3958 mouth->interval.end = this->interval.end;
+
3959 this->interval.start = start;
+
3960 return true;
+
3961 }
+
3962 if (mouth->match(text, eyes->interval.end, end, flags)) {
+
3963 size_t
+ +
3965 hit_offset = mouth->hit_offset;
+
3966 // Mouth may repeat :-)))))))
+
3967 for (this->interval.end = mouth->interval.end; mouth->match(text, this->interval.end, end, flags) && mouth->hit_offset == hit_offset; this->interval.end = mouth->interval.end);
+
3968 if (nose) nose->invalidate();
+
3969 mouth->interval.start = start_mouth;
+
3970 mouth->interval.end = this->interval.end;
+
3971 this->interval.start = start;
+
3972 return true;
+
3973 }
+
3974 }
+
3975
+
3976 if (emoticon) emoticon->invalidate();
+
3977 if (apex) apex->invalidate();
+
3978 eyes->invalidate();
+
3979 if (nose) nose->invalidate();
+
3980 mouth->invalidate();
+
3981 this->interval.invalidate();
+
3982 return false;
+
3983 }
+
3984 };
-
3984
-
3985 using emoticon = basic_emoticon<char>;
-
3986 using wemoticon = basic_emoticon<wchar_t>;
-
3987#ifdef _UNICODE
-
3988 using temoticon = wemoticon;
-
3989#else
-
3990 using temoticon = emoticon;
-
3991#endif
-
3992 using sgml_emoticon = basic_emoticon<char>;
-
3993
-
3997 enum date_format_t {
-
3998 date_format_none = 0,
-
3999 date_format_dmy = 0x1,
-
4000 date_format_mdy = 0x2,
-
4001 date_format_ymd = 0x4,
-
4002 date_format_ym = 0x8,
-
4003 date_format_my = 0x10,
-
4004 date_format_dm = 0x20,
-
4005 date_format_md = 0x40,
-
4006 };
-
4007
-
4011 template <class T>
-
-
4012 class basic_date : public basic_parser<T>
-
4013 {
-
4014 public:
-
4015 basic_date(
-
4016 _In_ int format_mask,
-
4017 _In_ const std::shared_ptr<basic_integer<T>>& _day,
-
4018 _In_ const std::shared_ptr<basic_integer<T>>& _month,
-
4019 _In_ const std::shared_ptr<basic_integer<T>>& _year,
-
4020 _In_ const std::shared_ptr<basic_set<T>>& separator,
-
4021 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
4022 _In_ const std::locale& locale = std::locale()) :
- -
4024 format(date_format_none),
-
4025 m_format_mask(format_mask),
-
4026 day(_day),
-
4027 month(_month),
-
4028 year(_year),
-
4029 m_separator(separator),
-
4030 m_space(space)
-
4031 {}
-
4032
-
4033 virtual void invalidate()
-
4034 {
-
4035 if (day) day->invalidate();
-
4036 if (month) month->invalidate();
-
4037 if (year) year->invalidate();
-
4038 format = date_format_none;
- -
4040 }
-
4041
-
4042 date_format_t format;
-
4043 std::shared_ptr<basic_integer<T>> day;
-
4044 std::shared_ptr<basic_integer<T>> month;
-
4045 std::shared_ptr<basic_integer<T>> year;
-
4046
-
4047 protected:
-
4048 virtual bool do_match(
-
4049 _In_reads_or_z_opt_(end) const T* text,
-
4050 _In_ size_t start = 0,
-
4051 _In_ size_t end = SIZE_MAX,
-
4052 _In_ int flags = match_default)
-
4053 {
-
4054 _Assume_(text || start >= end);
-
4055
-
4056 const int space_match_flags = flags & ~match_multiline; // Spaces in dates must never be broken in new line.
-
4057 if ((m_format_mask & date_format_dmy) == date_format_dmy) {
-
4058 if (day->match(text, start, end, flags)) {
-
4059 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4060 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4061 size_t hit_offset = m_separator->hit_offset;
-
4062 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4063 if (month->match(text, this->interval.end, end, flags)) {
-
4064 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4065 if (m_separator->match(text, this->interval.end, end, flags) &&
-
4066 m_separator->hit_offset == hit_offset) // Both separators must match.
-
4067 {
-
4068 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4069 if (year->match(text, this->interval.end, end, flags) &&
-
4070 is_valid(day->value, month->value))
-
4071 {
-
4072 this->interval.start = start;
-
4073 this->interval.end = year->interval.end;
-
4074 format = date_format_dmy;
-
4075 return true;
-
4076 }
-
4077 }
-
4078 }
-
4079 }
-
4080 }
-
4081 }
-
4082
-
4083 if ((m_format_mask & date_format_mdy) == date_format_mdy) {
-
4084 if (month->match(text, start, end, flags)) {
-
4085 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4086 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4087 size_t hit_offset = m_separator->hit_offset;
-
4088 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4089 if (day->match(text, this->interval.end, end, flags)) {
-
4090 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4091 if (m_separator->match(text, this->interval.end, end, flags) &&
-
4092 m_separator->hit_offset == hit_offset) // Both separators must match.
-
4093 {
-
4094 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4095 if (year->match(text, this->interval.end, end, flags) &&
-
4096 is_valid(day->value, month->value))
-
4097 {
-
4098 this->interval.start = start;
-
4099 this->interval.end = year->interval.end;
-
4100 format = date_format_mdy;
-
4101 return true;
-
4102 }
-
4103 }
-
4104 }
-
4105 }
-
4106 }
-
4107 }
-
4108
-
4109 if ((m_format_mask & date_format_ymd) == date_format_ymd) {
-
4110 if (year->match(text, start, end, flags)) {
-
4111 for (this->interval.end = year->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4112 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4113 size_t hit_offset = m_separator->hit_offset;
-
4114 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4115 if (month->match(text, this->interval.end, end, flags)) {
-
4116 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4117 if (m_separator->match(text, this->interval.end, end, flags) &&
-
4118 m_separator->hit_offset == hit_offset) // Both separators must match.
-
4119 {
-
4120 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4121 if (day->match(text, this->interval.end, end, flags) &&
-
4122 is_valid(day->value, month->value))
-
4123 {
-
4124 this->interval.start = start;
-
4125 this->interval.end = day->interval.end;
-
4126 format = date_format_ymd;
-
4127 return true;
-
4128 }
-
4129 }
-
4130 }
-
4131 }
-
4132 }
-
4133 }
-
4134
-
4135 if ((m_format_mask & date_format_ym) == date_format_ym) {
-
4136 if (year->match(text, start, end, flags)) {
-
4137 for (this->interval.end = year->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4138 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4139 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4140 if (month->match(text, this->interval.end, end, flags) &&
-
4141 is_valid(SIZE_MAX, month->value))
-
4142 {
-
4143 if (day) day->invalidate();
-
4144 this->interval.start = start;
-
4145 this->interval.end = month->interval.end;
-
4146 format = date_format_ym;
-
4147 return true;
-
4148 }
-
4149 }
-
4150 }
-
4151 }
-
4152
-
4153 if ((m_format_mask & date_format_my) == date_format_my) {
-
4154 if (month->match(text, start, end, flags)) {
-
4155 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4156 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4157 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4158 if (year->match(text, this->interval.end, end, flags) &&
-
4159 is_valid(SIZE_MAX, month->value))
-
4160 {
-
4161 if (day) day->invalidate();
-
4162 this->interval.start = start;
-
4163 this->interval.end = year->interval.end;
-
4164 format = date_format_my;
-
4165 return true;
-
4166 }
-
4167 }
-
4168 }
-
4169 }
-
4170
-
4171 if ((m_format_mask & date_format_dm) == date_format_dm) {
-
4172 if (day->match(text, start, end, flags)) {
-
4173 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4174 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4175 size_t hit_offset = m_separator->hit_offset;
-
4176 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4177 if (month->match(text, this->interval.end, end, flags) &&
-
4178 is_valid(day->value, month->value))
-
4179 {
-
4180 if (year) year->invalidate();
-
4181 this->interval.start = start;
-
4182 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4183 if (m_separator->match(text, this->interval.end, end, flags) &&
-
4184 m_separator->hit_offset == hit_offset) // Both separators must match.
-
4185 this->interval.end = m_separator->interval.end;
-
4186 else
-
4187 this->interval.end = month->interval.end;
-
4188 format = date_format_dm;
-
4189 return true;
-
4190 }
-
4191 }
-
4192 }
-
4193 }
-
4194
-
4195 if ((m_format_mask & date_format_md) == date_format_md) {
-
4196 if (month->match(text, start, end, flags)) {
-
4197 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4198 if (m_separator->match(text, this->interval.end, end, flags)) {
-
4199 size_t hit_offset = m_separator->hit_offset;
-
4200 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4201 if (day->match(text, this->interval.end, end, flags) &&
-
4202 is_valid(day->value, month->value))
-
4203 {
-
4204 if (year) year->invalidate();
-
4205 this->interval.start = start;
-
4206 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
-
4207 if (m_separator->match(text, this->interval.end, end, flags) &&
-
4208 m_separator->hit_offset == hit_offset) // Both separators must match.
-
4209 this->interval.end = m_separator->interval.end;
-
4210 else
-
4211 this->interval.end = day->interval.end;
-
4212 format = date_format_md;
-
4213 return true;
-
4214 }
-
4215 }
-
4216 }
-
4217 }
-
4218
-
4219 if (day) day->invalidate();
-
4220 if (month) month->invalidate();
-
4221 if (year) year->invalidate();
-
4222 format = date_format_none;
-
4223 this->interval.invalidate();
-
4224 return false;
-
4225 }
-
4226
-
4227 static bool is_valid(size_t day, size_t month)
-
4228 {
-
4229 if (month == SIZE_MAX) {
-
4230 // Default to January. This allows validating day only, as January has all 31 days.
-
4231 month = 1;
-
4232 }
-
4233 if (day == SIZE_MAX) {
-
4234 // Default to 1st day in month. This allows validating month only, as each month has 1st day.
-
4235 day = 1;
-
4236 }
-
4237
-
4238 switch (month) {
-
4239 case 1:
-
4240 case 3:
-
4241 case 5:
-
4242 case 7:
-
4243 case 8:
-
4244 case 10:
-
4245 case 12:
-
4246 return 1 <= day && day <= 31;
-
4247 case 2:
-
4248 return 1 <= day && day <= 29;
-
4249 case 4:
-
4250 case 6:
-
4251 case 9:
-
4252 case 11:
-
4253 return 1 <= day && day <= 30;
-
4254 default:
-
4255 return false;
-
4256 }
-
4257 }
-
4258
-
4259 int m_format_mask;
-
4260 std::shared_ptr<basic_set<T>> m_separator;
-
4261 std::shared_ptr<basic_parser<T>> m_space;
-
4262 };
+
3985
+
3986 using emoticon = basic_emoticon<char>;
+
3987 using wemoticon = basic_emoticon<wchar_t>;
+
3988#ifdef _UNICODE
+
3989 using temoticon = wemoticon;
+
3990#else
+
3991 using temoticon = emoticon;
+
3992#endif
+
3993 using sgml_emoticon = basic_emoticon<char>;
+
3994
+
3998 enum date_format_t {
+
3999 date_format_none = 0,
+
4000 date_format_dmy = 0x1,
+
4001 date_format_mdy = 0x2,
+
4002 date_format_ymd = 0x4,
+
4003 date_format_ym = 0x8,
+
4004 date_format_my = 0x10,
+
4005 date_format_dm = 0x20,
+
4006 date_format_md = 0x40,
+
4007 };
+
4008
+
4012 template <class T>
+
+
4013 class basic_date : public basic_parser<T>
+
4014 {
+
4015 public:
+
4016 basic_date(
+
4017 _In_ int format_mask,
+
4018 _In_ const std::shared_ptr<basic_integer<T>>& _day,
+
4019 _In_ const std::shared_ptr<basic_integer<T>>& _month,
+
4020 _In_ const std::shared_ptr<basic_integer<T>>& _year,
+
4021 _In_ const std::shared_ptr<basic_set<T>>& separator,
+
4022 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
4023 _In_ const std::locale& locale = std::locale()) :
+ +
4025 format(date_format_none),
+
4026 m_format_mask(format_mask),
+
4027 day(_day),
+
4028 month(_month),
+
4029 year(_year),
+
4030 m_separator(separator),
+
4031 m_space(space)
+
4032 {}
+
4033
+
4034 virtual void invalidate()
+
4035 {
+
4036 if (day) day->invalidate();
+
4037 if (month) month->invalidate();
+
4038 if (year) year->invalidate();
+
4039 format = date_format_none;
+ +
4041 }
+
4042
+
4043 date_format_t format;
+
4044 std::shared_ptr<basic_integer<T>> day;
+
4045 std::shared_ptr<basic_integer<T>> month;
+
4046 std::shared_ptr<basic_integer<T>> year;
+
4047
+
4048 protected:
+
4049 virtual bool do_match(
+
4050 _In_reads_or_z_opt_(end) const T* text,
+
4051 _In_ size_t start = 0,
+
4052 _In_ size_t end = SIZE_MAX,
+
4053 _In_ int flags = match_default)
+
4054 {
+
4055 _Assume_(text || start >= end);
+
4056
+
4057 const int space_match_flags = flags & ~match_multiline; // Spaces in dates must never be broken in new line.
+
4058 if ((m_format_mask & date_format_dmy) == date_format_dmy) {
+
4059 if (day->match(text, start, end, flags)) {
+
4060 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4061 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4062 size_t hit_offset = m_separator->hit_offset;
+
4063 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4064 if (month->match(text, this->interval.end, end, flags)) {
+
4065 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4066 if (m_separator->match(text, this->interval.end, end, flags) &&
+
4067 m_separator->hit_offset == hit_offset) // Both separators must match.
+
4068 {
+
4069 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4070 if (year->match(text, this->interval.end, end, flags) &&
+
4071 is_valid(day->value, month->value))
+
4072 {
+
4073 this->interval.start = start;
+
4074 this->interval.end = year->interval.end;
+
4075 format = date_format_dmy;
+
4076 return true;
+
4077 }
+
4078 }
+
4079 }
+
4080 }
+
4081 }
+
4082 }
+
4083
+
4084 if ((m_format_mask & date_format_mdy) == date_format_mdy) {
+
4085 if (month->match(text, start, end, flags)) {
+
4086 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4087 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4088 size_t hit_offset = m_separator->hit_offset;
+
4089 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4090 if (day->match(text, this->interval.end, end, flags)) {
+
4091 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4092 if (m_separator->match(text, this->interval.end, end, flags) &&
+
4093 m_separator->hit_offset == hit_offset) // Both separators must match.
+
4094 {
+
4095 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4096 if (year->match(text, this->interval.end, end, flags) &&
+
4097 is_valid(day->value, month->value))
+
4098 {
+
4099 this->interval.start = start;
+
4100 this->interval.end = year->interval.end;
+
4101 format = date_format_mdy;
+
4102 return true;
+
4103 }
+
4104 }
+
4105 }
+
4106 }
+
4107 }
+
4108 }
+
4109
+
4110 if ((m_format_mask & date_format_ymd) == date_format_ymd) {
+
4111 if (year->match(text, start, end, flags)) {
+
4112 for (this->interval.end = year->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4113 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4114 size_t hit_offset = m_separator->hit_offset;
+
4115 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4116 if (month->match(text, this->interval.end, end, flags)) {
+
4117 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4118 if (m_separator->match(text, this->interval.end, end, flags) &&
+
4119 m_separator->hit_offset == hit_offset) // Both separators must match.
+
4120 {
+
4121 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4122 if (day->match(text, this->interval.end, end, flags) &&
+
4123 is_valid(day->value, month->value))
+
4124 {
+
4125 this->interval.start = start;
+
4126 this->interval.end = day->interval.end;
+
4127 format = date_format_ymd;
+
4128 return true;
+
4129 }
+
4130 }
+
4131 }
+
4132 }
+
4133 }
+
4134 }
+
4135
+
4136 if ((m_format_mask & date_format_ym) == date_format_ym) {
+
4137 if (year->match(text, start, end, flags)) {
+
4138 for (this->interval.end = year->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4139 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4140 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4141 if (month->match(text, this->interval.end, end, flags) &&
+
4142 is_valid(SIZE_MAX, month->value))
+
4143 {
+
4144 if (day) day->invalidate();
+
4145 this->interval.start = start;
+
4146 this->interval.end = month->interval.end;
+
4147 format = date_format_ym;
+
4148 return true;
+
4149 }
+
4150 }
+
4151 }
+
4152 }
+
4153
+
4154 if ((m_format_mask & date_format_my) == date_format_my) {
+
4155 if (month->match(text, start, end, flags)) {
+
4156 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4157 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4158 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4159 if (year->match(text, this->interval.end, end, flags) &&
+
4160 is_valid(SIZE_MAX, month->value))
+
4161 {
+
4162 if (day) day->invalidate();
+
4163 this->interval.start = start;
+
4164 this->interval.end = year->interval.end;
+
4165 format = date_format_my;
+
4166 return true;
+
4167 }
+
4168 }
+
4169 }
+
4170 }
+
4171
+
4172 if ((m_format_mask & date_format_dm) == date_format_dm) {
+
4173 if (day->match(text, start, end, flags)) {
+
4174 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4175 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4176 size_t hit_offset = m_separator->hit_offset;
+
4177 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4178 if (month->match(text, this->interval.end, end, flags) &&
+
4179 is_valid(day->value, month->value))
+
4180 {
+
4181 if (year) year->invalidate();
+
4182 this->interval.start = start;
+
4183 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4184 if (m_separator->match(text, this->interval.end, end, flags) &&
+
4185 m_separator->hit_offset == hit_offset) // Both separators must match.
+
4186 this->interval.end = m_separator->interval.end;
+
4187 else
+
4188 this->interval.end = month->interval.end;
+
4189 format = date_format_dm;
+
4190 return true;
+
4191 }
+
4192 }
+
4193 }
+
4194 }
+
4195
+
4196 if ((m_format_mask & date_format_md) == date_format_md) {
+
4197 if (month->match(text, start, end, flags)) {
+
4198 for (this->interval.end = month->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4199 if (m_separator->match(text, this->interval.end, end, flags)) {
+
4200 size_t hit_offset = m_separator->hit_offset;
+
4201 for (this->interval.end = m_separator->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4202 if (day->match(text, this->interval.end, end, flags) &&
+
4203 is_valid(day->value, month->value))
+
4204 {
+
4205 if (year) year->invalidate();
+
4206 this->interval.start = start;
+
4207 for (this->interval.end = day->interval.end; m_space->match(text, this->interval.end, end, space_match_flags); this->interval.end = m_space->interval.end);
+
4208 if (m_separator->match(text, this->interval.end, end, flags) &&
+
4209 m_separator->hit_offset == hit_offset) // Both separators must match.
+
4210 this->interval.end = m_separator->interval.end;
+
4211 else
+
4212 this->interval.end = day->interval.end;
+
4213 format = date_format_md;
+
4214 return true;
+
4215 }
+
4216 }
+
4217 }
+
4218 }
+
4219
+
4220 if (day) day->invalidate();
+
4221 if (month) month->invalidate();
+
4222 if (year) year->invalidate();
+
4223 format = date_format_none;
+
4224 this->interval.invalidate();
+
4225 return false;
+
4226 }
+
4227
+
4228 static bool is_valid(size_t day, size_t month)
+
4229 {
+
4230 if (month == SIZE_MAX) {
+
4231 // Default to January. This allows validating day only, as January has all 31 days.
+
4232 month = 1;
+
4233 }
+
4234 if (day == SIZE_MAX) {
+
4235 // Default to 1st day in month. This allows validating month only, as each month has 1st day.
+
4236 day = 1;
+
4237 }
+
4238
+
4239 switch (month) {
+
4240 case 1:
+
4241 case 3:
+
4242 case 5:
+
4243 case 7:
+
4244 case 8:
+
4245 case 10:
+
4246 case 12:
+
4247 return 1 <= day && day <= 31;
+
4248 case 2:
+
4249 return 1 <= day && day <= 29;
+
4250 case 4:
+
4251 case 6:
+
4252 case 9:
+
4253 case 11:
+
4254 return 1 <= day && day <= 30;
+
4255 default:
+
4256 return false;
+
4257 }
+
4258 }
+
4259
+
4260 int m_format_mask;
+
4261 std::shared_ptr<basic_set<T>> m_separator;
+
4262 std::shared_ptr<basic_parser<T>> m_space;
+
4263 };
-
4263
-
4264 using date = basic_date<char>;
-
4265 using wdate = basic_date<wchar_t>;
-
4266#ifdef _UNICODE
-
4267 using tdate = wdate;
-
4268#else
-
4269 using tdate = date;
-
4270#endif
- -
4272
-
4276 template <class T>
-
-
4277 class basic_time : public basic_parser<T>
-
4278 {
-
4279 public:
-
4280 basic_time(
-
4281 _In_ const std::shared_ptr<basic_integer10<T>>& _hour,
-
4282 _In_ const std::shared_ptr<basic_integer10<T>>& _minute,
-
4283 _In_ const std::shared_ptr<basic_integer10<T>>& _second,
-
4284 _In_ const std::shared_ptr<basic_integer10<T>>& _millisecond,
-
4285 _In_ const std::shared_ptr<basic_set<T>>& separator,
-
4286 _In_ const std::shared_ptr<basic_parser<T>>& millisecond_separator,
-
4287 _In_ const std::locale& locale = std::locale()) :
- -
4289 hour(_hour),
-
4290 minute(_minute),
-
4291 second(_second),
-
4292 millisecond(_millisecond),
-
4293 m_separator(separator),
-
4294 m_millisecond_separator(millisecond_separator)
-
4295 {}
-
4296
-
4297 virtual void invalidate()
-
4298 {
-
4299 hour->invalidate();
-
4300 minute->invalidate();
-
4301 if (second) second->invalidate();
-
4302 if (millisecond) millisecond->invalidate();
- -
4304 }
-
4305
-
4306 std::shared_ptr<basic_integer10<T>> hour;
-
4307 std::shared_ptr<basic_integer10<T>> minute;
-
4308 std::shared_ptr<basic_integer10<T>> second;
-
4309 std::shared_ptr<basic_integer10<T>> millisecond;
-
4310
-
4311 protected:
-
4312 virtual bool do_match(
-
4313 _In_reads_or_z_opt_(end) const T* text,
-
4314 _In_ size_t start = 0,
-
4315 _In_ size_t end = SIZE_MAX,
-
4316 _In_ int flags = match_default)
-
4317 {
-
4318 _Assume_(text || start >= end);
-
4319
-
4320 if (hour->match(text, start, end, flags) &&
-
4321 m_separator->match(text, hour->interval.end, end, flags) &&
-
4322 minute->match(text, m_separator->interval.end, end, flags) &&
-
4323 minute->value < 60)
-
4324 {
-
4325 // hh::mm
-
4326 size_t hit_offset = m_separator->hit_offset;
-
4327 if (m_separator->match(text, minute->interval.end, end, flags) &&
-
4328 m_separator->hit_offset == hit_offset && // Both separators must match.
-
4329 second && second->match(text, m_separator->interval.end, end, flags) &&
-
4330 second->value < 60)
-
4331 {
-
4332 // hh::mm:ss
-
4333 if (m_millisecond_separator && m_millisecond_separator->match(text, second->interval.end, end, flags) &&
-
4334 millisecond && millisecond->match(text, m_millisecond_separator->interval.end, end, flags) &&
-
4335 millisecond->value < 1000)
-
4336 {
-
4337 // hh::mm:ss.mmmm
-
4338 this->interval.end = millisecond->interval.end;
-
4339 }
-
4340 else {
-
4341 if (millisecond) millisecond->invalidate();
-
4342 this->interval.end = second->interval.end;
-
4343 }
-
4344 }
-
4345 else {
-
4346 if (second) second->invalidate();
-
4347 if (millisecond) millisecond->invalidate();
-
4348 this->interval.end = minute->interval.end;
-
4349 }
-
4350 this->interval.start = start;
-
4351 return true;
-
4352 }
-
4353
-
4354 hour->invalidate();
-
4355 minute->invalidate();
-
4356 if (second) second->invalidate();
-
4357 if (millisecond) millisecond->invalidate();
-
4358 this->interval.invalidate();
-
4359 return false;
-
4360 }
-
4361
-
4362 std::shared_ptr<basic_set<T>> m_separator;
-
4363 std::shared_ptr<basic_parser<T>> m_millisecond_separator;
-
4364 };
+
4264
+
4265 using date = basic_date<char>;
+
4266 using wdate = basic_date<wchar_t>;
+
4267#ifdef _UNICODE
+
4268 using tdate = wdate;
+
4269#else
+
4270 using tdate = date;
+
4271#endif
+ +
4273
+
4277 template <class T>
+
+
4278 class basic_time : public basic_parser<T>
+
4279 {
+
4280 public:
+
4281 basic_time(
+
4282 _In_ const std::shared_ptr<basic_integer10<T>>& _hour,
+
4283 _In_ const std::shared_ptr<basic_integer10<T>>& _minute,
+
4284 _In_ const std::shared_ptr<basic_integer10<T>>& _second,
+
4285 _In_ const std::shared_ptr<basic_integer10<T>>& _millisecond,
+
4286 _In_ const std::shared_ptr<basic_set<T>>& separator,
+
4287 _In_ const std::shared_ptr<basic_parser<T>>& millisecond_separator,
+
4288 _In_ const std::locale& locale = std::locale()) :
+ +
4290 hour(_hour),
+
4291 minute(_minute),
+
4292 second(_second),
+
4293 millisecond(_millisecond),
+
4294 m_separator(separator),
+
4295 m_millisecond_separator(millisecond_separator)
+
4296 {}
+
4297
+
4298 virtual void invalidate()
+
4299 {
+
4300 hour->invalidate();
+
4301 minute->invalidate();
+
4302 if (second) second->invalidate();
+
4303 if (millisecond) millisecond->invalidate();
+ +
4305 }
+
4306
+
4307 std::shared_ptr<basic_integer10<T>> hour;
+
4308 std::shared_ptr<basic_integer10<T>> minute;
+
4309 std::shared_ptr<basic_integer10<T>> second;
+
4310 std::shared_ptr<basic_integer10<T>> millisecond;
+
4311
+
4312 protected:
+
4313 virtual bool do_match(
+
4314 _In_reads_or_z_opt_(end) const T* text,
+
4315 _In_ size_t start = 0,
+
4316 _In_ size_t end = SIZE_MAX,
+
4317 _In_ int flags = match_default)
+
4318 {
+
4319 _Assume_(text || start >= end);
+
4320
+
4321 if (hour->match(text, start, end, flags) &&
+
4322 m_separator->match(text, hour->interval.end, end, flags) &&
+
4323 minute->match(text, m_separator->interval.end, end, flags) &&
+
4324 minute->value < 60)
+
4325 {
+
4326 // hh::mm
+
4327 size_t hit_offset = m_separator->hit_offset;
+
4328 if (m_separator->match(text, minute->interval.end, end, flags) &&
+
4329 m_separator->hit_offset == hit_offset && // Both separators must match.
+
4330 second && second->match(text, m_separator->interval.end, end, flags) &&
+
4331 second->value < 60)
+
4332 {
+
4333 // hh::mm:ss
+
4334 if (m_millisecond_separator && m_millisecond_separator->match(text, second->interval.end, end, flags) &&
+
4335 millisecond && millisecond->match(text, m_millisecond_separator->interval.end, end, flags) &&
+
4336 millisecond->value < 1000)
+
4337 {
+
4338 // hh::mm:ss.mmmm
+
4339 this->interval.end = millisecond->interval.end;
+
4340 }
+
4341 else {
+
4342 if (millisecond) millisecond->invalidate();
+
4343 this->interval.end = second->interval.end;
+
4344 }
+
4345 }
+
4346 else {
+
4347 if (second) second->invalidate();
+
4348 if (millisecond) millisecond->invalidate();
+
4349 this->interval.end = minute->interval.end;
+
4350 }
+
4351 this->interval.start = start;
+
4352 return true;
+
4353 }
+
4354
+
4355 hour->invalidate();
+
4356 minute->invalidate();
+
4357 if (second) second->invalidate();
+
4358 if (millisecond) millisecond->invalidate();
+
4359 this->interval.invalidate();
+
4360 return false;
+
4361 }
+
4362
+
4363 std::shared_ptr<basic_set<T>> m_separator;
+
4364 std::shared_ptr<basic_parser<T>> m_millisecond_separator;
+
4365 };
-
4365
-
4366 using time = basic_time<char>;
-
4367 using wtime = basic_time<wchar_t>;
-
4368#ifdef _UNICODE
-
4369 using ttime = wtime;
-
4370#else
-
4371 using ttime = time;
-
4372#endif
- -
4374
-
4378 template <class T>
-
-
4379 class basic_angle : public basic_parser<T>
-
4380 {
-
4381 public:
- -
4383 _In_ const std::shared_ptr<basic_integer10<T>>& _degree,
-
4384 _In_ const std::shared_ptr<basic_parser<T>>& _degree_separator,
-
4385 _In_ const std::shared_ptr<basic_integer10<T>>& _minute,
-
4386 _In_ const std::shared_ptr<basic_parser<T>>& _minute_separator,
-
4387 _In_ const std::shared_ptr<basic_integer10<T>>& _second,
-
4388 _In_ const std::shared_ptr<basic_parser<T>>& _second_separator,
-
4389 _In_ const std::shared_ptr<basic_parser<T>>& _decimal,
-
4390 _In_ const std::locale& locale = std::locale()) :
- -
4392 degree(_degree),
-
4393 degree_separator(_degree_separator),
-
4394 minute(_minute),
-
4395 minute_separator(_minute_separator),
-
4396 second(_second),
-
4397 second_separator(_second_separator),
-
4398 decimal(_decimal)
-
4399 {}
-
4400
-
4401 virtual void invalidate()
-
4402 {
-
4403 degree->invalidate();
-
4404 degree_separator->invalidate();
-
4405 minute->invalidate();
-
4406 minute_separator->invalidate();
-
4407 if (second) second->invalidate();
-
4408 if (second_separator) second_separator->invalidate();
-
4409 if (decimal) decimal->invalidate();
- -
4411 }
-
4412
-
4413 std::shared_ptr<basic_integer10<T>> degree;
-
4414 std::shared_ptr<basic_parser<T>> degree_separator;
-
4415 std::shared_ptr<basic_integer10<T>> minute;
-
4416 std::shared_ptr<basic_parser<T>> minute_separator;
-
4417 std::shared_ptr<basic_integer10<T>> second;
-
4418 std::shared_ptr<basic_parser<T>> second_separator;
-
4419 std::shared_ptr<basic_parser<T>> decimal;
-
4420
-
4421 protected:
-
4422 virtual bool do_match(
-
4423 _In_reads_or_z_opt_(end) const T* text,
-
4424 _In_ size_t start = 0,
-
4425 _In_ size_t end = SIZE_MAX,
-
4426 _In_ int flags = match_default)
-
4427 {
-
4428 _Assume_(text || start >= end);
-
4429
-
4430 this->interval.end = start;
-
4431
-
4432 if (degree->match(text, this->interval.end, end, flags) &&
-
4433 degree_separator->match(text, degree->interval.end, end, flags))
-
4434 {
-
4435 // Degrees
-
4436 this->interval.end = degree_separator->interval.end;
-
4437 }
-
4438 else {
-
4439 degree->invalidate();
-
4440 degree_separator->invalidate();
-
4441 }
-
4442
-
4443 if (minute->match(text, this->interval.end, end, flags) &&
-
4444 minute->value < 60 &&
-
4445 minute_separator->match(text, minute->interval.end, end, flags))
-
4446 {
-
4447 // Minutes
-
4448 this->interval.end = minute_separator->interval.end;
-
4449 }
-
4450 else {
-
4451 minute->invalidate();
-
4452 minute_separator->invalidate();
-
4453 }
-
4454
-
4455 if (second && second->match(text, this->interval.end, end, flags) &&
-
4456 second->value < 60)
-
4457 {
-
4458 // Seconds
-
4459 this->interval.end = second->interval.end;
-
4460 if (second_separator && second_separator->match(text, this->interval.end, end, flags))
-
4461 this->interval.end = second_separator->interval.end;
-
4462 else
-
4463 if (second_separator) second_separator->invalidate();
-
4464 }
-
4465 else {
-
4466 if (second) second->invalidate();
-
4467 if (second_separator) second_separator->invalidate();
-
4468 }
-
4469
-
4470 if (degree->interval.start < degree->interval.end ||
-
4471 minute->interval.start < minute->interval.end ||
-
4472 (second && second->interval.start < second->interval.end))
-
4473 {
-
4474 if (decimal && decimal->match(text, this->interval.end, end, flags)) {
-
4475 // Decimals
-
4476 this->interval.end = decimal->interval.end;
-
4477 }
-
4478 else if (decimal)
-
4479 decimal->invalidate();
-
4480 this->interval.start = start;
-
4481 return true;
-
4482 }
-
4483 if (decimal) decimal->invalidate();
-
4484 this->interval.invalidate();
-
4485 return false;
-
4486 }
-
4487 };
+
4366
+
4367 using time = basic_time<char>;
+
4368 using wtime = basic_time<wchar_t>;
+
4369#ifdef _UNICODE
+
4370 using ttime = wtime;
+
4371#else
+
4372 using ttime = time;
+
4373#endif
+ +
4375
+
4379 template <class T>
+
+
4380 class basic_angle : public basic_parser<T>
+
4381 {
+
4382 public:
+ +
4384 _In_ const std::shared_ptr<basic_integer10<T>>& _degree,
+
4385 _In_ const std::shared_ptr<basic_parser<T>>& _degree_separator,
+
4386 _In_ const std::shared_ptr<basic_integer10<T>>& _minute,
+
4387 _In_ const std::shared_ptr<basic_parser<T>>& _minute_separator,
+
4388 _In_ const std::shared_ptr<basic_integer10<T>>& _second,
+
4389 _In_ const std::shared_ptr<basic_parser<T>>& _second_separator,
+
4390 _In_ const std::shared_ptr<basic_parser<T>>& _decimal,
+
4391 _In_ const std::locale& locale = std::locale()) :
+ +
4393 degree(_degree),
+
4394 degree_separator(_degree_separator),
+
4395 minute(_minute),
+
4396 minute_separator(_minute_separator),
+
4397 second(_second),
+
4398 second_separator(_second_separator),
+
4399 decimal(_decimal)
+
4400 {}
+
4401
+
4402 virtual void invalidate()
+
4403 {
+
4404 degree->invalidate();
+
4405 degree_separator->invalidate();
+
4406 minute->invalidate();
+
4407 minute_separator->invalidate();
+
4408 if (second) second->invalidate();
+
4409 if (second_separator) second_separator->invalidate();
+
4410 if (decimal) decimal->invalidate();
+ +
4412 }
+
4413
+
4414 std::shared_ptr<basic_integer10<T>> degree;
+
4415 std::shared_ptr<basic_parser<T>> degree_separator;
+
4416 std::shared_ptr<basic_integer10<T>> minute;
+
4417 std::shared_ptr<basic_parser<T>> minute_separator;
+
4418 std::shared_ptr<basic_integer10<T>> second;
+
4419 std::shared_ptr<basic_parser<T>> second_separator;
+
4420 std::shared_ptr<basic_parser<T>> decimal;
+
4421
+
4422 protected:
+
4423 virtual bool do_match(
+
4424 _In_reads_or_z_opt_(end) const T* text,
+
4425 _In_ size_t start = 0,
+
4426 _In_ size_t end = SIZE_MAX,
+
4427 _In_ int flags = match_default)
+
4428 {
+
4429 _Assume_(text || start >= end);
+
4430
+
4431 this->interval.end = start;
+
4432
+
4433 if (degree->match(text, this->interval.end, end, flags) &&
+
4434 degree_separator->match(text, degree->interval.end, end, flags))
+
4435 {
+
4436 // Degrees
+
4437 this->interval.end = degree_separator->interval.end;
+
4438 }
+
4439 else {
+
4440 degree->invalidate();
+
4441 degree_separator->invalidate();
+
4442 }
+
4443
+
4444 if (minute->match(text, this->interval.end, end, flags) &&
+
4445 minute->value < 60 &&
+
4446 minute_separator->match(text, minute->interval.end, end, flags))
+
4447 {
+
4448 // Minutes
+
4449 this->interval.end = minute_separator->interval.end;
+
4450 }
+
4451 else {
+
4452 minute->invalidate();
+
4453 minute_separator->invalidate();
+
4454 }
+
4455
+
4456 if (second && second->match(text, this->interval.end, end, flags) &&
+
4457 second->value < 60)
+
4458 {
+
4459 // Seconds
+
4460 this->interval.end = second->interval.end;
+
4461 if (second_separator && second_separator->match(text, this->interval.end, end, flags))
+
4462 this->interval.end = second_separator->interval.end;
+
4463 else
+
4464 if (second_separator) second_separator->invalidate();
+
4465 }
+
4466 else {
+
4467 if (second) second->invalidate();
+
4468 if (second_separator) second_separator->invalidate();
+
4469 }
+
4470
+
4471 if (degree->interval.start < degree->interval.end ||
+
4472 minute->interval.start < minute->interval.end ||
+
4473 (second && second->interval.start < second->interval.end))
+
4474 {
+
4475 if (decimal && decimal->match(text, this->interval.end, end, flags)) {
+
4476 // Decimals
+
4477 this->interval.end = decimal->interval.end;
+
4478 }
+
4479 else if (decimal)
+
4480 decimal->invalidate();
+
4481 this->interval.start = start;
+
4482 return true;
+
4483 }
+
4484 if (decimal) decimal->invalidate();
+
4485 this->interval.invalidate();
+
4486 return false;
+
4487 }
+
4488 };
-
4488
-
4489 using angle = basic_angle<char>;
- -
4491#ifdef _UNICODE
-
4492 using RRegElKot = wangle;
-
4493#else
-
4494 using RRegElKot = angle;
-
4495#endif
- -
4497
-
4501 template <class T>
-
- -
4503 {
-
4504 public:
- -
4506 _In_ const std::shared_ptr<basic_parser<T>>& digit,
-
4507 _In_ const std::shared_ptr<basic_parser<T>>& plus_sign,
-
4508 _In_ const std::shared_ptr<basic_set<T>>& lparenthesis,
-
4509 _In_ const std::shared_ptr<basic_set<T>>& rparenthesis,
-
4510 _In_ const std::shared_ptr<basic_parser<T>>& separator,
-
4511 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
4512 _In_ const std::locale& locale = std::locale()) :
- -
4514 m_digit(digit),
-
4515 m_plus_sign(plus_sign),
-
4516 m_lparenthesis(lparenthesis),
-
4517 m_rparenthesis(rparenthesis),
-
4518 m_separator(separator),
-
4519 m_space(space)
-
4520 {}
-
4521
-
4522 virtual void invalidate()
-
4523 {
-
4524 value.clear();
- -
4526 }
-
4527
-
4528 std::basic_string<T> value;
-
4529
-
4530 protected:
-
4531 virtual bool do_match(
-
4532 _In_reads_or_z_opt_(end) const T* text,
-
4533 _In_ size_t start = 0,
-
4534 _In_ size_t end = SIZE_MAX,
-
4535 _In_ int flags = match_default)
-
4536 {
-
4537 _Assume_(text || start >= end);
-
4538
-
4539 size_t safe_digit_end = start, safe_value_size = 0;
-
4540 bool has_digits = false, after_digit = false, in_parentheses = false, after_parentheses = false;
-
4541 const int space_match_flags = flags & ~match_multiline; // Spaces in phone numbers must never be broken in new line.
-
4542
-
4543 this->interval.end = start;
-
4544 value.clear();
-
4545 m_lparenthesis->invalidate();
-
4546 m_rparenthesis->invalidate();
-
4547
-
4548 if (m_plus_sign && m_plus_sign->match(text, this->interval.end, end, flags)) {
-
4549 value.append(text + m_plus_sign->interval.start, text + m_plus_sign->interval.end);
-
4550 safe_value_size = value.size();
-
4551 this->interval.end = m_plus_sign->interval.end;
-
4552 }
-
4553
-
4554 for (;;) {
-
4555 _Assume_(text || this->interval.end >= end);
-
4556 if (this->interval.end >= end || !text[this->interval.end])
-
4557 break;
-
4558 if (m_digit->match(text, this->interval.end, end, flags)) {
-
4559 // Digit
-
4560 value.append(text + m_digit->interval.start, text + m_digit->interval.end);
-
4561 this->interval.end = m_digit->interval.end;
-
4562 if (!in_parentheses) {
-
4563 safe_digit_end = this->interval.end;
-
4564 safe_value_size = value.size();
-
4565 has_digits = true;
-
4566 }
-
4567 after_digit = true;
-
4568 after_parentheses = false;
-
4569 }
-
4570 else if (
-
4571 m_lparenthesis && !m_lparenthesis->interval && // No left parenthesis yet
-
4572 m_rparenthesis && !m_rparenthesis->interval && // Right parenthesis after left
-
4573 m_lparenthesis->match(text, this->interval.end, end, flags))
-
4574 {
-
4575 // Left parenthesis
-
4576 value.append(text + m_lparenthesis->interval.start, m_lparenthesis->interval.size());
-
4577 this->interval.end = m_lparenthesis->interval.end;
-
4578 in_parentheses = true;
-
4579 after_digit = false;
-
4580 after_parentheses = false;
-
4581 }
-
4582 else if (
-
4583 in_parentheses && // After left parenthesis
-
4584 m_rparenthesis && !m_rparenthesis->interval && // No right parenthesis yet
-
4585 m_rparenthesis->match(text, this->interval.end, end, flags) &&
-
4586 m_lparenthesis->hit_offset == m_rparenthesis->hit_offset) // Left and right parentheses must match
-
4587 {
-
4588 // Right parenthesis
-
4589 value.append(text + m_rparenthesis->interval.start, text + m_rparenthesis->interval.end);
-
4590 this->interval.end = m_rparenthesis->interval.end;
-
4591 safe_digit_end = this->interval.end;
-
4592 safe_value_size = value.size();
-
4593 in_parentheses = false;
-
4594 after_digit = false;
-
4595 after_parentheses = true;
-
4596 }
-
4597 else if (
-
4598 after_digit &&
-
4599 !in_parentheses && // No separators inside parentheses
-
4600 !after_parentheses && // No separators following right parenthesis
-
4601 m_separator && m_separator->match(text, this->interval.end, end, flags))
-
4602 {
-
4603 // Separator
-
4604 this->interval.end = m_separator->interval.end;
-
4605 after_digit = false;
-
4606 after_parentheses = false;
-
4607 }
-
4608 else if (
- -
4610 m_space && m_space->match(text, this->interval.end, end, space_match_flags))
-
4611 {
-
4612 // Space
-
4613 this->interval.end = m_space->interval.end;
-
4614 after_digit = false;
-
4615 after_parentheses = false;
-
4616 }
-
4617 else
-
4618 break;
-
4619 }
-
4620 if (has_digits) {
-
4621 value.erase(safe_value_size);
-
4622 this->interval.start = start;
-
4623 this->interval.end = safe_digit_end;
-
4624 return true;
-
4625 }
-
4626 value.clear();
-
4627 this->interval.invalidate();
-
4628 return false;
-
4629 }
-
4630
-
4631 std::shared_ptr<basic_parser<T>> m_digit;
-
4632 std::shared_ptr<basic_parser<T>> m_plus_sign;
-
4633 std::shared_ptr<basic_set<T>> m_lparenthesis;
-
4634 std::shared_ptr<basic_set<T>> m_rparenthesis;
-
4635 std::shared_ptr<basic_parser<T>> m_separator;
-
4636 std::shared_ptr<basic_parser<T>> m_space;
-
4637 };
+
4489
+
4490 using angle = basic_angle<char>;
+ +
4492#ifdef _UNICODE
+
4493 using RRegElKot = wangle;
+
4494#else
+
4495 using RRegElKot = angle;
+
4496#endif
+ +
4498
+
4502 template <class T>
+
+ +
4504 {
+
4505 public:
+ +
4507 _In_ const std::shared_ptr<basic_parser<T>>& digit,
+
4508 _In_ const std::shared_ptr<basic_parser<T>>& plus_sign,
+
4509 _In_ const std::shared_ptr<basic_set<T>>& lparenthesis,
+
4510 _In_ const std::shared_ptr<basic_set<T>>& rparenthesis,
+
4511 _In_ const std::shared_ptr<basic_parser<T>>& separator,
+
4512 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
4513 _In_ const std::locale& locale = std::locale()) :
+ +
4515 m_digit(digit),
+
4516 m_plus_sign(plus_sign),
+
4517 m_lparenthesis(lparenthesis),
+
4518 m_rparenthesis(rparenthesis),
+
4519 m_separator(separator),
+
4520 m_space(space)
+
4521 {}
+
4522
+
4523 virtual void invalidate()
+
4524 {
+
4525 value.clear();
+ +
4527 }
+
4528
+
4529 std::basic_string<T> value;
+
4530
+
4531 protected:
+
4532 virtual bool do_match(
+
4533 _In_reads_or_z_opt_(end) const T* text,
+
4534 _In_ size_t start = 0,
+
4535 _In_ size_t end = SIZE_MAX,
+
4536 _In_ int flags = match_default)
+
4537 {
+
4538 _Assume_(text || start >= end);
+
4539
+
4540 size_t safe_digit_end = start, safe_value_size = 0;
+
4541 bool has_digits = false, after_digit = false, in_parentheses = false, after_parentheses = false;
+
4542 const int space_match_flags = flags & ~match_multiline; // Spaces in phone numbers must never be broken in new line.
+
4543
+
4544 this->interval.end = start;
+
4545 value.clear();
+
4546 m_lparenthesis->invalidate();
+
4547 m_rparenthesis->invalidate();
+
4548
+
4549 if (m_plus_sign && m_plus_sign->match(text, this->interval.end, end, flags)) {
+
4550 value.append(text + m_plus_sign->interval.start, text + m_plus_sign->interval.end);
+
4551 safe_value_size = value.size();
+
4552 this->interval.end = m_plus_sign->interval.end;
+
4553 }
+
4554
+
4555 for (;;) {
+
4556 _Assume_(text || this->interval.end >= end);
+
4557 if (this->interval.end >= end || !text[this->interval.end])
+
4558 break;
+
4559 if (m_digit->match(text, this->interval.end, end, flags)) {
+
4560 // Digit
+
4561 value.append(text + m_digit->interval.start, text + m_digit->interval.end);
+
4562 this->interval.end = m_digit->interval.end;
+
4563 if (!in_parentheses) {
+
4564 safe_digit_end = this->interval.end;
+
4565 safe_value_size = value.size();
+
4566 has_digits = true;
+
4567 }
+
4568 after_digit = true;
+
4569 after_parentheses = false;
+
4570 }
+
4571 else if (
+
4572 m_lparenthesis && !m_lparenthesis->interval && // No left parenthesis yet
+
4573 m_rparenthesis && !m_rparenthesis->interval && // Right parenthesis after left
+
4574 m_lparenthesis->match(text, this->interval.end, end, flags))
+
4575 {
+
4576 // Left parenthesis
+
4577 value.append(text + m_lparenthesis->interval.start, m_lparenthesis->interval.size());
+
4578 this->interval.end = m_lparenthesis->interval.end;
+
4579 in_parentheses = true;
+
4580 after_digit = false;
+
4581 after_parentheses = false;
+
4582 }
+
4583 else if (
+
4584 in_parentheses && // After left parenthesis
+
4585 m_rparenthesis && !m_rparenthesis->interval && // No right parenthesis yet
+
4586 m_rparenthesis->match(text, this->interval.end, end, flags) &&
+
4587 m_lparenthesis->hit_offset == m_rparenthesis->hit_offset) // Left and right parentheses must match
+
4588 {
+
4589 // Right parenthesis
+
4590 value.append(text + m_rparenthesis->interval.start, text + m_rparenthesis->interval.end);
+
4591 this->interval.end = m_rparenthesis->interval.end;
+
4592 safe_digit_end = this->interval.end;
+
4593 safe_value_size = value.size();
+
4594 in_parentheses = false;
+
4595 after_digit = false;
+
4596 after_parentheses = true;
+
4597 }
+
4598 else if (
+
4599 after_digit &&
+
4600 !in_parentheses && // No separators inside parentheses
+
4601 !after_parentheses && // No separators following right parenthesis
+
4602 m_separator && m_separator->match(text, this->interval.end, end, flags))
+
4603 {
+
4604 // Separator
+
4605 this->interval.end = m_separator->interval.end;
+
4606 after_digit = false;
+
4607 after_parentheses = false;
+
4608 }
+
4609 else if (
+ +
4611 m_space && m_space->match(text, this->interval.end, end, space_match_flags))
+
4612 {
+
4613 // Space
+
4614 this->interval.end = m_space->interval.end;
+
4615 after_digit = false;
+
4616 after_parentheses = false;
+
4617 }
+
4618 else
+
4619 break;
+
4620 }
+
4621 if (has_digits) {
+
4622 value.erase(safe_value_size);
+
4623 this->interval.start = start;
+
4624 this->interval.end = safe_digit_end;
+
4625 return true;
+
4626 }
+
4627 value.clear();
+
4628 this->interval.invalidate();
+
4629 return false;
+
4630 }
+
4631
+
4632 std::shared_ptr<basic_parser<T>> m_digit;
+
4633 std::shared_ptr<basic_parser<T>> m_plus_sign;
+
4634 std::shared_ptr<basic_set<T>> m_lparenthesis;
+
4635 std::shared_ptr<basic_set<T>> m_rparenthesis;
+
4636 std::shared_ptr<basic_parser<T>> m_separator;
+
4637 std::shared_ptr<basic_parser<T>> m_space;
+
4638 };
-
4638
-
4639 using phone_number = basic_phone_number<char>;
-
4640 using wphone_number = basic_phone_number<wchar_t>;
-
4641#ifdef _UNICODE
-
4642 using tphone_number = wphone_number;
-
4643#else
-
4644 using tphone_number = phone_number;
-
4645#endif
-
4646 using sgml_phone_number = basic_phone_number<char>;
-
4647
-
4653 template <class T>
-
-
4654 class basic_iban : public basic_parser<T>
-
4655 {
-
4656 public:
-
4657 basic_iban(
-
4658 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
4659 _In_ const std::locale& locale = std::locale()) :
- -
4661 m_space(space)
-
4662 {
-
4663 this->country[0] = 0;
-
4664 this->check_digits[0] = 0;
-
4665 this->bban[0] = 0;
-
4666 this->is_valid = false;
-
4667 }
-
4668
-
4669 virtual void invalidate()
-
4670 {
-
4671 this->country[0] = 0;
-
4672 this->check_digits[0] = 0;
-
4673 this->bban[0] = 0;
-
4674 this->is_valid = false;
- -
4676 }
-
4677
-
4678 T country[3];
- -
4680 T bban[31];
- -
4682
-
4683 protected:
-
4684 virtual bool do_match(
-
4685 _In_reads_or_z_opt_(end) const T* text,
-
4686 _In_ size_t start = 0,
-
4687 _In_ size_t end = SIZE_MAX,
-
4688 _In_ int flags = match_default)
-
4689 {
-
4690 _Assume_(text || start >= end);
-
4691 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
4692 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
4693 struct country_t {
-
4694 T country[2];
-
4695 T check_digits[2];
-
4696 size_t length;
-
4697 };
-
4698 static const country_t s_countries[] = {
-
4699 { { 'A', 'D' }, {}, 24 }, // Andorra
-
4700 { { 'A', 'E' }, {}, 23 }, // United Arab Emirates
-
4701 { { 'A', 'L' }, {}, 28 }, // Albania
-
4702 { { 'A', 'O' }, {}, 25 }, // Angola
-
4703 { { 'A', 'T' }, {}, 20 }, // Austria
-
4704 { { 'A', 'Z' }, {}, 28 }, // Azerbaijan
-
4705 { { 'B', 'A' }, { '3', '9' }, 20}, // Bosnia and Herzegovina
-
4706 { { 'B', 'E' }, {}, 16 }, // Belgium
-
4707 { { 'B', 'F' }, {}, 28 }, // Burkina Faso
-
4708 { { 'B', 'G' }, {}, 22 }, // Bulgaria
-
4709 { { 'B', 'H' }, {}, 22 }, // Bahrain
-
4710 { { 'B', 'I' }, {}, 27 }, // Burundi
-
4711 { { 'B', 'J' }, {}, 28 }, // Benin
-
4712 { { 'B', 'R' }, {}, 29 }, // Brazil
-
4713 { { 'B', 'Y' }, {}, 28 }, // Belarus
-
4714 { { 'C', 'F' }, {}, 27 }, // Central African Republic
-
4715 { { 'C', 'G' }, {}, 27 }, // Congo, Republic of the
-
4716 { { 'C', 'H' }, {}, 21 }, // Switzerland
-
4717 { { 'C', 'I' }, {}, 28 }, // Côte d'Ivoire
-
4718 { { 'C', 'M' }, {}, 27 }, // Cameroon
-
4719 { { 'C', 'R' }, {}, 22 }, // Costa Rica
-
4720 { { 'C', 'V' }, {}, 25 }, // Cabo Verde
-
4721 { { 'C', 'Y' }, {}, 28 }, // Cyprus
-
4722 { { 'C', 'Z' }, {}, 24 }, // Czech Republic
-
4723 { { 'D', 'E' }, {}, 22 }, // Germany
-
4724 { { 'D', 'J' }, {}, 27 }, // Djibouti
-
4725 { { 'D', 'K' }, {}, 18 }, // Denmark
-
4726 { { 'D', 'O' }, {}, 28 }, // Dominican Republic
-
4727 { { 'D', 'Z' }, {}, 26 }, // Algeria
-
4728 { { 'E', 'E' }, {}, 20 }, // Estonia
-
4729 { { 'E', 'G' }, {}, 29 }, // Egypt
-
4730 { { 'E', 'S' }, {}, 24 }, // Spain
-
4731 { { 'F', 'I' }, {}, 18 }, // Finland
-
4732 { { 'F', 'O' }, {}, 18 }, // Faroe Islands
-
4733 { { 'F', 'R' }, {}, 27 }, // France
-
4734 { { 'G', 'A' }, {}, 27 }, // Gabon
-
4735 { { 'G', 'B' }, {}, 22 }, // United Kingdom
-
4736 { { 'G', 'E' }, {}, 22 }, // Georgia
-
4737 { { 'G', 'I' }, {}, 23 }, // Gibraltar
-
4738 { { 'G', 'L' }, {}, 18 }, // Greenland
-
4739 { { 'G', 'Q' }, {}, 27 }, // Equatorial Guinea
-
4740 { { 'G', 'R' }, {}, 27 }, // Greece
-
4741 { { 'G', 'T' }, {}, 28 }, // Guatemala
-
4742 { { 'G', 'W' }, {}, 25 }, // Guinea-Bissau
-
4743 { { 'H', 'N' }, {}, 28 }, // Honduras
-
4744 { { 'H', 'R' }, {}, 21 }, // Croatia
-
4745 { { 'H', 'U' }, {}, 28 }, // Hungary
-
4746 { { 'I', 'E' }, {}, 22 }, // Ireland
-
4747 { { 'I', 'L' }, {}, 23 }, // Israel
-
4748 { { 'I', 'Q' }, {}, 23 }, // Iraq
-
4749 { { 'I', 'R' }, {}, 26 }, // Iran
-
4750 { { 'I', 'S' }, {}, 26 }, // Iceland
-
4751 { { 'I', 'T' }, {}, 27 }, // Italy
-
4752 { { 'J', 'O' }, {}, 30 }, // Jordan
-
4753 { { 'K', 'M' }, {}, 27 }, // Comoros
-
4754 { { 'K', 'W' }, {}, 30 }, // Kuwait
-
4755 { { 'K', 'Z' }, {}, 20 }, // Kazakhstan
-
4756 { { 'L', 'B' }, {}, 28 }, // Lebanon
-
4757 { { 'L', 'C' }, {}, 32 }, // Saint Lucia
-
4758 { { 'L', 'I' }, {}, 21 }, // Liechtenstein
-
4759 { { 'L', 'T' }, {}, 20 }, // Lithuania
-
4760 { { 'L', 'U' }, {}, 20 }, // Luxembourg
-
4761 { { 'L', 'V' }, {}, 21 }, // Latvia
-
4762 { { 'L', 'Y' }, {}, 25 }, // Libya
-
4763 { { 'M', 'A' }, {}, 28 }, // Morocco
-
4764 { { 'M', 'C' }, {}, 27 }, // Monaco
-
4765 { { 'M', 'D' }, {}, 24 }, // Moldova
-
4766 { { 'M', 'E' }, { '2', '5' }, 22 }, // Montenegro
-
4767 { { 'M', 'G' }, {}, 27 }, // Madagascar
-
4768 { { 'M', 'K' }, { '0', '7' }, 19 }, // North Macedonia
-
4769 { { 'M', 'L' }, {}, 28 }, // Mali
-
4770 { { 'M', 'R' }, { '1', '3' }, 27}, // Mauritania
-
4771 { { 'M', 'T' }, {}, 31 }, // Malta
-
4772 { { 'M', 'U' }, {}, 30 }, // Mauritius
-
4773 { { 'M', 'Z' }, {}, 25 }, // Mozambique
-
4774 { { 'N', 'E' }, {}, 28 }, // Niger
-
4775 { { 'N', 'I' }, {}, 32 }, // Nicaragua
-
4776 { { 'N', 'L' }, {}, 18 }, // Netherlands
-
4777 { { 'N', 'O' }, {}, 15 }, // Norway
-
4778 { { 'P', 'K' }, {}, 24 }, // Pakistan
-
4779 { { 'P', 'L' }, {}, 28 }, // Poland
-
4780 { { 'P', 'S' }, {}, 29 }, // Palestinian territories
-
4781 { { 'P', 'T' }, { '5', '0' }, 25 }, // Portugal
-
4782 { { 'Q', 'A' }, {}, 29 }, // Qatar
-
4783 { { 'R', 'O' }, {}, 24 }, // Romania
-
4784 { { 'R', 'S' }, { '3', '5' }, 22 }, // Serbia
-
4785 { { 'R', 'U' }, {}, 33 }, // Russia
-
4786 { { 'S', 'A' }, {}, 24 }, // Saudi Arabia
-
4787 { { 'S', 'C' }, {}, 31 }, // Seychelles
-
4788 { { 'S', 'D' }, {}, 18 }, // Sudan
-
4789 { { 'S', 'E' }, {}, 24 }, // Sweden
-
4790 { { 'S', 'I' }, { '5', '6' }, 19 }, // Slovenia
-
4791 { { 'S', 'K' }, {}, 24 }, // Slovakia
-
4792 { { 'S', 'M' }, {}, 27 }, // San Marino
-
4793 { { 'S', 'N' }, {}, 28 }, // Senegal
-
4794 { { 'S', 'T' }, {}, 25 }, // São Tomé and Príncipe
-
4795 { { 'S', 'V' }, {}, 28 }, // El Salvador
-
4796 { { 'T', 'D' }, {}, 27 }, // Chad
-
4797 { { 'T', 'G' }, {}, 28 }, // Togo
-
4798 { { 'T', 'L' }, { '3', '8' }, 23}, // East Timor
-
4799 { { 'T', 'N' }, { '5', '9' }, 24 }, // Tunisia
-
4800 { { 'T', 'R' }, {}, 26 }, // Turkey
-
4801 { { 'U', 'A' }, {}, 29 }, // Ukraine
-
4802 { { 'V', 'A' }, {}, 22 }, // Vatican City
-
4803 { { 'V', 'G' }, {}, 24 }, // Virgin Islands, British
-
4804 { { 'X', 'K' }, {}, 20 }, // Kosovo
-
4805 };
-
4806 const country_t* country_desc = nullptr;
-
4807 size_t n, available, next, bban_length;
- -
4809
-
4810 this->interval.end = start;
-
4811 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
4812 if (this->interval.end >= end || !text[this->interval.end])
-
4813 goto error; // incomplete country code
-
4814 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
-
4815 if (chr < 'A' || 'Z' < chr)
-
4816 goto error; // invalid country code
-
4817 this->country[i] = chr;
-
4818 }
-
4819 for (size_t l = 0, r = _countof(s_countries);;) {
-
4820 if (l >= r)
-
4821 goto error; // unknown country
-
4822 size_t m = (l + r) / 2;
-
4823 const country_t& c = s_countries[m];
-
4824 if (c.country[0] < this->country[0] || (c.country[0] == this->country[0] && c.country[1] < this->country[1]))
-
4825 l = m + 1;
-
4826 else if (this->country[0] < c.country[0] || (this->country[0] == c.country[0] && this->country[1] < c.country[1]))
-
4827 r = m;
-
4828 else {
-
4829 country_desc = &c;
-
4830 break;
-
4831 }
-
4832 }
-
4833 this->country[2] = 0;
-
4834
-
4835 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
4836 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
-
4837 goto error; // incomplete or invalid check digits
-
4838 this->check_digits[i] = text[this->interval.end];
-
4839 }
-
4840 this->check_digits[2] = 0;
-
4841
-
4842 if ((country_desc->check_digits[0] && this->check_digits[0] != country_desc->check_digits[0]) ||
-
4843 (country_desc->check_digits[1] && this->check_digits[1] != country_desc->check_digits[1]))
-
4844 goto error; // unexpected check digits
-
4845
-
4846 bban_length = country_desc->length - 4;
-
4847 for (n = 0; n < bban_length;) {
-
4848 if (this->interval.end >= end || !text[this->interval.end])
-
4849 goto error; // bban too short
-
4850 if (m_space && m_space->match(text, this->interval.end, end, flags)) {
-
4851 this->interval.end = m_space->interval.end;
-
4852 continue;
-
4853 }
-
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 this->bban[n++] = chr;
-
4857 this->interval.end++;
-
4858 }
-
4859 else
-
4860 goto error; // invalid bban
-
4861 }
-
4862 this->bban[n] = 0;
-
4863
-
4864 // Normalize IBAN.
-
4865 T normalized[69];
-
4866 available = 0;
-
4867 for (size_t i = 0; ; ++i) {
-
4868 if (!this->bban[i]) {
-
4869 for (i = 0; i < 2; ++i) {
-
4870 if ('A' <= this->country[i] && this->country[i] <= 'J') {
-
4871 normalized[available++] = '1';
-
4872 normalized[available++] = '0' + this->country[i] - 'A';
-
4873 }
-
4874 else if ('K' <= this->country[i] && this->country[i] <= 'T') {
-
4875 normalized[available++] = '2';
-
4876 normalized[available++] = '0' + this->country[i] - 'K';
-
4877 }
-
4878 else if ('U' <= this->country[i] && this->country[i] <= 'Z') {
-
4879 normalized[available++] = '3';
-
4880 normalized[available++] = '0' + this->country[i] - 'U';
-
4881 }
-
4882 }
-
4883 normalized[available++] = this->check_digits[0];
-
4884 normalized[available++] = this->check_digits[1];
-
4885 normalized[available] = 0;
-
4886 break;
-
4887 }
-
4888 if ('0' <= this->bban[i] && this->bban[i] <= '9')
-
4889 normalized[available++] = this->bban[i];
-
4890 else if ('A' <= this->bban[i] && this->bban[i] <= 'J') {
-
4891 normalized[available++] = '1';
-
4892 normalized[available++] = '0' + this->bban[i] - 'A';
-
4893 }
-
4894 else if ('K' <= this->bban[i] && this->bban[i] <= 'T') {
-
4895 normalized[available++] = '2';
-
4896 normalized[available++] = '0' + this->bban[i] - 'K';
-
4897 }
-
4898 else if ('U' <= this->bban[i] && this->bban[i] <= 'Z') {
-
4899 normalized[available++] = '3';
-
4900 normalized[available++] = '0' + this->bban[i] - 'U';
-
4901 }
-
4902 }
-
4903
-
4904 // Calculate modulo 97.
-
4905 nominator = stdex::strtou32(normalized, 9, &next, 10);
-
4906 for (;;) {
-
4907 nominator %= 97;
-
4908 if (!normalized[next]) {
-
4909 this->is_valid = nominator == 1;
-
4910 break;
-
4911 }
-
4912 size_t digit_count = nominator == 0 ? 0 : nominator < 10 ? 1 : 2;
-
4913 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
-
4914 nominator = nominator * 10 + static_cast<uint32_t>(normalized[next] - '0');
-
4915 }
-
4916
-
4917 this->interval.start = start;
-
4918 return true;
-
4919
-
4920 error:
-
4921 invalidate();
-
4922 return false;
-
4923 }
-
4924
-
4925 std::shared_ptr<basic_parser<T>> m_space;
-
4926 };
+
4639
+
4640 using phone_number = basic_phone_number<char>;
+
4641 using wphone_number = basic_phone_number<wchar_t>;
+
4642#ifdef _UNICODE
+
4643 using tphone_number = wphone_number;
+
4644#else
+
4645 using tphone_number = phone_number;
+
4646#endif
+
4647 using sgml_phone_number = basic_phone_number<char>;
+
4648
+
4654 template <class T>
+
+
4655 class basic_iban : public basic_parser<T>
+
4656 {
+
4657 public:
+
4658 basic_iban(
+
4659 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
4660 _In_ const std::locale& locale = std::locale()) :
+ +
4662 m_space(space)
+
4663 {
+
4664 this->country[0] = 0;
+
4665 this->check_digits[0] = 0;
+
4666 this->bban[0] = 0;
+
4667 this->is_valid = false;
+
4668 }
+
4669
+
4670 virtual void invalidate()
+
4671 {
+
4672 this->country[0] = 0;
+
4673 this->check_digits[0] = 0;
+
4674 this->bban[0] = 0;
+
4675 this->is_valid = false;
+ +
4677 }
+
4678
+
4679 T country[3];
+ +
4681 T bban[31];
+ +
4683
+
4684 protected:
+
4685 virtual bool do_match(
+
4686 _In_reads_or_z_opt_(end) const T* text,
+
4687 _In_ size_t start = 0,
+
4688 _In_ size_t end = SIZE_MAX,
+
4689 _In_ int flags = match_default)
+
4690 {
+
4691 _Assume_(text || start >= end);
+
4692 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
4693 const bool case_insensitive = flags & match_case_insensitive ? true : false;
+
4694 struct country_t {
+
4695 T country[2];
+
4696 T check_digits[2];
+
4697 size_t length;
+
4698 };
+
4699 static const country_t s_countries[] = {
+
4700 { { 'A', 'D' }, {}, 24 }, // Andorra
+
4701 { { 'A', 'E' }, {}, 23 }, // United Arab Emirates
+
4702 { { 'A', 'L' }, {}, 28 }, // Albania
+
4703 { { 'A', 'O' }, {}, 25 }, // Angola
+
4704 { { 'A', 'T' }, {}, 20 }, // Austria
+
4705 { { 'A', 'Z' }, {}, 28 }, // Azerbaijan
+
4706 { { 'B', 'A' }, { '3', '9' }, 20}, // Bosnia and Herzegovina
+
4707 { { 'B', 'E' }, {}, 16 }, // Belgium
+
4708 { { 'B', 'F' }, {}, 28 }, // Burkina Faso
+
4709 { { 'B', 'G' }, {}, 22 }, // Bulgaria
+
4710 { { 'B', 'H' }, {}, 22 }, // Bahrain
+
4711 { { 'B', 'I' }, {}, 27 }, // Burundi
+
4712 { { 'B', 'J' }, {}, 28 }, // Benin
+
4713 { { 'B', 'R' }, {}, 29 }, // Brazil
+
4714 { { 'B', 'Y' }, {}, 28 }, // Belarus
+
4715 { { 'C', 'F' }, {}, 27 }, // Central African Republic
+
4716 { { 'C', 'G' }, {}, 27 }, // Congo, Republic of the
+
4717 { { 'C', 'H' }, {}, 21 }, // Switzerland
+
4718 { { 'C', 'I' }, {}, 28 }, // Côte d'Ivoire
+
4719 { { 'C', 'M' }, {}, 27 }, // Cameroon
+
4720 { { 'C', 'R' }, {}, 22 }, // Costa Rica
+
4721 { { 'C', 'V' }, {}, 25 }, // Cabo Verde
+
4722 { { 'C', 'Y' }, {}, 28 }, // Cyprus
+
4723 { { 'C', 'Z' }, {}, 24 }, // Czech Republic
+
4724 { { 'D', 'E' }, {}, 22 }, // Germany
+
4725 { { 'D', 'J' }, {}, 27 }, // Djibouti
+
4726 { { 'D', 'K' }, {}, 18 }, // Denmark
+
4727 { { 'D', 'O' }, {}, 28 }, // Dominican Republic
+
4728 { { 'D', 'Z' }, {}, 26 }, // Algeria
+
4729 { { 'E', 'E' }, {}, 20 }, // Estonia
+
4730 { { 'E', 'G' }, {}, 29 }, // Egypt
+
4731 { { 'E', 'S' }, {}, 24 }, // Spain
+
4732 { { 'F', 'I' }, {}, 18 }, // Finland
+
4733 { { 'F', 'O' }, {}, 18 }, // Faroe Islands
+
4734 { { 'F', 'R' }, {}, 27 }, // France
+
4735 { { 'G', 'A' }, {}, 27 }, // Gabon
+
4736 { { 'G', 'B' }, {}, 22 }, // United Kingdom
+
4737 { { 'G', 'E' }, {}, 22 }, // Georgia
+
4738 { { 'G', 'I' }, {}, 23 }, // Gibraltar
+
4739 { { 'G', 'L' }, {}, 18 }, // Greenland
+
4740 { { 'G', 'Q' }, {}, 27 }, // Equatorial Guinea
+
4741 { { 'G', 'R' }, {}, 27 }, // Greece
+
4742 { { 'G', 'T' }, {}, 28 }, // Guatemala
+
4743 { { 'G', 'W' }, {}, 25 }, // Guinea-Bissau
+
4744 { { 'H', 'N' }, {}, 28 }, // Honduras
+
4745 { { 'H', 'R' }, {}, 21 }, // Croatia
+
4746 { { 'H', 'U' }, {}, 28 }, // Hungary
+
4747 { { 'I', 'E' }, {}, 22 }, // Ireland
+
4748 { { 'I', 'L' }, {}, 23 }, // Israel
+
4749 { { 'I', 'Q' }, {}, 23 }, // Iraq
+
4750 { { 'I', 'R' }, {}, 26 }, // Iran
+
4751 { { 'I', 'S' }, {}, 26 }, // Iceland
+
4752 { { 'I', 'T' }, {}, 27 }, // Italy
+
4753 { { 'J', 'O' }, {}, 30 }, // Jordan
+
4754 { { 'K', 'M' }, {}, 27 }, // Comoros
+
4755 { { 'K', 'W' }, {}, 30 }, // Kuwait
+
4756 { { 'K', 'Z' }, {}, 20 }, // Kazakhstan
+
4757 { { 'L', 'B' }, {}, 28 }, // Lebanon
+
4758 { { 'L', 'C' }, {}, 32 }, // Saint Lucia
+
4759 { { 'L', 'I' }, {}, 21 }, // Liechtenstein
+
4760 { { 'L', 'T' }, {}, 20 }, // Lithuania
+
4761 { { 'L', 'U' }, {}, 20 }, // Luxembourg
+
4762 { { 'L', 'V' }, {}, 21 }, // Latvia
+
4763 { { 'L', 'Y' }, {}, 25 }, // Libya
+
4764 { { 'M', 'A' }, {}, 28 }, // Morocco
+
4765 { { 'M', 'C' }, {}, 27 }, // Monaco
+
4766 { { 'M', 'D' }, {}, 24 }, // Moldova
+
4767 { { 'M', 'E' }, { '2', '5' }, 22 }, // Montenegro
+
4768 { { 'M', 'G' }, {}, 27 }, // Madagascar
+
4769 { { 'M', 'K' }, { '0', '7' }, 19 }, // North Macedonia
+
4770 { { 'M', 'L' }, {}, 28 }, // Mali
+
4771 { { 'M', 'R' }, { '1', '3' }, 27}, // Mauritania
+
4772 { { 'M', 'T' }, {}, 31 }, // Malta
+
4773 { { 'M', 'U' }, {}, 30 }, // Mauritius
+
4774 { { 'M', 'Z' }, {}, 25 }, // Mozambique
+
4775 { { 'N', 'E' }, {}, 28 }, // Niger
+
4776 { { 'N', 'I' }, {}, 32 }, // Nicaragua
+
4777 { { 'N', 'L' }, {}, 18 }, // Netherlands
+
4778 { { 'N', 'O' }, {}, 15 }, // Norway
+
4779 { { 'P', 'K' }, {}, 24 }, // Pakistan
+
4780 { { 'P', 'L' }, {}, 28 }, // Poland
+
4781 { { 'P', 'S' }, {}, 29 }, // Palestinian territories
+
4782 { { 'P', 'T' }, { '5', '0' }, 25 }, // Portugal
+
4783 { { 'Q', 'A' }, {}, 29 }, // Qatar
+
4784 { { 'R', 'O' }, {}, 24 }, // Romania
+
4785 { { 'R', 'S' }, { '3', '5' }, 22 }, // Serbia
+
4786 { { 'R', 'U' }, {}, 33 }, // Russia
+
4787 { { 'S', 'A' }, {}, 24 }, // Saudi Arabia
+
4788 { { 'S', 'C' }, {}, 31 }, // Seychelles
+
4789 { { 'S', 'D' }, {}, 18 }, // Sudan
+
4790 { { 'S', 'E' }, {}, 24 }, // Sweden
+
4791 { { 'S', 'I' }, { '5', '6' }, 19 }, // Slovenia
+
4792 { { 'S', 'K' }, {}, 24 }, // Slovakia
+
4793 { { 'S', 'M' }, {}, 27 }, // San Marino
+
4794 { { 'S', 'N' }, {}, 28 }, // Senegal
+
4795 { { 'S', 'T' }, {}, 25 }, // São Tomé and Príncipe
+
4796 { { 'S', 'V' }, {}, 28 }, // El Salvador
+
4797 { { 'T', 'D' }, {}, 27 }, // Chad
+
4798 { { 'T', 'G' }, {}, 28 }, // Togo
+
4799 { { 'T', 'L' }, { '3', '8' }, 23}, // East Timor
+
4800 { { 'T', 'N' }, { '5', '9' }, 24 }, // Tunisia
+
4801 { { 'T', 'R' }, {}, 26 }, // Turkey
+
4802 { { 'U', 'A' }, {}, 29 }, // Ukraine
+
4803 { { 'V', 'A' }, {}, 22 }, // Vatican City
+
4804 { { 'V', 'G' }, {}, 24 }, // Virgin Islands, British
+
4805 { { 'X', 'K' }, {}, 20 }, // Kosovo
+
4806 };
+
4807 const country_t* country_desc = nullptr;
+
4808 size_t n, available, next, bban_length;
+ +
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])
+
4838 goto error; // incomplete or invalid check digits
+
4839 this->check_digits[i] = text[this->interval.end];
+
4840 }
+
4841 this->check_digits[2] = 0;
+
4842
+
4843 if ((country_desc->check_digits[0] && this->check_digits[0] != country_desc->check_digits[0]) ||
+
4844 (country_desc->check_digits[1] && this->check_digits[1] != country_desc->check_digits[1]))
+
4845 goto error; // unexpected check digits
+
4846
+
4847 bban_length = country_desc->length - 4;
+
4848 for (n = 0; n < bban_length;) {
+
4849 if (this->interval.end >= end || !text[this->interval.end])
+
4850 goto error; // bban too short
+
4851 if (m_space && m_space->match(text, this->interval.end, end, flags)) {
+
4852 this->interval.end = m_space->interval.end;
+
4853 continue;
+
4854 }
+
4855 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
+
4856 if (('0' <= chr && chr <= '9') || ('A' <= chr && chr <= 'Z')) {
+
4857 this->bban[n++] = chr;
+
4858 this->interval.end++;
+
4859 }
+
4860 else
+
4861 goto error; // invalid bban
+
4862 }
+
4863 this->bban[n] = 0;
+
4864
+
4865 // Normalize IBAN.
+
4866 T normalized[69];
+
4867 available = 0;
+
4868 for (size_t i = 0; ; ++i) {
+
4869 if (!this->bban[i]) {
+
4870 for (i = 0; i < 2; ++i) {
+
4871 if ('A' <= this->country[i] && this->country[i] <= 'J') {
+
4872 normalized[available++] = '1';
+
4873 normalized[available++] = '0' + this->country[i] - 'A';
+
4874 }
+
4875 else if ('K' <= this->country[i] && this->country[i] <= 'T') {
+
4876 normalized[available++] = '2';
+
4877 normalized[available++] = '0' + this->country[i] - 'K';
+
4878 }
+
4879 else if ('U' <= this->country[i] && this->country[i] <= 'Z') {
+
4880 normalized[available++] = '3';
+
4881 normalized[available++] = '0' + this->country[i] - 'U';
+
4882 }
+
4883 }
+
4884 normalized[available++] = this->check_digits[0];
+
4885 normalized[available++] = this->check_digits[1];
+
4886 normalized[available] = 0;
+
4887 break;
+
4888 }
+
4889 if ('0' <= this->bban[i] && this->bban[i] <= '9')
+
4890 normalized[available++] = this->bban[i];
+
4891 else if ('A' <= this->bban[i] && this->bban[i] <= 'J') {
+
4892 normalized[available++] = '1';
+
4893 normalized[available++] = '0' + this->bban[i] - 'A';
+
4894 }
+
4895 else if ('K' <= this->bban[i] && this->bban[i] <= 'T') {
+
4896 normalized[available++] = '2';
+
4897 normalized[available++] = '0' + this->bban[i] - 'K';
+
4898 }
+
4899 else if ('U' <= this->bban[i] && this->bban[i] <= 'Z') {
+
4900 normalized[available++] = '3';
+
4901 normalized[available++] = '0' + this->bban[i] - 'U';
+
4902 }
+
4903 }
+
4904
+
4905 // Calculate modulo 97.
+
4906 nominator = stdex::strtou32(normalized, 9, &next, 10);
+
4907 for (;;) {
+
4908 nominator %= 97;
+
4909 if (!normalized[next]) {
+
4910 this->is_valid = nominator == 1;
+
4911 break;
+
4912 }
+
4913 size_t digit_count = nominator == 0 ? 0 : nominator < 10 ? 1 : 2;
+
4914 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
+
4915 nominator = nominator * 10 + static_cast<uint32_t>(normalized[next] - '0');
+
4916 }
+
4917
+
4918 this->interval.start = start;
+
4919 return true;
+
4920
+
4921 error:
+
4922 invalidate();
+
4923 return false;
+
4924 }
+
4925
+
4926 std::shared_ptr<basic_parser<T>> m_space;
+
4927 };
-
4927
-
4928 using iban = basic_iban<char>;
-
4929 using wiban = basic_iban<wchar_t>;
-
4930#ifdef _UNICODE
-
4931 using tiban = wiban;
-
4932#else
-
4933 using tiban = iban;
-
4934#endif
-
4935 using sgml_iban = basic_iban<char>;
-
4936
-
4942 template <class T>
-
- -
4944 {
-
4945 public:
- -
4947 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
4948 _In_ const std::locale& locale = std::locale()) :
- -
4950 m_space(space)
-
4951 {
-
4952 this->check_digits[0] = 0;
-
4953 this->reference[0] = 0;
-
4954 this->is_valid = false;
-
4955 }
-
4956
-
4957 virtual void invalidate()
-
4958 {
-
4959 this->check_digits[0] = 0;
-
4960 this->reference[0] = 0;
-
4961 this->is_valid = false;
- -
4963 }
-
4964
- - - -
4968
-
4969 protected:
-
4970 virtual bool do_match(
-
4971 _In_reads_or_z_opt_(end) const T* text,
-
4972 _In_ size_t start = 0,
-
4973 _In_ size_t end = SIZE_MAX,
-
4974 _In_ int flags = match_default)
-
4975 {
-
4976 _Assume_(text || start >= end);
-
4977 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
4978 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
4979 size_t n, available, next;
- -
4981
-
4982 this->interval.end = start;
-
4983 if (this->interval.end + 1 >= end ||
-
4984 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'R' ||
-
4985 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'F')
-
4986 goto error; // incomplete or wrong reference ID
-
4987 this->interval.end += 2;
-
4988
-
4989 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
4990 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
-
4991 goto error; // incomplete or invalid check digits
-
4992 this->check_digits[i] = text[this->interval.end];
-
4993 }
-
4994 this->check_digits[2] = 0;
-
4995
-
4996 for (n = 0;;) {
-
4997 if (m_space && m_space->match(text, this->interval.end, end, flags))
-
4998 this->interval.end = m_space->interval.end;
-
4999 for (size_t j = 0; j < 4; ++j) {
-
5000 if (this->interval.end >= end || !text[this->interval.end])
-
5001 goto out;
-
5002 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
-
5003 if (('0' <= chr && chr <= '9') || ('A' <= chr && chr <= 'Z')) {
-
5004 if (n >= _countof(reference) - 1)
-
5005 goto error; // reference overflow
-
5006 this->reference[n++] = chr;
-
5007 this->interval.end++;
-
5008 }
-
5009 else
-
5010 goto out;
-
5011 }
-
5012 }
-
5013 out:
-
5014 if (!n)
-
5015 goto error; // reference too short
-
5016 this->reference[_countof(this->reference) - 1] = 0;
-
5017 for (size_t i = n, j = _countof(this->reference) - 1; i;)
-
5018 this->reference[--j] = this->reference[--i];
-
5019 for (size_t j = _countof(this->reference) - 1 - n; j;)
-
5020 this->reference[--j] = '0';
-
5021
-
5022 // Normalize creditor reference.
-
5023 T normalized[47];
-
5024 available = 0;
-
5025 for (size_t i = 0; ; ++i) {
-
5026 if (!this->reference[i]) {
-
5027 normalized[available++] = '2'; // R
-
5028 normalized[available++] = '7';
-
5029 normalized[available++] = '1'; // F
-
5030 normalized[available++] = '5';
-
5031 normalized[available++] = this->check_digits[0];
-
5032 normalized[available++] = this->check_digits[1];
-
5033 normalized[available] = 0;
-
5034 break;
-
5035 }
-
5036 if ('0' <= this->reference[i] && this->reference[i] <= '9')
-
5037 normalized[available++] = this->reference[i];
-
5038 else if ('A' <= this->reference[i] && this->reference[i] <= 'J') {
-
5039 normalized[available++] = '1';
-
5040 normalized[available++] = '0' + this->reference[i] - 'A';
-
5041 }
-
5042 else if ('K' <= this->reference[i] && this->reference[i] <= 'T') {
-
5043 normalized[available++] = '2';
-
5044 normalized[available++] = '0' + this->reference[i] - 'K';
-
5045 }
-
5046 else if ('U' <= this->reference[i] && this->reference[i] <= 'Z') {
-
5047 normalized[available++] = '3';
-
5048 normalized[available++] = '0' + this->reference[i] - 'U';
-
5049 }
-
5050 }
-
5051
-
5052 // Calculate modulo 97.
-
5053 nominator = stdex::strtou32(normalized, 9, &next, 10);
-
5054 for (;;) {
-
5055 nominator %= 97;
-
5056 if (!normalized[next]) {
-
5057 this->is_valid = nominator == 1;
-
5058 break;
-
5059 }
-
5060 size_t digit_count = nominator == 0 ? 0 : nominator < 10 ? 1 : 2;
-
5061 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
-
5062 nominator = nominator * 10 + static_cast<uint32_t>(normalized[next] - '0');
-
5063 }
-
5064
-
5065 this->interval.start = start;
-
5066 return true;
-
5067
-
5068 error:
-
5069 invalidate();
-
5070 return false;
-
5071 }
-
5072
-
5073 std::shared_ptr<basic_parser<T>> m_space;
-
5074 };
+
4928
+
4929 using iban = basic_iban<char>;
+
4930 using wiban = basic_iban<wchar_t>;
+
4931#ifdef _UNICODE
+
4932 using tiban = wiban;
+
4933#else
+
4934 using tiban = iban;
+
4935#endif
+
4936 using sgml_iban = basic_iban<char>;
+
4937
+
4943 template <class T>
+
+ +
4945 {
+
4946 public:
+ +
4948 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
4949 _In_ const std::locale& locale = std::locale()) :
+ +
4951 m_space(space)
+
4952 {
+
4953 this->check_digits[0] = 0;
+
4954 this->reference[0] = 0;
+
4955 this->is_valid = false;
+
4956 }
+
4957
+
4958 virtual void invalidate()
+
4959 {
+
4960 this->check_digits[0] = 0;
+
4961 this->reference[0] = 0;
+
4962 this->is_valid = false;
+ +
4964 }
+
4965
+ + + +
4969
+
4970 protected:
+
4971 virtual bool do_match(
+
4972 _In_reads_or_z_opt_(end) const T* text,
+
4973 _In_ size_t start = 0,
+
4974 _In_ size_t end = SIZE_MAX,
+
4975 _In_ int flags = match_default)
+
4976 {
+
4977 _Assume_(text || start >= end);
+
4978 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
4979 const bool case_insensitive = flags & match_case_insensitive ? true : false;
+
4980 size_t n, available, next;
+ +
4982
+
4983 this->interval.end = start;
+
4984 if (this->interval.end + 1 >= end ||
+
4985 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'R' ||
+
4986 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'F')
+
4987 goto error; // incomplete or wrong reference ID
+
4988 this->interval.end += 2;
+
4989
+
4990 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
+
4991 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
+
4992 goto error; // incomplete or invalid check digits
+
4993 this->check_digits[i] = text[this->interval.end];
+
4994 }
+
4995 this->check_digits[2] = 0;
+
4996
+
4997 for (n = 0;;) {
+
4998 if (m_space && m_space->match(text, this->interval.end, end, flags))
+
4999 this->interval.end = m_space->interval.end;
+
5000 for (size_t j = 0; j < 4; ++j) {
+
5001 if (this->interval.end >= end || !text[this->interval.end])
+
5002 goto out;
+
5003 T chr = case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end];
+
5004 if (('0' <= chr && chr <= '9') || ('A' <= chr && chr <= 'Z')) {
+
5005 if (n >= _countof(reference) - 1)
+
5006 goto error; // reference overflow
+
5007 this->reference[n++] = chr;
+
5008 this->interval.end++;
+
5009 }
+
5010 else
+
5011 goto out;
+
5012 }
+
5013 }
+
5014 out:
+
5015 if (!n)
+
5016 goto error; // reference too short
+
5017 this->reference[_countof(this->reference) - 1] = 0;
+
5018 for (size_t i = n, j = _countof(this->reference) - 1; i;)
+
5019 this->reference[--j] = this->reference[--i];
+
5020 for (size_t j = _countof(this->reference) - 1 - n; j;)
+
5021 this->reference[--j] = '0';
+
5022
+
5023 // Normalize creditor reference.
+
5024 T normalized[47];
+
5025 available = 0;
+
5026 for (size_t i = 0; ; ++i) {
+
5027 if (!this->reference[i]) {
+
5028 normalized[available++] = '2'; // R
+
5029 normalized[available++] = '7';
+
5030 normalized[available++] = '1'; // F
+
5031 normalized[available++] = '5';
+
5032 normalized[available++] = this->check_digits[0];
+
5033 normalized[available++] = this->check_digits[1];
+
5034 normalized[available] = 0;
+
5035 break;
+
5036 }
+
5037 if ('0' <= this->reference[i] && this->reference[i] <= '9')
+
5038 normalized[available++] = this->reference[i];
+
5039 else if ('A' <= this->reference[i] && this->reference[i] <= 'J') {
+
5040 normalized[available++] = '1';
+
5041 normalized[available++] = '0' + this->reference[i] - 'A';
+
5042 }
+
5043 else if ('K' <= this->reference[i] && this->reference[i] <= 'T') {
+
5044 normalized[available++] = '2';
+
5045 normalized[available++] = '0' + this->reference[i] - 'K';
+
5046 }
+
5047 else if ('U' <= this->reference[i] && this->reference[i] <= 'Z') {
+
5048 normalized[available++] = '3';
+
5049 normalized[available++] = '0' + this->reference[i] - 'U';
+
5050 }
+
5051 }
+
5052
+
5053 // Calculate modulo 97.
+
5054 nominator = stdex::strtou32(normalized, 9, &next, 10);
+
5055 for (;;) {
+
5056 nominator %= 97;
+
5057 if (!normalized[next]) {
+
5058 this->is_valid = nominator == 1;
+
5059 break;
+
5060 }
+
5061 size_t digit_count = nominator == 0 ? 0 : nominator < 10 ? 1 : 2;
+
5062 for (; digit_count < 9 && normalized[next]; ++next, ++digit_count)
+
5063 nominator = nominator * 10 + static_cast<uint32_t>(normalized[next] - '0');
+
5064 }
+
5065
+
5066 this->interval.start = start;
+
5067 return true;
+
5068
+
5069 error:
+
5070 invalidate();
+
5071 return false;
+
5072 }
+
5073
+
5074 std::shared_ptr<basic_parser<T>> m_space;
+
5075 };
-
5075
-
5076 using creditor_reference = basic_creditor_reference<char>;
-
5077 using wcreditor_reference = basic_creditor_reference<wchar_t>;
-
5078#ifdef _UNICODE
-
5079 using tcreditor_reference = wcreditor_reference;
-
5080#else
-
5081 using tcreditor_reference = creditor_reference;
-
5082#endif
-
5083 using sgml_creditor_reference = basic_creditor_reference<char>;
-
5084
-
5090 template <class T>
-
- -
5092 {
-
5093 public:
-
5094 basic_si_reference_part(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
5095
-
5096 protected:
-
5097 virtual bool do_match(
-
5098 _In_reads_or_z_opt_(end) const T* text,
-
5099 _In_ size_t start = 0,
-
5100 _In_ size_t end = SIZE_MAX,
-
5101 _In_ int flags = match_default)
-
5102 {
-
5103 _Assume_(text || start >= end);
-
5104 this->interval.end = start;
-
5105 for (;;) {
-
5106 if (this->interval.end >= end || !text[this->interval.end])
-
5107 break;
-
5108 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9')
-
5109 this->interval.end++;
-
5110 else
-
5111 break;
-
5112 }
- -
5114 this->interval.start = start;
-
5115 return true;
-
5116 }
-
5117 this->interval.invalidate();
-
5118 return false;
-
5119 }
-
5120 };
+
5076
+
5077 using creditor_reference = basic_creditor_reference<char>;
+
5078 using wcreditor_reference = basic_creditor_reference<wchar_t>;
+
5079#ifdef _UNICODE
+
5080 using tcreditor_reference = wcreditor_reference;
+
5081#else
+
5082 using tcreditor_reference = creditor_reference;
+
5083#endif
+
5084 using sgml_creditor_reference = basic_creditor_reference<char>;
+
5085
+
5091 template <class T>
+
+ +
5093 {
+
5094 public:
+
5095 basic_si_reference_part(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
5096
+
5097 protected:
+
5098 virtual bool do_match(
+
5099 _In_reads_or_z_opt_(end) const T* text,
+
5100 _In_ size_t start = 0,
+
5101 _In_ size_t end = SIZE_MAX,
+
5102 _In_ int flags = match_default)
+
5103 {
+
5104 _Assume_(text || start >= end);
+
5105 this->interval.end = start;
+
5106 for (;;) {
+
5107 if (this->interval.end >= end || !text[this->interval.end])
+
5108 break;
+
5109 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9')
+
5110 this->interval.end++;
+
5111 else
+
5112 break;
+
5113 }
+ +
5115 this->interval.start = start;
+
5116 return true;
+
5117 }
+
5118 this->interval.invalidate();
+
5119 return false;
+
5120 }
+
5121 };
-
5121
- - -
5124#ifdef _UNICODE
- -
5126#else
- -
5128#endif
- -
5130
-
5136 template <class T>
-
- -
5138 {
-
5139 public:
-
5140 basic_si_reference_delimiter(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
-
5141
-
5142 protected:
-
5143 virtual bool do_match(
-
5144 _In_reads_or_z_opt_(end) const T* text,
-
5145 _In_ size_t start = 0,
-
5146 _In_ size_t end = SIZE_MAX,
-
5147 _In_ int flags = match_default)
-
5148 {
-
5149 _Assume_(text || start >= end);
-
5150 if (start < end && text[start] == '-') {
-
5151 this->interval.end = (this->interval.start = start) + 1;
-
5152 return true;
-
5153 }
-
5154 this->interval.invalidate();
-
5155 return false;
-
5156 }
-
5157 };
+
5122
+ + +
5125#ifdef _UNICODE
+ +
5127#else
+ +
5129#endif
+ +
5131
+
5137 template <class T>
+
+ +
5139 {
+
5140 public:
+
5141 basic_si_reference_delimiter(_In_ const std::locale& locale = std::locale()) : basic_parser<T>(locale) {}
+
5142
+
5143 protected:
+
5144 virtual bool do_match(
+
5145 _In_reads_or_z_opt_(end) const T* text,
+
5146 _In_ size_t start = 0,
+
5147 _In_ size_t end = SIZE_MAX,
+
5148 _In_ int flags = match_default)
+
5149 {
+
5150 _Assume_(text || start >= end);
+
5151 if (start < end && text[start] == '-') {
+
5152 this->interval.end = (this->interval.start = start) + 1;
+
5153 return true;
+
5154 }
+
5155 this->interval.invalidate();
+
5156 return false;
+
5157 }
+
5158 };
-
5158
- - -
5161#ifdef _UNICODE
- -
5163#else
- -
5165#endif
- -
5167
-
5175 template <class T>
-
- -
5177 {
-
5178 public:
- -
5180 _In_ const std::shared_ptr<basic_parser<T>>& space,
-
5181 _In_ const std::locale& locale = std::locale()) :
- -
5183 part1(locale),
-
5184 part2(locale),
-
5185 part3(locale),
-
5186 is_valid(false),
-
5187 m_space(space),
-
5188 m_delimiter(locale)
-
5189 {
-
5190 this->model[0] = 0;
-
5191 }
-
5192
-
5193 virtual void invalidate()
-
5194 {
-
5195 this->model[0] = 0;
-
5196 this->part1.invalidate();
-
5197 this->part2.invalidate();
-
5198 this->part3.invalidate();
-
5199 this->is_valid = false;
- -
5201 }
-
5202
-
5203 T model[3];
- - - - -
5208
-
5209 protected:
-
5210 virtual bool do_match(
-
5211 _In_reads_or_z_opt_(end) const T* text,
-
5212 _In_ size_t start = 0,
-
5213 _In_ size_t end = SIZE_MAX,
-
5214 _In_ int flags = match_default)
-
5215 {
-
5216 _Assume_(text || start >= end);
-
5217 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
5218 const bool case_insensitive = flags & match_case_insensitive ? true : false;
-
5219
-
5220 this->interval.end = start;
-
5221 if (this->interval.end + 1 >= end ||
-
5222 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'S' ||
-
5223 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'I')
-
5224 goto error; // incomplete or wrong reference ID
-
5225 this->interval.end += 2;
-
5226
-
5227 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
-
5228 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
-
5229 goto error; // incomplete or invalid model
-
5230 this->model[i] = text[this->interval.end];
-
5231 }
-
5232 this->model[2] = 0;
-
5233
-
5234 this->part1.invalidate();
-
5235 this->part2.invalidate();
-
5236 this->part3.invalidate();
-
5237 if (this->model[0] == '9' && this->model[1] == '9') {
-
5238 is_valid = true;
-
5239 this->interval.start = start;
-
5240 return true;
-
5241 }
-
5242
-
5243 if (m_space && m_space->match(text, this->interval.end, end, flags))
-
5244 this->interval.end = m_space->interval.end;
-
5245
-
5246 this->part1.match(text, this->interval.end, end, flags) &&
-
5247 this->m_delimiter.match(text, this->part1.interval.end, end, flags) &&
-
5248 this->part2.match(text, this->m_delimiter.interval.end, end, flags) &&
-
5249 this->m_delimiter.match(text, this->part2.interval.end, end, flags) &&
-
5250 this->part3.match(text, this->m_delimiter.interval.end, end, flags);
-
5251
-
5252 this->interval.start = start;
-
5253 if (this->part3.interval)
-
5254 this->interval.end = this->part3.interval.end;
-
5255 else if (this->part2.interval)
-
5256 this->interval.end = this->part2.interval.end;
-
5257 else if (this->part1.interval)
-
5258 this->interval.end = this->part1.interval.end;
-
5259 else
-
5260 this->interval.end = start + 4;
-
5261
-
5262 if (this->model[0] == '0' && this->model[1] == '0')
-
5263 is_valid =
-
5264 this->part3.interval ?
-
5265 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5266 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 :
-
5267 this->part2.interval ?
-
5268 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5269 this->part1.interval.size() + this->part2.interval.size() <= 20 :
-
5270 this->part1.interval ?
-
5271 this->part1.interval.size() <= 12 :
-
5272 false;
-
5273 else if (this->model[0] == '0' && this->model[1] == '1')
-
5274 is_valid =
-
5275 this->part3.interval ?
-
5276 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5277 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5278 check11(
-
5279 text + this->part1.interval.start, this->part1.interval.size(),
-
5280 text + this->part2.interval.start, this->part2.interval.size(),
-
5281 text + this->part3.interval.start, this->part3.interval.size()) :
-
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 check11(
-
5286 text + this->part1.interval.start, this->part1.interval.size(),
-
5287 text + this->part2.interval.start, this->part2.interval.size()) :
-
5288 this->part1.interval ?
-
5289 this->part1.interval.size() <= 12 &&
-
5290 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5291 false;
-
5292 else if (this->model[0] == '0' && this->model[1] == '2')
-
5293 is_valid =
-
5294 this->part3.interval ?
-
5295 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5296 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5297 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
-
5298 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5299 false;
-
5300 else if (this->model[0] == '0' && this->model[1] == '3')
-
5301 is_valid =
-
5302 this->part3.interval ?
-
5303 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5304 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5305 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5306 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
-
5307 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5308 false;
-
5309 else if (this->model[0] == '0' && this->model[1] == '4')
-
5310 is_valid =
-
5311 this->part3.interval ?
-
5312 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5313 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5314 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5315 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5316 false;
-
5317 else if ((this->model[0] == '0' || this->model[0] == '5') && this->model[1] == '5')
-
5318 is_valid =
-
5319 this->part3.interval ?
-
5320 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5321 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5322 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5323 this->part2.interval ?
-
5324 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5325 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5326 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5327 this->part1.interval ?
-
5328 this->part1.interval.size() <= 12 &&
-
5329 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5330 false;
-
5331 else if (this->model[0] == '0' && this->model[1] == '6')
-
5332 is_valid =
-
5333 this->part3.interval ?
-
5334 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5335 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5336 check11(
-
5337 text + this->part2.interval.start, this->part2.interval.size(),
-
5338 text + this->part3.interval.start, this->part3.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->part2.interval.start, this->part2.interval.size()) :
-
5343 false;
-
5344 else if (this->model[0] == '0' && this->model[1] == '7')
-
5345 is_valid =
-
5346 this->part3.interval ?
-
5347 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5348 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5349 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5350 this->part2.interval ?
-
5351 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5352 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5353 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5354 false;
-
5355 else if (this->model[0] == '0' && this->model[1] == '8')
-
5356 is_valid =
-
5357 this->part3.interval ?
-
5358 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5359 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5360 check11(
-
5361 text + this->part1.interval.start, this->part1.interval.size(),
-
5362 text + this->part2.interval.start, this->part2.interval.size()) &&
-
5363 check11(text + this->part3.interval.start, this->part3.interval.size()) :
-
5364 false;
-
5365 else if (this->model[0] == '0' && this->model[1] == '9')
-
5366 is_valid =
-
5367 this->part3.interval ?
-
5368 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5369 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5370 check11(
-
5371 text + this->part1.interval.start, this->part1.interval.size(),
-
5372 text + this->part2.interval.start, this->part2.interval.size()) :
-
5373 this->part2.interval ?
-
5374 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5375 this->part1.interval.size() + this->part2.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 this->part1.interval ?
-
5380 this->part1.interval.size() <= 12 &&
-
5381 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5382 false;
-
5383 else if (this->model[0] == '1' && this->model[1] == '0')
-
5384 is_valid =
-
5385 this->part3.interval ?
-
5386 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5387 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5388 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5389 check11(
-
5390 text + this->part2.interval.start, this->part2.interval.size(),
-
5391 text + this->part3.interval.start, this->part3.interval.size()) :
-
5392 this->part2.interval ?
-
5393 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5394 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5395 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5396 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5397 false;
-
5398 else if (
-
5399 (this->model[0] == '1' && (this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
-
5400 ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '8') ||
-
5401 (this->model[0] == '4' && (this->model[1] == '0' || this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
-
5402 (this->model[0] == '5' && (this->model[1] == '1' || this->model[1] == '8')))
-
5403 is_valid =
-
5404 this->part3.interval ?
-
5405 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
-
5406 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
-
5407 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5408 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5409 this->part2.interval ?
-
5410 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5411 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5412 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
-
5413 check11(text + this->part2.interval.start, this->part2.interval.size()) :
-
5414 false;
-
5415 else if (this->model[0] == '1' && this->model[1] == '2')
-
5416 is_valid =
-
5417 this->part3.interval ? false :
-
5418 this->part2.interval ? false :
-
5419 this->part1.interval ?
-
5420 this->part1.interval.size() <= 13 &&
-
5421 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5422 false;
-
5423 else if ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '1')
-
5424 is_valid =
-
5425 this->part3.interval ? false :
-
5426 this->part2.interval ?
-
5427 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
-
5428 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
-
5429 check11(text + this->part1.interval.start, this->part1.interval.size()) :
-
5430 false;
-
5431 else
-
5432 is_valid = true; // Assume models we don't handle as valid
-
5433 return true;
-
5434
-
5435 error:
-
5436 invalidate();
-
5437 return false;
-
5438 }
-
5439
-
5440 static bool check11(
-
5441 _In_count_(num_part1) const T* part1, _In_ size_t num_part1)
-
5442 {
-
5443 _Assume_(part1 && num_part1 >= 1);
-
5444 uint32_t nominator = 0, ponder = 2;
-
5445 for (size_t i = num_part1 - 1; i--; ++ponder)
-
5446 nominator += static_cast<uint32_t>(part1[i] - '0') * ponder;
-
5447 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
-
5448 if (control >= 10)
-
5449 control = 0;
-
5450 return control == part1[num_part1 - 1] - '0';
-
5451 }
-
5452
-
5453 static bool check11(
-
5454 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
-
5455 _In_count_(num_part2) const T* part2, _In_ size_t num_part2)
-
5456 {
-
5457 _Assume_(part1 || !num_part1);
-
5458 _Assume_(part2 && num_part2 >= 1);
-
5459 uint32_t nominator = 0, ponder = 2;
-
5460 for (size_t i = num_part2 - 1; i--; ++ponder)
-
5461 nominator += static_cast<uint32_t>(part2[i] - '0') * ponder;
-
5462 for (size_t i = num_part1; i--; ++ponder)
-
5463 nominator += static_cast<uint32_t>(part1[i] - '0') * ponder;
-
5464 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
-
5465 if (control == 10)
-
5466 control = 0;
-
5467 return control == part2[num_part2 - 1] - '0';
-
5468 }
-
5469
-
5470 static bool check11(
-
5471 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
-
5472 _In_count_(num_part2) const T* part2, _In_ size_t num_part2,
-
5473 _In_count_(num_part3) const T* part3, _In_ size_t num_part3)
-
5474 {
-
5475 _Assume_(part1 || !num_part1);
-
5476 _Assume_(part2 || !num_part2);
-
5477 _Assume_(part3 && num_part3 >= 1);
-
5478 uint32_t nominator = 0, ponder = 2;
-
5479 for (size_t i = num_part3 - 1; i--; ++ponder)
-
5480 nominator += static_cast<uint32_t>(part3[i] - '0') * ponder;
-
5481 for (size_t i = num_part2; i--; ++ponder)
-
5482 nominator += static_cast<uint32_t>(part2[i] - '0') * ponder;
-
5483 for (size_t i = num_part1; i--; ++ponder)
-
5484 nominator += static_cast<uint32_t>(part1[i] - '0') * ponder;
-
5485 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
-
5486 if (control == 10)
-
5487 control = 0;
-
5488 return control == part2[num_part3 - 1] - '0';
-
5489 }
-
5490
-
5491 std::shared_ptr<basic_parser<T>> m_space;
-
5492 basic_si_reference_delimiter<T> m_delimiter;
-
5493 };
+
5159
+ + +
5162#ifdef _UNICODE
+ +
5164#else
+ +
5166#endif
+ +
5168
+
5176 template <class T>
+
+ +
5178 {
+
5179 public:
+ +
5181 _In_ const std::shared_ptr<basic_parser<T>>& space,
+
5182 _In_ const std::locale& locale = std::locale()) :
+ +
5184 part1(locale),
+
5185 part2(locale),
+
5186 part3(locale),
+
5187 is_valid(false),
+
5188 m_space(space),
+
5189 m_delimiter(locale)
+
5190 {
+
5191 this->model[0] = 0;
+
5192 }
+
5193
+
5194 virtual void invalidate()
+
5195 {
+
5196 this->model[0] = 0;
+
5197 this->part1.invalidate();
+
5198 this->part2.invalidate();
+
5199 this->part3.invalidate();
+
5200 this->is_valid = false;
+ +
5202 }
+
5203
+
5204 T model[3];
+ + + + +
5209
+
5210 protected:
+
5211 virtual bool do_match(
+
5212 _In_reads_or_z_opt_(end) const T* text,
+
5213 _In_ size_t start = 0,
+
5214 _In_ size_t end = SIZE_MAX,
+
5215 _In_ int flags = match_default)
+
5216 {
+
5217 _Assume_(text || start >= end);
+
5218 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
5219 const bool case_insensitive = flags & match_case_insensitive ? true : false;
+
5220
+
5221 this->interval.end = start;
+
5222 if (this->interval.end + 1 >= end ||
+
5223 (case_insensitive ? ctype.toupper(text[this->interval.end]) : text[this->interval.end]) != 'S' ||
+
5224 (case_insensitive ? ctype.toupper(text[this->interval.end + 1]) : text[this->interval.end + 1]) != 'I')
+
5225 goto error; // incomplete or wrong reference ID
+
5226 this->interval.end += 2;
+
5227
+
5228 for (size_t i = 0; i < 2; ++i, ++this->interval.end) {
+
5229 if (this->interval.end >= end || text[this->interval.end] < '0' || '9' < text[this->interval.end])
+
5230 goto error; // incomplete or invalid model
+
5231 this->model[i] = text[this->interval.end];
+
5232 }
+
5233 this->model[2] = 0;
+
5234
+
5235 this->part1.invalidate();
+
5236 this->part2.invalidate();
+
5237 this->part3.invalidate();
+
5238 if (this->model[0] == '9' && this->model[1] == '9') {
+
5239 is_valid = true;
+
5240 this->interval.start = start;
+
5241 return true;
+
5242 }
+
5243
+
5244 if (m_space && m_space->match(text, this->interval.end, end, flags))
+
5245 this->interval.end = m_space->interval.end;
+
5246
+
5247 this->part1.match(text, this->interval.end, end, flags) &&
+
5248 this->m_delimiter.match(text, this->part1.interval.end, end, flags) &&
+
5249 this->part2.match(text, this->m_delimiter.interval.end, end, flags) &&
+
5250 this->m_delimiter.match(text, this->part2.interval.end, end, flags) &&
+
5251 this->part3.match(text, this->m_delimiter.interval.end, end, flags);
+
5252
+
5253 this->interval.start = start;
+
5254 if (this->part3.interval)
+
5255 this->interval.end = this->part3.interval.end;
+
5256 else if (this->part2.interval)
+
5257 this->interval.end = this->part2.interval.end;
+
5258 else if (this->part1.interval)
+
5259 this->interval.end = this->part1.interval.end;
+
5260 else
+
5261 this->interval.end = start + 4;
+
5262
+
5263 if (this->model[0] == '0' && this->model[1] == '0')
+
5264 is_valid =
+
5265 this->part3.interval ?
+
5266 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5267 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 :
+
5268 this->part2.interval ?
+
5269 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5270 this->part1.interval.size() + this->part2.interval.size() <= 20 :
+
5271 this->part1.interval ?
+
5272 this->part1.interval.size() <= 12 :
+
5273 false;
+
5274 else if (this->model[0] == '0' && this->model[1] == '1')
+
5275 is_valid =
+
5276 this->part3.interval ?
+
5277 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5278 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5279 check11(
+
5280 text + this->part1.interval.start, this->part1.interval.size(),
+
5281 text + this->part2.interval.start, this->part2.interval.size(),
+
5282 text + this->part3.interval.start, this->part3.interval.size()) :
+
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 check11(
+
5287 text + this->part1.interval.start, this->part1.interval.size(),
+
5288 text + this->part2.interval.start, this->part2.interval.size()) :
+
5289 this->part1.interval ?
+
5290 this->part1.interval.size() <= 12 &&
+
5291 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5292 false;
+
5293 else if (this->model[0] == '0' && this->model[1] == '2')
+
5294 is_valid =
+
5295 this->part3.interval ?
+
5296 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5297 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5298 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
+
5299 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5300 false;
+
5301 else if (this->model[0] == '0' && this->model[1] == '3')
+
5302 is_valid =
+
5303 this->part3.interval ?
+
5304 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5305 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5306 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5307 check11(text + this->part2.interval.start, this->part2.interval.size()) &&
+
5308 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5309 false;
+
5310 else if (this->model[0] == '0' && this->model[1] == '4')
+
5311 is_valid =
+
5312 this->part3.interval ?
+
5313 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5314 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5315 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5316 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5317 false;
+
5318 else if ((this->model[0] == '0' || this->model[0] == '5') && this->model[1] == '5')
+
5319 is_valid =
+
5320 this->part3.interval ?
+
5321 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5322 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5323 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5324 this->part2.interval ?
+
5325 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5326 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5327 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5328 this->part1.interval ?
+
5329 this->part1.interval.size() <= 12 &&
+
5330 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5331 false;
+
5332 else if (this->model[0] == '0' && this->model[1] == '6')
+
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(
+
5338 text + this->part2.interval.start, this->part2.interval.size(),
+
5339 text + this->part3.interval.start, this->part3.interval.size()) :
+
5340 this->part2.interval ?
+
5341 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5342 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5343 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5344 false;
+
5345 else if (this->model[0] == '0' && this->model[1] == '7')
+
5346 is_valid =
+
5347 this->part3.interval ?
+
5348 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5349 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5350 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5351 this->part2.interval ?
+
5352 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5353 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5354 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5355 false;
+
5356 else if (this->model[0] == '0' && this->model[1] == '8')
+
5357 is_valid =
+
5358 this->part3.interval ?
+
5359 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5360 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5361 check11(
+
5362 text + this->part1.interval.start, this->part1.interval.size(),
+
5363 text + this->part2.interval.start, this->part2.interval.size()) &&
+
5364 check11(text + this->part3.interval.start, this->part3.interval.size()) :
+
5365 false;
+
5366 else if (this->model[0] == '0' && this->model[1] == '9')
+
5367 is_valid =
+
5368 this->part3.interval ?
+
5369 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5370 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5371 check11(
+
5372 text + this->part1.interval.start, this->part1.interval.size(),
+
5373 text + this->part2.interval.start, this->part2.interval.size()) :
+
5374 this->part2.interval ?
+
5375 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5376 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5377 check11(
+
5378 text + this->part1.interval.start, this->part1.interval.size(),
+
5379 text + this->part2.interval.start, this->part2.interval.size()) :
+
5380 this->part1.interval ?
+
5381 this->part1.interval.size() <= 12 &&
+
5382 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5383 false;
+
5384 else if (this->model[0] == '1' && this->model[1] == '0')
+
5385 is_valid =
+
5386 this->part3.interval ?
+
5387 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5388 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5389 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5390 check11(
+
5391 text + this->part2.interval.start, this->part2.interval.size(),
+
5392 text + this->part3.interval.start, this->part3.interval.size()) :
+
5393 this->part2.interval ?
+
5394 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5395 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5396 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5397 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5398 false;
+
5399 else if (
+
5400 (this->model[0] == '1' && (this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
+
5401 ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '8') ||
+
5402 (this->model[0] == '4' && (this->model[1] == '0' || this->model[1] == '1' || this->model[1] == '8' || this->model[1] == '9')) ||
+
5403 (this->model[0] == '5' && (this->model[1] == '1' || this->model[1] == '8')))
+
5404 is_valid =
+
5405 this->part3.interval ?
+
5406 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 && this->part3.interval.size() <= 12 &&
+
5407 this->part1.interval.size() + this->part2.interval.size() + this->part3.interval.size() <= 20 &&
+
5408 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5409 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5410 this->part2.interval ?
+
5411 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5412 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5413 check11(text + this->part1.interval.start, this->part1.interval.size()) &&
+
5414 check11(text + this->part2.interval.start, this->part2.interval.size()) :
+
5415 false;
+
5416 else if (this->model[0] == '1' && this->model[1] == '2')
+
5417 is_valid =
+
5418 this->part3.interval ? false :
+
5419 this->part2.interval ? false :
+
5420 this->part1.interval ?
+
5421 this->part1.interval.size() <= 13 &&
+
5422 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5423 false;
+
5424 else if ((this->model[0] == '2' || this->model[0] == '3') && this->model[1] == '1')
+
5425 is_valid =
+
5426 this->part3.interval ? false :
+
5427 this->part2.interval ?
+
5428 this->part1.interval.size() <= 12 && this->part2.interval.size() <= 12 &&
+
5429 this->part1.interval.size() + this->part2.interval.size() <= 20 &&
+
5430 check11(text + this->part1.interval.start, this->part1.interval.size()) :
+
5431 false;
+
5432 else
+
5433 is_valid = true; // Assume models we don't handle as valid
+
5434 return true;
+
5435
+
5436 error:
+
5437 invalidate();
+
5438 return false;
+
5439 }
+
5440
+
5441 static bool check11(
+
5442 _In_count_(num_part1) const T* part1, _In_ size_t num_part1)
+
5443 {
+
5444 _Assume_(part1 && num_part1 >= 1);
+
5445 uint32_t nominator = 0, ponder = 2;
+
5446 for (size_t i = num_part1 - 1; i--; ++ponder)
+
5447 nominator += static_cast<uint32_t>(part1[i] - '0') * ponder;
+
5448 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
+
5449 if (control >= 10)
+
5450 control = 0;
+
5451 return control == part1[num_part1 - 1] - '0';
+
5452 }
+
5453
+
5454 static bool check11(
+
5455 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
+
5456 _In_count_(num_part2) const T* part2, _In_ size_t num_part2)
+
5457 {
+
5458 _Assume_(part1 || !num_part1);
+
5459 _Assume_(part2 && num_part2 >= 1);
+
5460 uint32_t nominator = 0, ponder = 2;
+
5461 for (size_t i = num_part2 - 1; i--; ++ponder)
+
5462 nominator += static_cast<uint32_t>(part2[i] - '0') * ponder;
+
5463 for (size_t i = num_part1; i--; ++ponder)
+
5464 nominator += static_cast<uint32_t>(part1[i] - '0') * ponder;
+
5465 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
+
5466 if (control == 10)
+
5467 control = 0;
+
5468 return control == part2[num_part2 - 1] - '0';
+
5469 }
+
5470
+
5471 static bool check11(
+
5472 _In_count_(num_part1) const T* part1, _In_ size_t num_part1,
+
5473 _In_count_(num_part2) const T* part2, _In_ size_t num_part2,
+
5474 _In_count_(num_part3) const T* part3, _In_ size_t num_part3)
+
5475 {
+
5476 _Assume_(part1 || !num_part1);
+
5477 _Assume_(part2 || !num_part2);
+
5478 _Assume_(part3 && num_part3 >= 1);
+
5479 uint32_t nominator = 0, ponder = 2;
+
5480 for (size_t i = num_part3 - 1; i--; ++ponder)
+
5481 nominator += static_cast<uint32_t>(part3[i] - '0') * ponder;
+
5482 for (size_t i = num_part2; i--; ++ponder)
+
5483 nominator += static_cast<uint32_t>(part2[i] - '0') * ponder;
+
5484 for (size_t i = num_part1; i--; ++ponder)
+
5485 nominator += static_cast<uint32_t>(part1[i] - '0') * ponder;
+
5486 uint8_t control = 11 - static_cast<uint8_t>(nominator % 11);
+
5487 if (control == 10)
+
5488 control = 0;
+
5489 return control == part2[num_part3 - 1] - '0';
+
5490 }
+
5491
+
5492 std::shared_ptr<basic_parser<T>> m_space;
+
5493 basic_si_reference_delimiter<T> m_delimiter;
+
5494 };
-
5494
-
5495 using si_reference = basic_si_reference<char>;
-
5496 using wsi_reference = basic_si_reference<wchar_t>;
-
5497#ifdef _UNICODE
-
5498 using tsi_reference = wsi_reference;
-
5499#else
-
5500 using tsi_reference = si_reference;
-
5501#endif
-
5502 using sgml_si_reference = basic_si_reference<char>;
-
5503
-
5507 template <class T>
-
- -
5509 {
-
5510 public:
- -
5512 _In_ const std::shared_ptr<basic_parser<T>>& element,
-
5513 _In_ const std::shared_ptr<basic_parser<T>>& digit,
-
5514 _In_ const std::shared_ptr<basic_parser<T>>& sign,
-
5515 _In_ const std::locale& locale = std::locale()) :
- -
5517 m_element(element),
-
5518 m_digit(digit),
-
5519 m_sign(sign),
-
5520 has_digits(false),
-
5521 has_charge(false)
-
5522 {}
-
5523
-
5524 virtual void invalidate()
-
5525 {
-
5526 has_digits = false;
-
5527 has_charge = false;
- -
5529 }
-
5530
-
5531 bool has_digits;
-
5532 bool has_charge;
-
5533
-
5534 protected:
-
5535 virtual bool do_match(
-
5536 _In_reads_or_z_opt_(end) const T* text,
-
5537 _In_ size_t start = 0,
-
5538 _In_ size_t end = SIZE_MAX,
-
5539 _In_ int flags = match_default)
-
5540 {
-
5541 _Assume_(text || start >= end);
-
5542
-
5543 has_digits = false;
-
5544 has_charge = false;
-
5545 this->interval.end = start;
-
5546
-
5547 const int element_match_flags = flags & ~match_case_insensitive; // Chemical elements are always case-sensitive.
-
5548 for (;;) {
-
5549 if (m_element->match(text, this->interval.end, end, element_match_flags)) {
-
5550 this->interval.end = m_element->interval.end;
-
5551 while (m_digit->match(text, this->interval.end, end, flags)) {
-
5552 this->interval.end = m_digit->interval.end;
-
5553 has_digits = true;
-
5554 }
-
5555 }
-
5556 else if (start < this->interval.end) {
-
5557 if (m_sign->match(text, this->interval.end, end, flags)) {
-
5558 this->interval.end = m_sign->interval.end;
-
5559 has_charge = true;
-
5560 }
-
5561 this->interval.start = start;
-
5562 return true;
-
5563 }
-
5564 else {
-
5565 this->interval.invalidate();
-
5566 return false;
-
5567 }
-
5568 }
-
5569 }
-
5570
-
5571 std::shared_ptr<basic_parser<T>> m_element;
-
5572 std::shared_ptr<basic_parser<T>> m_digit;
-
5573 std::shared_ptr<basic_parser<T>> m_sign;
-
5574 };
+
5495
+
5496 using si_reference = basic_si_reference<char>;
+
5497 using wsi_reference = basic_si_reference<wchar_t>;
+
5498#ifdef _UNICODE
+
5499 using tsi_reference = wsi_reference;
+
5500#else
+
5501 using tsi_reference = si_reference;
+
5502#endif
+
5503 using sgml_si_reference = basic_si_reference<char>;
+
5504
+
5508 template <class T>
+
+ +
5510 {
+
5511 public:
+ +
5513 _In_ const std::shared_ptr<basic_parser<T>>& element,
+
5514 _In_ const std::shared_ptr<basic_parser<T>>& digit,
+
5515 _In_ const std::shared_ptr<basic_parser<T>>& sign,
+
5516 _In_ const std::locale& locale = std::locale()) :
+ +
5518 m_element(element),
+
5519 m_digit(digit),
+
5520 m_sign(sign),
+
5521 has_digits(false),
+
5522 has_charge(false)
+
5523 {}
+
5524
+
5525 virtual void invalidate()
+
5526 {
+
5527 has_digits = false;
+
5528 has_charge = false;
+ +
5530 }
+
5531
+
5532 bool has_digits;
+
5533 bool has_charge;
+
5534
+
5535 protected:
+
5536 virtual bool do_match(
+
5537 _In_reads_or_z_opt_(end) const T* text,
+
5538 _In_ size_t start = 0,
+
5539 _In_ size_t end = SIZE_MAX,
+
5540 _In_ int flags = match_default)
+
5541 {
+
5542 _Assume_(text || start >= end);
+
5543
+
5544 has_digits = false;
+
5545 has_charge = false;
+
5546 this->interval.end = start;
+
5547
+
5548 const int element_match_flags = flags & ~match_case_insensitive; // Chemical elements are always case-sensitive.
+
5549 for (;;) {
+
5550 if (m_element->match(text, this->interval.end, end, element_match_flags)) {
+
5551 this->interval.end = m_element->interval.end;
+
5552 while (m_digit->match(text, this->interval.end, end, flags)) {
+
5553 this->interval.end = m_digit->interval.end;
+
5554 has_digits = true;
+
5555 }
+
5556 }
+
5557 else if (start < this->interval.end) {
+
5558 if (m_sign->match(text, this->interval.end, end, flags)) {
+
5559 this->interval.end = m_sign->interval.end;
+
5560 has_charge = true;
+
5561 }
+
5562 this->interval.start = start;
+
5563 return true;
+
5564 }
+
5565 else {
+
5566 this->interval.invalidate();
+
5567 return false;
+
5568 }
+
5569 }
+
5570 }
+
5571
+
5572 std::shared_ptr<basic_parser<T>> m_element;
+
5573 std::shared_ptr<basic_parser<T>> m_digit;
+
5574 std::shared_ptr<basic_parser<T>> m_sign;
+
5575 };
-
5575
- - -
5578#ifdef _UNICODE
- -
5580#else
- -
5582#endif
- -
5584
-
- -
5589 {
-
5590 protected:
-
5591 virtual bool do_match(
-
5592 _In_reads_or_z_(end) const char* text,
-
5593 _In_ size_t start = 0,
-
5594 _In_ size_t end = SIZE_MAX,
-
5595 _In_ int flags = match_default)
-
5596 {
-
5597 _Assume_(text || start >= end);
-
5598 this->interval.end = start;
-
5599
-
5600 _Assume_(text || this->interval.end >= end);
-
5601 if (this->interval.end < end && text[this->interval.end]) {
-
5602 if (text[this->interval.end] == '\r') {
-
5603 this->interval.end++;
-
5604 if (this->interval.end < end && text[this->interval.end] == '\n') {
-
5605 this->interval.start = start;
-
5606 this->interval.end++;
-
5607 return true;
-
5608 }
-
5609 }
-
5610 else if (text[this->interval.end] == '\n') {
-
5611 this->interval.start = start;
-
5612 this->interval.end++;
-
5613 return true;
-
5614 }
-
5615 }
-
5616 this->interval.invalidate();
-
5617 return false;
-
5618 }
-
5619 };
+
5576
+ + +
5579#ifdef _UNICODE
+ +
5581#else
+ +
5583#endif
+ +
5585
+
+ +
5590 {
+
5591 protected:
+
5592 virtual bool do_match(
+
5593 _In_reads_or_z_(end) const char* text,
+
5594 _In_ size_t start = 0,
+
5595 _In_ size_t end = SIZE_MAX,
+
5596 _In_ int flags = match_default)
+
5597 {
+
5598 _Assume_(text || start >= end);
+
5599 this->interval.end = start;
+
5600
+
5601 _Assume_(text || this->interval.end >= end);
+
5602 if (this->interval.end < end && text[this->interval.end]) {
+
5603 if (text[this->interval.end] == '\r') {
+
5604 this->interval.end++;
+
5605 if (this->interval.end < end && text[this->interval.end] == '\n') {
+
5606 this->interval.start = start;
+
5607 this->interval.end++;
+
5608 return true;
+
5609 }
+
5610 }
+
5611 else if (text[this->interval.end] == '\n') {
+
5612 this->interval.start = start;
+
5613 this->interval.end++;
+
5614 return true;
+
5615 }
+
5616 }
+
5617 this->interval.invalidate();
+
5618 return false;
+
5619 }
+
5620 };
-
5620
-
-
5624 class http_space : public parser
-
5625 {
-
5626 protected:
-
5627 virtual bool do_match(
-
5628 _In_reads_or_z_(end) const char* text,
-
5629 _In_ size_t start = 0,
-
5630 _In_ size_t end = SIZE_MAX,
-
5631 _In_ int flags = match_default)
-
5632 {
-
5633 _Assume_(text || start >= end);
-
5634 this->interval.end = start;
-
5635 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
5636 this->interval.end = m_line_break.interval.end;
-
5637 if (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) {
-
5638 this->interval.start = start;
-
5639 this->interval.end++;
-
5640 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
-
5641 return true;
-
5642 }
-
5643 }
-
5644 else if (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) {
-
5645 this->interval.start = start;
-
5646 this->interval.end++;
-
5647 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
-
5648 return true;
-
5649 }
-
5650 this->interval.invalidate();
-
5651 return false;
-
5652 }
-
5653
-
5654 http_line_break m_line_break;
-
5655 };
+
5621
+
+
5625 class http_space : public parser
+
5626 {
+
5627 protected:
+
5628 virtual bool do_match(
+
5629 _In_reads_or_z_(end) const char* text,
+
5630 _In_ size_t start = 0,
+
5631 _In_ size_t end = SIZE_MAX,
+
5632 _In_ int flags = match_default)
+
5633 {
+
5634 _Assume_(text || start >= end);
+
5635 this->interval.end = start;
+
5636 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
5637 this->interval.end = m_line_break.interval.end;
+
5638 if (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) {
+
5639 this->interval.start = start;
+
5640 this->interval.end++;
+
5641 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
+
5642 return true;
+
5643 }
+
5644 }
+
5645 else if (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) {
+
5646 this->interval.start = start;
+
5647 this->interval.end++;
+
5648 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
+
5649 return true;
+
5650 }
+
5651 this->interval.invalidate();
+
5652 return false;
+
5653 }
+
5654
+
5655 http_line_break m_line_break;
+
5656 };
-
5656
-
-
5660 class http_text_char : public parser
-
5661 {
-
5662 protected:
-
5663 virtual bool do_match(
-
5664 _In_reads_or_z_(end) const char* text,
-
5665 _In_ size_t start = 0,
-
5666 _In_ size_t end = SIZE_MAX,
-
5667 _In_ int flags = match_default)
-
5668 {
-
5669 _Assume_(text || start >= end);
-
5670 this->interval.end = start;
-
5671
-
5672 _Assume_(text || this->interval.end >= end);
-
5673 if (m_space.match(text, this->interval.end, end, flags)) {
-
5674 this->interval.start = start;
-
5675 this->interval.end = m_space.interval.end;
-
5676 return true;
-
5677 }
-
5678 else if (this->interval.end < end && text[this->interval.end] && text[this->interval.end] >= 0x20) {
-
5679 this->interval.start = start;
-
5680 this->interval.end++;
-
5681 return true;
-
5682 }
-
5683 this->interval.invalidate();
-
5684 return false;
-
5685 }
-
5686
-
5687 http_space m_space;
-
5688 };
+
5657
+
+
5661 class http_text_char : public parser
+
5662 {
+
5663 protected:
+
5664 virtual bool do_match(
+
5665 _In_reads_or_z_(end) const char* text,
+
5666 _In_ size_t start = 0,
+
5667 _In_ size_t end = SIZE_MAX,
+
5668 _In_ int flags = match_default)
+
5669 {
+
5670 _Assume_(text || start >= end);
+
5671 this->interval.end = start;
+
5672
+
5673 _Assume_(text || this->interval.end >= end);
+
5674 if (m_space.match(text, this->interval.end, end, flags)) {
+
5675 this->interval.start = start;
+
5676 this->interval.end = m_space.interval.end;
+
5677 return true;
+
5678 }
+
5679 else if (this->interval.end < end && text[this->interval.end] && text[this->interval.end] >= 0x20) {
+
5680 this->interval.start = start;
+
5681 this->interval.end++;
+
5682 return true;
+
5683 }
+
5684 this->interval.invalidate();
+
5685 return false;
+
5686 }
+
5687
+
5688 http_space m_space;
+
5689 };
-
5689
-
-
5693 class http_token : public parser
-
5694 {
-
5695 protected:
-
5696 virtual bool do_match(
-
5697 _In_reads_or_z_(end) const char* text,
-
5698 _In_ size_t start = 0,
-
5699 _In_ size_t end = SIZE_MAX,
-
5700 _In_ int flags = match_default)
-
5701 {
-
5702 _Assume_(text || start >= end);
-
5703 this->interval.end = start;
-
5704 for (;;) {
-
5705 if (this->interval.end < end && text[this->interval.end]) {
-
5706 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
5707 (unsigned int)text[this->interval.end] == 0x7f ||
-
5708 text[this->interval.end] == '(' ||
-
5709 text[this->interval.end] == ')' ||
-
5710 text[this->interval.end] == '<' ||
-
5711 text[this->interval.end] == '>' ||
-
5712 text[this->interval.end] == '@' ||
-
5713 text[this->interval.end] == ',' ||
-
5714 text[this->interval.end] == ';' ||
-
5715 text[this->interval.end] == ':' ||
-
5716 text[this->interval.end] == '\\' ||
-
5717 text[this->interval.end] == '\"' ||
-
5718 text[this->interval.end] == '/' ||
-
5719 text[this->interval.end] == '[' ||
-
5720 text[this->interval.end] == ']' ||
-
5721 text[this->interval.end] == '?' ||
-
5722 text[this->interval.end] == '=' ||
-
5723 text[this->interval.end] == '{' ||
-
5724 text[this->interval.end] == '}' ||
-
5725 stdex::isspace(text[this->interval.end]))
-
5726 break;
-
5727 else
-
5728 this->interval.end++;
-
5729 }
-
5730 else
-
5731 break;
-
5732 }
- -
5734 this->interval.start = start;
-
5735 return true;
-
5736 }
-
5737 else {
-
5738 this->interval.invalidate();
-
5739 return false;
-
5740 }
-
5741 }
-
5742 };
+
5690
+
+
5694 class http_token : public parser
+
5695 {
+
5696 protected:
+
5697 virtual bool do_match(
+
5698 _In_reads_or_z_(end) const char* text,
+
5699 _In_ size_t start = 0,
+
5700 _In_ size_t end = SIZE_MAX,
+
5701 _In_ int flags = match_default)
+
5702 {
+
5703 _Assume_(text || start >= end);
+
5704 this->interval.end = start;
+
5705 for (;;) {
+
5706 if (this->interval.end < end && text[this->interval.end]) {
+
5707 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
5708 (unsigned int)text[this->interval.end] == 0x7f ||
+
5709 text[this->interval.end] == '(' ||
+
5710 text[this->interval.end] == ')' ||
+
5711 text[this->interval.end] == '<' ||
+
5712 text[this->interval.end] == '>' ||
+
5713 text[this->interval.end] == '@' ||
+
5714 text[this->interval.end] == ',' ||
+
5715 text[this->interval.end] == ';' ||
+
5716 text[this->interval.end] == ':' ||
+
5717 text[this->interval.end] == '\\' ||
+
5718 text[this->interval.end] == '\"' ||
+
5719 text[this->interval.end] == '/' ||
+
5720 text[this->interval.end] == '[' ||
+
5721 text[this->interval.end] == ']' ||
+
5722 text[this->interval.end] == '?' ||
+
5723 text[this->interval.end] == '=' ||
+
5724 text[this->interval.end] == '{' ||
+
5725 text[this->interval.end] == '}' ||
+
5726 stdex::isspace(text[this->interval.end]))
+
5727 break;
+
5728 else
+
5729 this->interval.end++;
+
5730 }
+
5731 else
+
5732 break;
+
5733 }
+ +
5735 this->interval.start = start;
+
5736 return true;
+
5737 }
+
5738 else {
+
5739 this->interval.invalidate();
+
5740 return false;
+
5741 }
+
5742 }
+
5743 };
-
5743
-
- -
5748 {
-
5749 public:
-
5750 virtual void invalidate()
-
5751 {
-
5752 content.start = 1;
-
5753 content.end = 0;
-
5754 parser::invalidate();
-
5755 }
-
5756
- -
5758
-
5759 protected:
-
5760 virtual bool do_match(
-
5761 _In_reads_or_z_(end) const char* text,
-
5762 _In_ size_t start = 0,
-
5763 _In_ size_t end = SIZE_MAX,
-
5764 _In_ int flags = match_default)
-
5765 {
-
5766 _Assume_(text || start >= end);
-
5767 this->interval.end = start;
-
5768 if (this->interval.end < end && text[this->interval.end] != '"')
-
5769 goto error;
-
5770 this->interval.end++;
-
5771 content.start = this->interval.end;
-
5772 for (;;) {
-
5773 _Assume_(text || this->interval.end >= end);
-
5774 if (this->interval.end < end && text[this->interval.end]) {
-
5775 if (text[this->interval.end] == '"') {
-
5776 content.end = this->interval.end;
-
5777 this->interval.end++;
-
5778 break;
-
5779 }
-
5780 else if (text[this->interval.end] == '\\') {
-
5781 this->interval.end++;
-
5782 if (this->interval.end < end && text[this->interval.end]) {
-
5783 this->interval.end++;
-
5784 }
-
5785 else
-
5786 goto error;
-
5787 }
-
5788 else if (m_chr.match(text, this->interval.end, end, flags))
-
5789 this->interval.end++;
-
5790 else
-
5791 goto error;
-
5792 }
-
5793 else
-
5794 goto error;
-
5795 }
-
5796 this->interval.start = start;
-
5797 return true;
-
5798
-
5799 error:
-
5800 invalidate();
-
5801 return false;
-
5802 }
-
5803
-
5804 http_text_char m_chr;
-
5805 };
+
5744
+
+ +
5749 {
+
5750 public:
+
5751 virtual void invalidate()
+
5752 {
+
5753 content.start = 1;
+
5754 content.end = 0;
+
5755 parser::invalidate();
+
5756 }
+
5757
+ +
5759
+
5760 protected:
+
5761 virtual bool do_match(
+
5762 _In_reads_or_z_(end) const char* text,
+
5763 _In_ size_t start = 0,
+
5764 _In_ size_t end = SIZE_MAX,
+
5765 _In_ int flags = match_default)
+
5766 {
+
5767 _Assume_(text || start >= end);
+
5768 this->interval.end = start;
+
5769 if (this->interval.end < end && text[this->interval.end] != '"')
+
5770 goto error;
+
5771 this->interval.end++;
+
5772 content.start = this->interval.end;
+
5773 for (;;) {
+
5774 _Assume_(text || this->interval.end >= end);
+
5775 if (this->interval.end < end && text[this->interval.end]) {
+
5776 if (text[this->interval.end] == '"') {
+
5777 content.end = this->interval.end;
+
5778 this->interval.end++;
+
5779 break;
+
5780 }
+
5781 else if (text[this->interval.end] == '\\') {
+
5782 this->interval.end++;
+
5783 if (this->interval.end < end && text[this->interval.end]) {
+
5784 this->interval.end++;
+
5785 }
+
5786 else
+
5787 goto error;
+
5788 }
+
5789 else if (m_chr.match(text, this->interval.end, end, flags))
+
5790 this->interval.end++;
+
5791 else
+
5792 goto error;
+
5793 }
+
5794 else
+
5795 goto error;
+
5796 }
+
5797 this->interval.start = start;
+
5798 return true;
+
5799
+
5800 error:
+
5801 invalidate();
+
5802 return false;
+
5803 }
+
5804
+
5805 http_text_char m_chr;
+
5806 };
-
5806
-
-
5810 class http_value : public parser
-
5811 {
-
5812 public:
-
5813 virtual void invalidate()
-
5814 {
-
5815 string.invalidate();
-
5816 token.invalidate();
-
5817 parser::invalidate();
-
5818 }
-
5819
- - -
5822
-
5823 protected:
-
5824 virtual bool do_match(
-
5825 _In_reads_or_z_(end) const char* text,
-
5826 _In_ size_t start = 0,
-
5827 _In_ size_t end = SIZE_MAX,
-
5828 _In_ int flags = match_default)
-
5829 {
-
5830 _Assume_(text || start >= end);
-
5831 this->interval.end = start;
-
5832 if (string.match(text, this->interval.end, end, flags)) {
-
5833 token.invalidate();
-
5834 this->interval.end = string.interval.end;
-
5835 this->interval.start = start;
-
5836 return true;
-
5837 }
-
5838 else if (token.match(text, this->interval.end, end, flags)) {
-
5839 string.invalidate();
-
5840 this->interval.end = token.interval.end;
-
5841 this->interval.start = start;
-
5842 return true;
-
5843 }
-
5844 else {
-
5845 this->interval.invalidate();
-
5846 return false;
-
5847 }
-
5848 }
-
5849 };
+
5807
+
+
5811 class http_value : public parser
+
5812 {
+
5813 public:
+
5814 virtual void invalidate()
+
5815 {
+
5816 string.invalidate();
+
5817 token.invalidate();
+
5818 parser::invalidate();
+
5819 }
+
5820
+ + +
5823
+
5824 protected:
+
5825 virtual bool do_match(
+
5826 _In_reads_or_z_(end) const char* text,
+
5827 _In_ size_t start = 0,
+
5828 _In_ size_t end = SIZE_MAX,
+
5829 _In_ int flags = match_default)
+
5830 {
+
5831 _Assume_(text || start >= end);
+
5832 this->interval.end = start;
+
5833 if (string.match(text, this->interval.end, end, flags)) {
+
5834 token.invalidate();
+
5835 this->interval.end = string.interval.end;
+
5836 this->interval.start = start;
+
5837 return true;
+
5838 }
+
5839 else if (token.match(text, this->interval.end, end, flags)) {
+
5840 string.invalidate();
+
5841 this->interval.end = token.interval.end;
+
5842 this->interval.start = start;
+
5843 return true;
+
5844 }
+
5845 else {
+
5846 this->interval.invalidate();
+
5847 return false;
+
5848 }
+
5849 }
+
5850 };
-
5850
-
-
5854 class http_parameter : public parser
-
5855 {
-
5856 public:
-
5857 virtual void invalidate()
-
5858 {
-
5859 name.invalidate();
-
5860 value.invalidate();
-
5861 parser::invalidate();
-
5862 }
-
5863
- - -
5866
-
5867 protected:
-
5868 virtual bool do_match(
-
5869 _In_reads_or_z_(end) const char* text,
-
5870 _In_ size_t start = 0,
-
5871 _In_ size_t end = SIZE_MAX,
-
5872 _In_ int flags = match_default)
-
5873 {
-
5874 _Assume_(text || start >= end);
-
5875 this->interval.end = start;
-
5876 if (name.match(text, this->interval.end, end, flags))
-
5877 this->interval.end = name.interval.end;
-
5878 else
-
5879 goto error;
-
5880 while (m_space.match(text, this->interval.end, end, flags))
-
5881 this->interval.end = m_space.interval.end;
-
5882 _Assume_(text || this->interval.end >= end);
-
5883 if (this->interval.end < end && text[this->interval.end] == '=')
-
5884 this->interval.end++;
-
5885 else
-
5886 while (m_space.match(text, this->interval.end, end, flags))
-
5887 this->interval.end = m_space.interval.end;
-
5888 if (value.match(text, this->interval.end, end, flags))
-
5889 this->interval.end = value.interval.end;
-
5890 else
-
5891 goto error;
-
5892 this->interval.start = start;
-
5893 return true;
-
5894
-
5895 error:
-
5896 invalidate();
-
5897 return false;
-
5898 }
-
5899
-
5900 http_space m_space;
-
5901 };
+
5851
+
+
5855 class http_parameter : public parser
+
5856 {
+
5857 public:
+
5858 virtual void invalidate()
+
5859 {
+
5860 name.invalidate();
+
5861 value.invalidate();
+
5862 parser::invalidate();
+
5863 }
+
5864
+ + +
5867
+
5868 protected:
+
5869 virtual bool do_match(
+
5870 _In_reads_or_z_(end) const char* text,
+
5871 _In_ size_t start = 0,
+
5872 _In_ size_t end = SIZE_MAX,
+
5873 _In_ int flags = match_default)
+
5874 {
+
5875 _Assume_(text || start >= end);
+
5876 this->interval.end = start;
+
5877 if (name.match(text, this->interval.end, end, flags))
+
5878 this->interval.end = name.interval.end;
+
5879 else
+
5880 goto error;
+
5881 while (m_space.match(text, this->interval.end, end, flags))
+
5882 this->interval.end = m_space.interval.end;
+
5883 _Assume_(text || this->interval.end >= end);
+
5884 if (this->interval.end < end && text[this->interval.end] == '=')
+
5885 this->interval.end++;
+
5886 else
+
5887 while (m_space.match(text, this->interval.end, end, flags))
+
5888 this->interval.end = m_space.interval.end;
+
5889 if (value.match(text, this->interval.end, end, flags))
+
5890 this->interval.end = value.interval.end;
+
5891 else
+
5892 goto error;
+
5893 this->interval.start = start;
+
5894 return true;
+
5895
+
5896 error:
+
5897 invalidate();
+
5898 return false;
+
5899 }
+
5900
+
5901 http_space m_space;
+
5902 };
-
5902
-
-
5906 class http_any_type : public parser
-
5907 {
-
5908 protected:
-
5909 virtual bool do_match(
-
5910 _In_reads_or_z_(end) const char* text,
-
5911 _In_ size_t start = 0,
-
5912 _In_ size_t end = SIZE_MAX,
-
5913 _In_ int flags = match_default)
-
5914 {
-
5915 _Assume_(text || start >= end);
-
5916 if (start + 2 < end &&
-
5917 text[start] == '*' &&
-
5918 text[start + 1] == '/' &&
-
5919 text[start + 2] == '*')
-
5920 {
-
5921 this->interval.end = (this->interval.start = start) + 3;
-
5922 return true;
-
5923 }
-
5924 else if (start < end && text[start] == '*') {
-
5925 this->interval.end = (this->interval.start = start) + 1;
-
5926 return true;
-
5927 }
-
5928 else {
-
5929 this->interval.invalidate();
-
5930 return false;
-
5931 }
-
5932 }
-
5933 };
+
5903
+
+
5907 class http_any_type : public parser
+
5908 {
+
5909 protected:
+
5910 virtual bool do_match(
+
5911 _In_reads_or_z_(end) const char* text,
+
5912 _In_ size_t start = 0,
+
5913 _In_ size_t end = SIZE_MAX,
+
5914 _In_ int flags = match_default)
+
5915 {
+
5916 _Assume_(text || start >= end);
+
5917 if (start + 2 < end &&
+
5918 text[start] == '*' &&
+
5919 text[start + 1] == '/' &&
+
5920 text[start + 2] == '*')
+
5921 {
+
5922 this->interval.end = (this->interval.start = start) + 3;
+
5923 return true;
+
5924 }
+
5925 else if (start < end && text[start] == '*') {
+
5926 this->interval.end = (this->interval.start = start) + 1;
+
5927 return true;
+
5928 }
+
5929 else {
+
5930 this->interval.invalidate();
+
5931 return false;
+
5932 }
+
5933 }
+
5934 };
-
5934
-
- -
5939 {
-
5940 public:
-
5941 virtual void invalidate()
-
5942 {
-
5943 type.invalidate();
-
5944 subtype.invalidate();
-
5945 parser::invalidate();
-
5946 }
-
5947
-
5948 http_token type;
-
5949 http_token subtype;
-
5950
-
5951 protected:
-
5952 virtual bool do_match(
-
5953 _In_reads_or_z_(end) const char* text,
-
5954 _In_ size_t start = 0,
-
5955 _In_ size_t end = SIZE_MAX,
-
5956 _In_ int flags = match_default)
-
5957 {
-
5958 _Assume_(text || start >= end);
-
5959 this->interval.end = start;
-
5960 if (type.match(text, this->interval.end, end, flags))
-
5961 this->interval.end = type.interval.end;
-
5962 else
-
5963 goto error;
-
5964 while (m_space.match(text, this->interval.end, end, flags))
-
5965 this->interval.end = m_space.interval.end;
-
5966 if (this->interval.end < end && text[this->interval.end] == '/')
-
5967 this->interval.end++;
-
5968 else
-
5969 goto error;
-
5970 while (m_space.match(text, this->interval.end, end, flags))
-
5971 this->interval.end = m_space.interval.end;
-
5972 if (subtype.match(text, this->interval.end, end, flags))
-
5973 this->interval.end = subtype.interval.end;
-
5974 else
-
5975 goto error;
-
5976 this->interval.start = start;
-
5977 return true;
-
5978
-
5979 error:
-
5980 invalidate();
-
5981 return false;
-
5982 }
-
5983
-
5984 http_space m_space;
-
5985 };
+
5935
+
+ +
5940 {
+
5941 public:
+
5942 virtual void invalidate()
+
5943 {
+
5944 type.invalidate();
+
5945 subtype.invalidate();
+
5946 parser::invalidate();
+
5947 }
+
5948
+
5949 http_token type;
+
5950 http_token subtype;
+
5951
+
5952 protected:
+
5953 virtual bool do_match(
+
5954 _In_reads_or_z_(end) const char* text,
+
5955 _In_ size_t start = 0,
+
5956 _In_ size_t end = SIZE_MAX,
+
5957 _In_ int flags = match_default)
+
5958 {
+
5959 _Assume_(text || start >= end);
+
5960 this->interval.end = start;
+
5961 if (type.match(text, this->interval.end, end, flags))
+
5962 this->interval.end = type.interval.end;
+
5963 else
+
5964 goto error;
+
5965 while (m_space.match(text, this->interval.end, end, flags))
+
5966 this->interval.end = m_space.interval.end;
+
5967 if (this->interval.end < end && text[this->interval.end] == '/')
+
5968 this->interval.end++;
+
5969 else
+
5970 goto error;
+
5971 while (m_space.match(text, this->interval.end, end, flags))
+
5972 this->interval.end = m_space.interval.end;
+
5973 if (subtype.match(text, this->interval.end, end, flags))
+
5974 this->interval.end = subtype.interval.end;
+
5975 else
+
5976 goto error;
+
5977 this->interval.start = start;
+
5978 return true;
+
5979
+
5980 error:
+
5981 invalidate();
+
5982 return false;
+
5983 }
+
5984
+
5985 http_space m_space;
+
5986 };
-
5986
-
- -
5991 {
-
5992 public:
-
5993 virtual void invalidate()
-
5994 {
-
5995 params.clear();
-
5996 http_media_range::invalidate();
-
5997 }
-
5998
-
5999 std::list<http_parameter> params;
-
6000
-
6001 protected:
-
6002 virtual bool do_match(
-
6003 _In_reads_or_z_(end) const char* text,
-
6004 _In_ size_t start = 0,
-
6005 _In_ size_t end = SIZE_MAX,
-
6006 _In_ int flags = match_default)
-
6007 {
-
6008 _Assume_(text || start >= end);
-
6009 if (!http_media_range::do_match(text, start, end, flags))
-
6010 goto error;
-
6011 params.clear();
-
6012 for (;;) {
-
6013 if (this->interval.end < end && text[this->interval.end]) {
-
6014 if (m_space.match(text, this->interval.end, end, flags))
-
6015 this->interval.end = m_space.interval.end;
-
6016 else if (text[this->interval.end] == ';') {
-
6017 this->interval.end++;
-
6018 while (m_space.match(text, this->interval.end, end, flags))
-
6019 this->interval.end = m_space.interval.end;
-
6020 http_parameter param;
-
6021 if (param.match(text, this->interval.end, end, flags)) {
-
6022 this->interval.end = param.interval.end;
-
6023 params.push_back(std::move(param));
-
6024 }
-
6025 else
-
6026 break;
-
6027 }
-
6028 else
-
6029 break;
-
6030 }
-
6031 else
-
6032 break;
-
6033 }
-
6034 this->interval.end = params.empty() ? subtype.interval.end : params.back().interval.end;
-
6035 return true;
-
6036
-
6037 error:
-
6038 invalidate();
-
6039 return false;
-
6040 }
-
6041 };
+
5987
+
+ +
5992 {
+
5993 public:
+
5994 virtual void invalidate()
+
5995 {
+
5996 params.clear();
+
5997 http_media_range::invalidate();
+
5998 }
+
5999
+
6000 std::list<http_parameter> params;
+
6001
+
6002 protected:
+
6003 virtual bool do_match(
+
6004 _In_reads_or_z_(end) const char* text,
+
6005 _In_ size_t start = 0,
+
6006 _In_ size_t end = SIZE_MAX,
+
6007 _In_ int flags = match_default)
+
6008 {
+
6009 _Assume_(text || start >= end);
+
6010 if (!http_media_range::do_match(text, start, end, flags))
+
6011 goto error;
+
6012 params.clear();
+
6013 for (;;) {
+
6014 if (this->interval.end < end && text[this->interval.end]) {
+
6015 if (m_space.match(text, this->interval.end, end, flags))
+
6016 this->interval.end = m_space.interval.end;
+
6017 else if (text[this->interval.end] == ';') {
+
6018 this->interval.end++;
+
6019 while (m_space.match(text, this->interval.end, end, flags))
+
6020 this->interval.end = m_space.interval.end;
+
6021 http_parameter param;
+
6022 if (param.match(text, this->interval.end, end, flags)) {
+
6023 this->interval.end = param.interval.end;
+
6024 params.push_back(std::move(param));
+
6025 }
+
6026 else
+
6027 break;
+
6028 }
+
6029 else
+
6030 break;
+
6031 }
+
6032 else
+
6033 break;
+
6034 }
+
6035 this->interval.end = params.empty() ? subtype.interval.end : params.back().interval.end;
+
6036 return true;
+
6037
+
6038 error:
+
6039 invalidate();
+
6040 return false;
+
6041 }
+
6042 };
-
6042
-
- -
6047 {
-
6048 protected:
-
6049 virtual bool do_match(
-
6050 _In_reads_or_z_(end) const char* text,
-
6051 _In_ size_t start = 0,
-
6052 _In_ size_t end = SIZE_MAX,
-
6053 _In_ int flags = match_default)
-
6054 {
-
6055 _Assume_(text || start >= end);
-
6056 this->interval.end = start;
-
6057 for (;;) {
-
6058 if (this->interval.end < end && text[this->interval.end]) {
-
6059 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6060 (unsigned int)text[this->interval.end] == 0x7f ||
-
6061 text[this->interval.end] == ':' ||
-
6062 text[this->interval.end] == '/' ||
-
6063 stdex::isspace(text[this->interval.end]))
-
6064 break;
-
6065 else
-
6066 this->interval.end++;
-
6067 }
-
6068 else
-
6069 break;
-
6070 }
- -
6072 this->interval.start = start;
-
6073 return true;
-
6074 }
-
6075 this->interval.invalidate();
-
6076 return false;
-
6077 }
-
6078 };
+
6043
+
+ +
6048 {
+
6049 protected:
+
6050 virtual bool do_match(
+
6051 _In_reads_or_z_(end) const char* text,
+
6052 _In_ size_t start = 0,
+
6053 _In_ size_t end = SIZE_MAX,
+
6054 _In_ int flags = match_default)
+
6055 {
+
6056 _Assume_(text || start >= end);
+
6057 this->interval.end = start;
+
6058 for (;;) {
+
6059 if (this->interval.end < end && text[this->interval.end]) {
+
6060 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6061 (unsigned int)text[this->interval.end] == 0x7f ||
+
6062 text[this->interval.end] == ':' ||
+
6063 text[this->interval.end] == '/' ||
+
6064 stdex::isspace(text[this->interval.end]))
+
6065 break;
+
6066 else
+
6067 this->interval.end++;
+
6068 }
+
6069 else
+
6070 break;
+
6071 }
+ +
6073 this->interval.start = start;
+
6074 return true;
+
6075 }
+
6076 this->interval.invalidate();
+
6077 return false;
+
6078 }
+
6079 };
-
6079
-
-
6083 class http_url_port : public parser
-
6084 {
-
6085 public:
-
6086 http_url_port(_In_ const std::locale& locale = std::locale()) :
-
6087 parser(locale),
-
6088 value(0)
-
6089 {}
-
6090
-
6091 virtual void invalidate()
-
6092 {
-
6093 value = 0;
-
6094 parser::invalidate();
-
6095 }
-
6096
-
6097 uint16_t value;
-
6098
-
6099 protected:
-
6100 virtual bool do_match(
-
6101 _In_reads_or_z_(end) const char* text,
-
6102 _In_ size_t start = 0,
-
6103 _In_ size_t end = SIZE_MAX,
-
6104 _In_ int flags = match_default)
-
6105 {
-
6106 _Assume_(text || start >= end);
-
6107 value = 0;
-
6108 this->interval.end = start;
-
6109 for (;;) {
-
6110 if (this->interval.end < end && text[this->interval.end]) {
-
6111 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
-
6112 size_t _value = static_cast<size_t>(value) * 10 + static_cast<size_t>(text[this->interval.end] - '0');
-
6113 if (_value > UINT16_MAX) {
-
6114 value = 0;
-
6115 this->interval.invalidate();
-
6116 return false;
-
6117 }
-
6118 value = (uint16_t)_value;
-
6119 this->interval.end++;
-
6120 }
-
6121 else
-
6122 break;
-
6123 }
-
6124 else
-
6125 break;
-
6126 }
- -
6128 this->interval.start = start;
-
6129 return true;
-
6130 }
-
6131 this->interval.invalidate();
-
6132 return false;
-
6133 }
-
6134 };
+
6080
+
+
6084 class http_url_port : public parser
+
6085 {
+
6086 public:
+
6087 http_url_port(_In_ const std::locale& locale = std::locale()) :
+
6088 parser(locale),
+
6089 value(0)
+
6090 {}
+
6091
+
6092 virtual void invalidate()
+
6093 {
+
6094 value = 0;
+
6095 parser::invalidate();
+
6096 }
+
6097
+
6098 uint16_t value;
+
6099
+
6100 protected:
+
6101 virtual bool do_match(
+
6102 _In_reads_or_z_(end) const char* text,
+
6103 _In_ size_t start = 0,
+
6104 _In_ size_t end = SIZE_MAX,
+
6105 _In_ int flags = match_default)
+
6106 {
+
6107 _Assume_(text || start >= end);
+
6108 value = 0;
+
6109 this->interval.end = start;
+
6110 for (;;) {
+
6111 if (this->interval.end < end && text[this->interval.end]) {
+
6112 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
+
6113 size_t _value = static_cast<size_t>(value) * 10 + static_cast<size_t>(text[this->interval.end] - '0');
+
6114 if (_value > UINT16_MAX) {
+
6115 value = 0;
+
6116 this->interval.invalidate();
+
6117 return false;
+
6118 }
+
6119 value = (uint16_t)_value;
+
6120 this->interval.end++;
+
6121 }
+
6122 else
+
6123 break;
+
6124 }
+
6125 else
+
6126 break;
+
6127 }
+ +
6129 this->interval.start = start;
+
6130 return true;
+
6131 }
+
6132 this->interval.invalidate();
+
6133 return false;
+
6134 }
+
6135 };
-
6135
-
- -
6140 {
-
6141 protected:
-
6142 virtual bool do_match(
-
6143 _In_reads_or_z_(end) const char* text,
-
6144 _In_ size_t start = 0,
-
6145 _In_ size_t end = SIZE_MAX,
-
6146 _In_ int flags = match_default)
-
6147 {
-
6148 _Assume_(text || start >= end);
-
6149 this->interval.end = start;
-
6150 for (;;) {
-
6151 if (this->interval.end < end && text[this->interval.end]) {
-
6152 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6153 (unsigned int)text[this->interval.end] == 0x7f ||
-
6154 text[this->interval.end] == '?' ||
-
6155 text[this->interval.end] == '/' ||
-
6156 stdex::isspace(text[this->interval.end]))
-
6157 break;
-
6158 else
-
6159 this->interval.end++;
-
6160 }
-
6161 else
-
6162 break;
-
6163 }
-
6164 this->interval.start = start;
-
6165 return true;
-
6166 }
-
6167 };
+
6136
+
+ +
6141 {
+
6142 protected:
+
6143 virtual bool do_match(
+
6144 _In_reads_or_z_(end) const char* text,
+
6145 _In_ size_t start = 0,
+
6146 _In_ size_t end = SIZE_MAX,
+
6147 _In_ int flags = match_default)
+
6148 {
+
6149 _Assume_(text || start >= end);
+
6150 this->interval.end = start;
+
6151 for (;;) {
+
6152 if (this->interval.end < end && text[this->interval.end]) {
+
6153 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6154 (unsigned int)text[this->interval.end] == 0x7f ||
+
6155 text[this->interval.end] == '?' ||
+
6156 text[this->interval.end] == '/' ||
+
6157 stdex::isspace(text[this->interval.end]))
+
6158 break;
+
6159 else
+
6160 this->interval.end++;
+
6161 }
+
6162 else
+
6163 break;
+
6164 }
+
6165 this->interval.start = start;
+
6166 return true;
+
6167 }
+
6168 };
-
6168
-
-
6172 class http_url_path : public parser
-
6173 {
-
6174 public:
-
6175 virtual void invalidate()
-
6176 {
-
6177 segments.clear();
-
6178 parser::invalidate();
-
6179 }
-
6180
-
6181 std::vector<http_url_path_segment> segments;
-
6182
-
6183 protected:
-
6184 virtual bool do_match(
-
6185 _In_reads_or_z_(end) const char* text,
-
6186 _In_ size_t start = 0,
-
6187 _In_ size_t end = SIZE_MAX,
-
6188 _In_ int flags = match_default)
-
6189 {
-
6190 _Assume_(text || start >= end);
- -
6192 this->interval.end = start;
-
6193 segments.clear();
-
6194 _Assume_(text || this->interval.end >= end);
-
6195 if (this->interval.end < end && text[this->interval.end] != '/')
-
6196 goto error;
-
6197 this->interval.end++;
-
6198 s.match(text, this->interval.end, end, flags);
-
6199 segments.push_back(s);
-
6200 this->interval.end = s.interval.end;
-
6201 for (;;) {
-
6202 if (this->interval.end < end && text[this->interval.end]) {
-
6203 if (text[this->interval.end] == '/') {
-
6204 this->interval.end++;
-
6205 s.match(text, this->interval.end, end, flags);
-
6206 segments.push_back(s);
-
6207 this->interval.end = s.interval.end;
-
6208 }
-
6209 else
-
6210 break;
-
6211 }
-
6212 else
-
6213 break;
-
6214 }
-
6215 this->interval.start = start;
-
6216 return true;
-
6217
-
6218 error:
-
6219 invalidate();
-
6220 return false;
-
6221 }
-
6222 };
+
6169
+
+
6173 class http_url_path : public parser
+
6174 {
+
6175 public:
+
6176 virtual void invalidate()
+
6177 {
+
6178 segments.clear();
+
6179 parser::invalidate();
+
6180 }
+
6181
+
6182 std::vector<http_url_path_segment> segments;
+
6183
+
6184 protected:
+
6185 virtual bool do_match(
+
6186 _In_reads_or_z_(end) const char* text,
+
6187 _In_ size_t start = 0,
+
6188 _In_ size_t end = SIZE_MAX,
+
6189 _In_ int flags = match_default)
+
6190 {
+
6191 _Assume_(text || start >= end);
+ +
6193 this->interval.end = start;
+
6194 segments.clear();
+
6195 _Assume_(text || this->interval.end >= end);
+
6196 if (this->interval.end < end && text[this->interval.end] != '/')
+
6197 goto error;
+
6198 this->interval.end++;
+
6199 s.match(text, this->interval.end, end, flags);
+
6200 segments.push_back(s);
+
6201 this->interval.end = s.interval.end;
+
6202 for (;;) {
+
6203 if (this->interval.end < end && text[this->interval.end]) {
+
6204 if (text[this->interval.end] == '/') {
+
6205 this->interval.end++;
+
6206 s.match(text, this->interval.end, end, flags);
+
6207 segments.push_back(s);
+
6208 this->interval.end = s.interval.end;
+
6209 }
+
6210 else
+
6211 break;
+
6212 }
+
6213 else
+
6214 break;
+
6215 }
+
6216 this->interval.start = start;
+
6217 return true;
+
6218
+
6219 error:
+
6220 invalidate();
+
6221 return false;
+
6222 }
+
6223 };
-
6223
-
- -
6228 {
-
6229 public:
-
6230 virtual void invalidate()
-
6231 {
-
6232 name.start = 1;
-
6233 name.end = 0;
-
6234 value.start = 1;
-
6235 value.end = 0;
-
6236 parser::invalidate();
-
6237 }
-
6238
- - -
6241
-
6242 protected:
-
6243 virtual bool do_match(
-
6244 _In_reads_or_z_(end) const char* text,
-
6245 _In_ size_t start = 0,
-
6246 _In_ size_t end = SIZE_MAX,
-
6247 _In_ int flags = match_default)
-
6248 {
-
6249 _Assume_(text || start >= end);
-
6250 this->interval.end = start;
-
6251 name.start = this->interval.end;
-
6252 for (;;) {
-
6253 if (this->interval.end < end && text[this->interval.end]) {
-
6254 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6255 (unsigned int)text[this->interval.end] == 0x7f ||
-
6256 text[this->interval.end] == '&' ||
-
6257 text[this->interval.end] == '=' ||
-
6258 stdex::isspace(text[this->interval.end]))
-
6259 break;
-
6260 else
-
6261 this->interval.end++;
-
6262 }
-
6263 else
-
6264 break;
-
6265 }
- -
6267 name.end = this->interval.end;
-
6268 else
-
6269 goto error;
-
6270 if (text[this->interval.end] == '=') {
-
6271 this->interval.end++;
-
6272 value.start = this->interval.end;
-
6273 for (;;) {
-
6274 if (this->interval.end < end && text[this->interval.end]) {
-
6275 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6276 (unsigned int)text[this->interval.end] == 0x7f ||
-
6277 text[this->interval.end] == '&' ||
-
6278 stdex::isspace(text[this->interval.end]))
-
6279 break;
-
6280 else
-
6281 this->interval.end++;
-
6282 }
-
6283 else
-
6284 break;
-
6285 }
-
6286 value.end = this->interval.end;
-
6287 }
-
6288 else {
-
6289 value.start = 1;
-
6290 value.end = 0;
-
6291 }
-
6292 this->interval.start = start;
-
6293 return true;
-
6294
-
6295 error:
-
6296 invalidate();
-
6297 return false;
-
6298 }
-
6299 };
+
6224
+
+ +
6229 {
+
6230 public:
+
6231 virtual void invalidate()
+
6232 {
+
6233 name.start = 1;
+
6234 name.end = 0;
+
6235 value.start = 1;
+
6236 value.end = 0;
+
6237 parser::invalidate();
+
6238 }
+
6239
+ + +
6242
+
6243 protected:
+
6244 virtual bool do_match(
+
6245 _In_reads_or_z_(end) const char* text,
+
6246 _In_ size_t start = 0,
+
6247 _In_ size_t end = SIZE_MAX,
+
6248 _In_ int flags = match_default)
+
6249 {
+
6250 _Assume_(text || start >= end);
+
6251 this->interval.end = start;
+
6252 name.start = this->interval.end;
+
6253 for (;;) {
+
6254 if (this->interval.end < end && text[this->interval.end]) {
+
6255 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6256 (unsigned int)text[this->interval.end] == 0x7f ||
+
6257 text[this->interval.end] == '&' ||
+
6258 text[this->interval.end] == '=' ||
+
6259 stdex::isspace(text[this->interval.end]))
+
6260 break;
+
6261 else
+
6262 this->interval.end++;
+
6263 }
+
6264 else
+
6265 break;
+
6266 }
+ +
6268 name.end = this->interval.end;
+
6269 else
+
6270 goto error;
+
6271 if (text[this->interval.end] == '=') {
+
6272 this->interval.end++;
+
6273 value.start = this->interval.end;
+
6274 for (;;) {
+
6275 if (this->interval.end < end && text[this->interval.end]) {
+
6276 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6277 (unsigned int)text[this->interval.end] == 0x7f ||
+
6278 text[this->interval.end] == '&' ||
+
6279 stdex::isspace(text[this->interval.end]))
+
6280 break;
+
6281 else
+
6282 this->interval.end++;
+
6283 }
+
6284 else
+
6285 break;
+
6286 }
+
6287 value.end = this->interval.end;
+
6288 }
+
6289 else {
+
6290 value.start = 1;
+
6291 value.end = 0;
+
6292 }
+
6293 this->interval.start = start;
+
6294 return true;
+
6295
+
6296 error:
+
6297 invalidate();
+
6298 return false;
+
6299 }
+
6300 };
-
6300
-
-
6304 class http_url : public parser
-
6305 {
-
6306 public:
-
6307 http_url(_In_ const std::locale& locale = std::locale()) :
-
6308 parser(locale),
-
6309 port(locale)
-
6310 {}
-
6311
-
6312 virtual void invalidate()
-
6313 {
-
6314 server.invalidate();
-
6315 port.invalidate();
-
6316 path.invalidate();
-
6317 params.clear();
-
6318 parser::invalidate();
-
6319 }
-
6320
-
6321 http_url_server server;
-
6322 http_url_port port;
-
6323 http_url_path path;
-
6324 std::list<http_url_parameter> params;
-
6325
-
6326 protected:
-
6327 virtual bool do_match(
-
6328 _In_reads_or_z_(end) const char* text,
-
6329 _In_ size_t start = 0,
-
6330 _In_ size_t end = SIZE_MAX,
-
6331 _In_ int flags = match_default)
-
6332 {
-
6333 _Assume_(text || start >= end);
-
6334 this->interval.end = start;
-
6335
-
6336 if (this->interval.end + 7 <= end && stdex::strnicmp(text + this->interval.end, 7, "http://", SIZE_MAX, m_locale) == 0) {
-
6337 this->interval.end += 7;
-
6338 if (server.match(text, this->interval.end, end, flags))
-
6339 this->interval.end = server.interval.end;
-
6340 else
-
6341 goto error;
-
6342 if (this->interval.end < end && text[this->interval.end] == ':') {
-
6343 this->interval.end++;
-
6344 if (port.match(text, this->interval.end, end, flags))
-
6345 this->interval.end = port.interval.end;
-
6346 }
-
6347 else {
-
6348 port.invalidate();
-
6349 port.value = 80;
-
6350 }
-
6351 }
-
6352 else {
-
6353 server.invalidate();
-
6354 port.invalidate();
-
6355 port.value = 80;
-
6356 }
-
6357
-
6358 if (path.match(text, this->interval.end, end, flags))
-
6359 this->interval.end = path.interval.end;
-
6360 else
-
6361 goto error;
-
6362
-
6363 params.clear();
-
6364
-
6365 if (this->interval.end < end && text[this->interval.end] == '?') {
-
6366 this->interval.end++;
-
6367 for (;;) {
-
6368 if (this->interval.end < end && text[this->interval.end]) {
-
6369 if ((unsigned int)text[this->interval.end] < 0x20 ||
-
6370 (unsigned int)text[this->interval.end] == 0x7f ||
-
6371 stdex::isspace(text[this->interval.end]))
-
6372 break;
-
6373 else if (text[this->interval.end] == '&')
-
6374 this->interval.end++;
-
6375 else {
-
6376 http_url_parameter param;
-
6377 if (param.match(text, this->interval.end, end, flags)) {
-
6378 this->interval.end = param.interval.end;
-
6379 params.push_back(std::move(param));
-
6380 }
-
6381 else
-
6382 break;
-
6383 }
-
6384 }
-
6385 else
-
6386 break;
-
6387 }
-
6388 }
-
6389
-
6390 this->interval.start = start;
-
6391 return true;
-
6392
-
6393 error:
-
6394 invalidate();
-
6395 return false;
-
6396 }
-
6397 };
+
6301
+
+
6305 class http_url : public parser
+
6306 {
+
6307 public:
+
6308 http_url(_In_ const std::locale& locale = std::locale()) :
+
6309 parser(locale),
+
6310 port(locale)
+
6311 {}
+
6312
+
6313 virtual void invalidate()
+
6314 {
+
6315 server.invalidate();
+
6316 port.invalidate();
+
6317 path.invalidate();
+
6318 params.clear();
+
6319 parser::invalidate();
+
6320 }
+
6321
+
6322 http_url_server server;
+
6323 http_url_port port;
+
6324 http_url_path path;
+
6325 std::list<http_url_parameter> params;
+
6326
+
6327 protected:
+
6328 virtual bool do_match(
+
6329 _In_reads_or_z_(end) const char* text,
+
6330 _In_ size_t start = 0,
+
6331 _In_ size_t end = SIZE_MAX,
+
6332 _In_ int flags = match_default)
+
6333 {
+
6334 _Assume_(text || start >= end);
+
6335 this->interval.end = start;
+
6336
+
6337 if (this->interval.end + 7 <= end && stdex::strnicmp(text + this->interval.end, 7, "http://", SIZE_MAX, m_locale) == 0) {
+
6338 this->interval.end += 7;
+
6339 if (server.match(text, this->interval.end, end, flags))
+
6340 this->interval.end = server.interval.end;
+
6341 else
+
6342 goto error;
+
6343 if (this->interval.end < end && text[this->interval.end] == ':') {
+
6344 this->interval.end++;
+
6345 if (port.match(text, this->interval.end, end, flags))
+
6346 this->interval.end = port.interval.end;
+
6347 }
+
6348 else {
+
6349 port.invalidate();
+
6350 port.value = 80;
+
6351 }
+
6352 }
+
6353 else {
+
6354 server.invalidate();
+
6355 port.invalidate();
+
6356 port.value = 80;
+
6357 }
+
6358
+
6359 if (path.match(text, this->interval.end, end, flags))
+
6360 this->interval.end = path.interval.end;
+
6361 else
+
6362 goto error;
+
6363
+
6364 params.clear();
+
6365
+
6366 if (this->interval.end < end && text[this->interval.end] == '?') {
+
6367 this->interval.end++;
+
6368 for (;;) {
+
6369 if (this->interval.end < end && text[this->interval.end]) {
+
6370 if ((unsigned int)text[this->interval.end] < 0x20 ||
+
6371 (unsigned int)text[this->interval.end] == 0x7f ||
+
6372 stdex::isspace(text[this->interval.end]))
+
6373 break;
+
6374 else if (text[this->interval.end] == '&')
+
6375 this->interval.end++;
+
6376 else {
+
6377 http_url_parameter param;
+
6378 if (param.match(text, this->interval.end, end, flags)) {
+
6379 this->interval.end = param.interval.end;
+
6380 params.push_back(std::move(param));
+
6381 }
+
6382 else
+
6383 break;
+
6384 }
+
6385 }
+
6386 else
+
6387 break;
+
6388 }
+
6389 }
+
6390
+
6391 this->interval.start = start;
+
6392 return true;
+
6393
+
6394 error:
+
6395 invalidate();
+
6396 return false;
+
6397 }
+
6398 };
-
6398
-
-
6402 class http_language : public parser
-
6403 {
-
6404 public:
-
6405 virtual void invalidate()
-
6406 {
-
6407 components.clear();
-
6408 parser::invalidate();
-
6409 }
-
6410
-
6411 std::vector<stdex::interval<size_t>> components;
-
6412
-
6413 protected:
-
6414 virtual bool do_match(
-
6415 _In_reads_or_z_(end) const char* text,
-
6416 _In_ size_t start = 0,
-
6417 _In_ size_t end = SIZE_MAX,
-
6418 _In_ int flags = match_default)
-
6419 {
-
6420 _Assume_(text || start >= end);
-
6421 this->interval.end = start;
-
6422 components.clear();
-
6423 for (;;) {
-
6424 if (this->interval.end < end && text[this->interval.end]) {
- -
6426 k.end = this->interval.end;
-
6427 for (;;) {
-
6428 if (k.end < end && text[k.end]) {
-
6429 if (stdex::isalpha(text[k.end]))
-
6430 k.end++;
-
6431 else
-
6432 break;
-
6433 }
-
6434 else
-
6435 break;
-
6436 }
-
6437 if (this->interval.end < k.end) {
-
6438 k.start = this->interval.end;
-
6439 this->interval.end = k.end;
-
6440 components.push_back(k);
-
6441 }
-
6442 else
-
6443 break;
-
6444 if (this->interval.end < end && text[this->interval.end] == '-')
-
6445 this->interval.end++;
-
6446 else
-
6447 break;
-
6448 }
-
6449 else
-
6450 break;
-
6451 }
-
6452 if (!components.empty()) {
-
6453 this->interval.start = start;
-
6454 this->interval.end = components.back().end;
-
6455 return true;
-
6456 }
-
6457 this->interval.invalidate();
-
6458 return false;
-
6459 }
-
6460 };
+
6399
+
+
6403 class http_language : public parser
+
6404 {
+
6405 public:
+
6406 virtual void invalidate()
+
6407 {
+
6408 components.clear();
+
6409 parser::invalidate();
+
6410 }
+
6411
+
6412 std::vector<stdex::interval<size_t>> components;
+
6413
+
6414 protected:
+
6415 virtual bool do_match(
+
6416 _In_reads_or_z_(end) const char* text,
+
6417 _In_ size_t start = 0,
+
6418 _In_ size_t end = SIZE_MAX,
+
6419 _In_ int flags = match_default)
+
6420 {
+
6421 _Assume_(text || start >= end);
+
6422 this->interval.end = start;
+
6423 components.clear();
+
6424 for (;;) {
+
6425 if (this->interval.end < end && text[this->interval.end]) {
+ +
6427 k.end = this->interval.end;
+
6428 for (;;) {
+
6429 if (k.end < end && text[k.end]) {
+
6430 if (stdex::isalpha(text[k.end]))
+
6431 k.end++;
+
6432 else
+
6433 break;
+
6434 }
+
6435 else
+
6436 break;
+
6437 }
+
6438 if (this->interval.end < k.end) {
+
6439 k.start = this->interval.end;
+
6440 this->interval.end = k.end;
+
6441 components.push_back(k);
+
6442 }
+
6443 else
+
6444 break;
+
6445 if (this->interval.end < end && text[this->interval.end] == '-')
+
6446 this->interval.end++;
+
6447 else
+
6448 break;
+
6449 }
+
6450 else
+
6451 break;
+
6452 }
+
6453 if (!components.empty()) {
+
6454 this->interval.start = start;
+
6455 this->interval.end = components.back().end;
+
6456 return true;
+
6457 }
+
6458 this->interval.invalidate();
+
6459 return false;
+
6460 }
+
6461 };
-
6461
-
-
6465 class http_weight : public parser
-
6466 {
-
6467 public:
-
6468 http_weight(_In_ const std::locale& locale = std::locale()) :
-
6469 parser(locale),
-
6470 value(1.0f)
-
6471 {}
-
6472
-
6473 virtual void invalidate()
-
6474 {
-
6475 value = 1.0f;
-
6476 parser::invalidate();
-
6477 }
-
6478
-
6479 float value;
-
6480
-
6481 protected:
-
6482 virtual bool do_match(
-
6483 _In_reads_or_z_(end) const char* text,
-
6484 _In_ size_t start = 0,
-
6485 _In_ size_t end = SIZE_MAX,
-
6486 _In_ int flags = match_default)
-
6487 {
-
6488 _Assume_(text || start >= end);
-
6489 size_t celi_del = 0, decimalni_del = 0, decimalni_del_n = 1;
-
6490 this->interval.end = start;
-
6491 for (;;) {
-
6492 if (this->interval.end < end && text[this->interval.end]) {
-
6493 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
-
6494 celi_del = celi_del * 10 + static_cast<size_t>(text[this->interval.end] - '0');
-
6495 this->interval.end++;
-
6496 }
-
6497 else if (text[this->interval.end] == '.') {
-
6498 this->interval.end++;
-
6499 for (;;) {
-
6500 if (this->interval.end < end && text[this->interval.end]) {
-
6501 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
-
6502 decimalni_del = decimalni_del * 10 + static_cast<size_t>(text[this->interval.end] - '0');
-
6503 decimalni_del_n *= 10;
-
6504 this->interval.end++;
-
6505 }
-
6506 else
-
6507 break;
-
6508 }
-
6509 else
-
6510 break;
-
6511 }
-
6512 break;
-
6513 }
-
6514 else
-
6515 break;
-
6516 }
-
6517 else
-
6518 break;
-
6519 }
- - -
6522 this->interval.start = start;
-
6523 return true;
-
6524 }
-
6525 value = 1.0f;
-
6526 this->interval.invalidate();
-
6527 return false;
-
6528 }
-
6529 };
+
6462
+
+
6466 class http_weight : public parser
+
6467 {
+
6468 public:
+
6469 http_weight(_In_ const std::locale& locale = std::locale()) :
+
6470 parser(locale),
+
6471 value(1.0f)
+
6472 {}
+
6473
+
6474 virtual void invalidate()
+
6475 {
+
6476 value = 1.0f;
+
6477 parser::invalidate();
+
6478 }
+
6479
+
6480 float value;
+
6481
+
6482 protected:
+
6483 virtual bool do_match(
+
6484 _In_reads_or_z_(end) const char* text,
+
6485 _In_ size_t start = 0,
+
6486 _In_ size_t end = SIZE_MAX,
+
6487 _In_ int flags = match_default)
+
6488 {
+
6489 _Assume_(text || start >= end);
+
6490 size_t celi_del = 0, decimalni_del = 0, decimalni_del_n = 1;
+
6491 this->interval.end = start;
+
6492 for (;;) {
+
6493 if (this->interval.end < end && text[this->interval.end]) {
+
6494 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
+
6495 celi_del = celi_del * 10 + static_cast<size_t>(text[this->interval.end] - '0');
+
6496 this->interval.end++;
+
6497 }
+
6498 else if (text[this->interval.end] == '.') {
+
6499 this->interval.end++;
+
6500 for (;;) {
+
6501 if (this->interval.end < end && text[this->interval.end]) {
+
6502 if ('0' <= text[this->interval.end] && text[this->interval.end] <= '9') {
+
6503 decimalni_del = decimalni_del * 10 + static_cast<size_t>(text[this->interval.end] - '0');
+
6504 decimalni_del_n *= 10;
+
6505 this->interval.end++;
+
6506 }
+
6507 else
+
6508 break;
+
6509 }
+
6510 else
+
6511 break;
+
6512 }
+
6513 break;
+
6514 }
+
6515 else
+
6516 break;
+
6517 }
+
6518 else
+
6519 break;
+
6520 }
+ + +
6523 this->interval.start = start;
+
6524 return true;
+
6525 }
+
6526 value = 1.0f;
+
6527 this->interval.invalidate();
+
6528 return false;
+
6529 }
+
6530 };
-
6530
-
-
6534 class http_asterisk : public parser
-
6535 {
-
6536 protected:
-
6537 virtual bool do_match(
-
6538 _In_reads_or_z_(end) const char* text,
-
6539 _In_ size_t start = 0,
-
6540 _In_ size_t end = SIZE_MAX,
-
6541 _In_ int flags = match_default)
-
6542 {
-
6543 _Assume_(text || end <= start);
-
6544 if (start < end && text[start] == '*') {
-
6545 this->interval.end = (this->interval.start = start) + 1;
-
6546 return true;
-
6547 }
-
6548 this->interval.invalidate();
-
6549 return false;
-
6550 }
-
6551 };
+
6531
+
+
6535 class http_asterisk : public parser
+
6536 {
+
6537 protected:
+
6538 virtual bool do_match(
+
6539 _In_reads_or_z_(end) const char* text,
+
6540 _In_ size_t start = 0,
+
6541 _In_ size_t end = SIZE_MAX,
+
6542 _In_ int flags = match_default)
+
6543 {
+
6544 _Assume_(text || end <= start);
+
6545 if (start < end && text[start] == '*') {
+
6546 this->interval.end = (this->interval.start = start) + 1;
+
6547 return true;
+
6548 }
+
6549 this->interval.invalidate();
+
6550 return false;
+
6551 }
+
6552 };
-
6552
-
6556 template <class T, class T_asterisk = http_asterisk>
-
- -
6558 {
-
6559 public:
-
6560 http_weighted_value(_In_ const std::locale& locale = std::locale()) :
-
6561 parser(locale),
-
6562 factor(locale)
-
6563 {}
-
6564
-
6565 virtual void invalidate()
-
6566 {
-
6567 asterisk.invalidate();
-
6568 value.invalidate();
-
6569 factor.invalidate();
-
6570 parser::invalidate();
-
6571 }
-
6572
-
6573 T_asterisk asterisk;
-
6574 T value;
-
6575 http_weight factor;
-
6576
-
6577 protected:
-
6578 virtual bool do_match(
-
6579 _In_reads_or_z_(end) const char* text,
-
6580 _In_ size_t start = 0,
-
6581 _In_ size_t end = SIZE_MAX,
-
6582 _In_ int flags = match_default)
-
6583 {
-
6584 _Assume_(text || start >= end);
-
6585 size_t konec_vrednosti;
-
6586 this->interval.end = start;
-
6587 if (asterisk.match(text, this->interval.end, end, flags)) {
-
6588 this->interval.end = konec_vrednosti = asterisk.interval.end;
-
6589 value.invalidate();
-
6590 }
-
6591 else if (value.match(text, this->interval.end, end, flags)) {
-
6592 this->interval.end = konec_vrednosti = value.interval.end;
-
6593 asterisk.invalidate();
-
6594 }
-
6595 else {
-
6596 asterisk.invalidate();
-
6597 value.invalidate();
-
6598 this->interval.invalidate();
-
6599 return false;
-
6600 }
-
6601
-
6602 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
-
6603 if (this->interval.end < end && text[this->interval.end] == ';') {
-
6604 this->interval.end++;
-
6605 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
-
6606 if (this->interval.end < end && (text[this->interval.end] == 'q' || text[this->interval.end] == 'Q')) {
-
6607 this->interval.end++;
-
6608 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
-
6609 if (this->interval.end < end && text[this->interval.end] == '=') {
-
6610 this->interval.end++;
-
6611 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
-
6612 if (factor.match(text, this->interval.end, end, flags))
-
6613 this->interval.end = factor.interval.end;
-
6614 }
-
6615 }
-
6616 }
-
6617 if (!factor.interval) {
-
6618 factor.invalidate();
-
6619 this->interval.end = konec_vrednosti;
-
6620 }
-
6621 this->interval.start = start;
-
6622 return true;
-
6623 }
-
6624 };
+
6553
+
6557 template <class T, class T_asterisk = http_asterisk>
+
+ +
6559 {
+
6560 public:
+
6561 http_weighted_value(_In_ const std::locale& locale = std::locale()) :
+
6562 parser(locale),
+
6563 factor(locale)
+
6564 {}
+
6565
+
6566 virtual void invalidate()
+
6567 {
+
6568 asterisk.invalidate();
+
6569 value.invalidate();
+
6570 factor.invalidate();
+
6571 parser::invalidate();
+
6572 }
+
6573
+
6574 T_asterisk asterisk;
+
6575 T value;
+
6576 http_weight factor;
+
6577
+
6578 protected:
+
6579 virtual bool do_match(
+
6580 _In_reads_or_z_(end) const char* text,
+
6581 _In_ size_t start = 0,
+
6582 _In_ size_t end = SIZE_MAX,
+
6583 _In_ int flags = match_default)
+
6584 {
+
6585 _Assume_(text || start >= end);
+
6586 size_t konec_vrednosti;
+
6587 this->interval.end = start;
+
6588 if (asterisk.match(text, this->interval.end, end, flags)) {
+
6589 this->interval.end = konec_vrednosti = asterisk.interval.end;
+
6590 value.invalidate();
+
6591 }
+
6592 else if (value.match(text, this->interval.end, end, flags)) {
+
6593 this->interval.end = konec_vrednosti = value.interval.end;
+
6594 asterisk.invalidate();
+
6595 }
+
6596 else {
+
6597 asterisk.invalidate();
+
6598 value.invalidate();
+
6599 this->interval.invalidate();
+
6600 return false;
+
6601 }
+
6602
+
6603 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
+
6604 if (this->interval.end < end && text[this->interval.end] == ';') {
+
6605 this->interval.end++;
+
6606 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
+
6607 if (this->interval.end < end && (text[this->interval.end] == 'q' || text[this->interval.end] == 'Q')) {
+
6608 this->interval.end++;
+
6609 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
+
6610 if (this->interval.end < end && text[this->interval.end] == '=') {
+
6611 this->interval.end++;
+
6612 while (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])) this->interval.end++;
+
6613 if (factor.match(text, this->interval.end, end, flags))
+
6614 this->interval.end = factor.interval.end;
+
6615 }
+
6616 }
+
6617 }
+
6618 if (!factor.interval) {
+
6619 factor.invalidate();
+
6620 this->interval.end = konec_vrednosti;
+
6621 }
+
6622 this->interval.start = start;
+
6623 return true;
+
6624 }
+
6625 };
-
6625
-
- -
6630 {
-
6631 public:
-
6632 virtual void invalidate()
-
6633 {
-
6634 name.invalidate();
-
6635 value.invalidate();
-
6636 parser::invalidate();
-
6637 }
-
6638
-
6639 http_token name;
-
6640 http_value value;
-
6641
-
6642 protected:
-
6643 virtual bool do_match(
-
6644 _In_reads_or_z_(end) const char* text,
-
6645 _In_ size_t start = 0,
-
6646 _In_ size_t end = SIZE_MAX,
-
6647 _In_ int flags = match_default)
-
6648 {
-
6649 _Assume_(text || start >= end);
-
6650 this->interval.end = start;
-
6651 if (this->interval.end < end && text[this->interval.end] == '$')
-
6652 this->interval.end++;
-
6653 else
-
6654 goto error;
-
6655 if (name.match(text, this->interval.end, end, flags))
-
6656 this->interval.end = name.interval.end;
-
6657 else
-
6658 goto error;
-
6659 while (m_space.match(text, this->interval.end, end, flags))
-
6660 this->interval.end = m_space.interval.end;
-
6661 if (this->interval.end < end && text[this->interval.end] == '=')
-
6662 this->interval.end++;
-
6663 else
-
6664 goto error;
-
6665 while (m_space.match(text, this->interval.end, end, flags))
-
6666 this->interval.end = m_space.interval.end;
-
6667 if (value.match(text, this->interval.end, end, flags))
-
6668 this->interval.end = value.interval.end;
-
6669 else
-
6670 goto error;
-
6671 this->interval.start = start;
-
6672 return true;
-
6673
-
6674 error:
-
6675 invalidate();
-
6676 return false;
-
6677 }
-
6678
-
6679 http_space m_space;
-
6680 };
+
6626
+
+ +
6631 {
+
6632 public:
+
6633 virtual void invalidate()
+
6634 {
+
6635 name.invalidate();
+
6636 value.invalidate();
+
6637 parser::invalidate();
+
6638 }
+
6639
+
6640 http_token name;
+
6641 http_value value;
+
6642
+
6643 protected:
+
6644 virtual bool do_match(
+
6645 _In_reads_or_z_(end) const char* text,
+
6646 _In_ size_t start = 0,
+
6647 _In_ size_t end = SIZE_MAX,
+
6648 _In_ int flags = match_default)
+
6649 {
+
6650 _Assume_(text || start >= end);
+
6651 this->interval.end = start;
+
6652 if (this->interval.end < end && text[this->interval.end] == '$')
+
6653 this->interval.end++;
+
6654 else
+
6655 goto error;
+
6656 if (name.match(text, this->interval.end, end, flags))
+
6657 this->interval.end = name.interval.end;
+
6658 else
+
6659 goto error;
+
6660 while (m_space.match(text, this->interval.end, end, flags))
+
6661 this->interval.end = m_space.interval.end;
+
6662 if (this->interval.end < end && text[this->interval.end] == '=')
+
6663 this->interval.end++;
+
6664 else
+
6665 goto error;
+
6666 while (m_space.match(text, this->interval.end, end, flags))
+
6667 this->interval.end = m_space.interval.end;
+
6668 if (value.match(text, this->interval.end, end, flags))
+
6669 this->interval.end = value.interval.end;
+
6670 else
+
6671 goto error;
+
6672 this->interval.start = start;
+
6673 return true;
+
6674
+
6675 error:
+
6676 invalidate();
+
6677 return false;
+
6678 }
+
6679
+
6680 http_space m_space;
+
6681 };
-
6681
-
-
6685 class http_cookie : public parser
-
6686 {
-
6687 public:
-
6688 virtual void invalidate()
-
6689 {
-
6690 name.invalidate();
-
6691 value.invalidate();
-
6692 params.clear();
-
6693 parser::invalidate();
-
6694 }
-
6695
- - -
6698 std::list<http_cookie_parameter> params;
-
6699
-
6700 protected:
-
6701 virtual bool do_match(
-
6702 _In_reads_or_z_(end) const char* text,
-
6703 _In_ size_t start = 0,
-
6704 _In_ size_t end = SIZE_MAX,
-
6705 _In_ int flags = match_default)
-
6706 {
-
6707 _Assume_(text || start >= end);
-
6708 this->interval.end = start;
-
6709 if (name.match(text, this->interval.end, end, flags))
-
6710 this->interval.end = name.interval.end;
-
6711 else
-
6712 goto error;
-
6713 while (m_space.match(text, this->interval.end, end, flags))
-
6714 this->interval.end = m_space.interval.end;
-
6715 if (this->interval.end < end && text[this->interval.end] == '=')
-
6716 this->interval.end++;
-
6717 else
-
6718 goto error;
-
6719 while (m_space.match(text, this->interval.end, end, flags))
-
6720 this->interval.end = m_space.interval.end;
-
6721 if (value.match(text, this->interval.end, end, flags))
-
6722 this->interval.end = value.interval.end;
-
6723 else
-
6724 goto error;
-
6725 params.clear();
-
6726 for (;;) {
-
6727 if (this->interval.end < end && text[this->interval.end]) {
-
6728 if (m_space.match(text, this->interval.end, end, flags))
-
6729 this->interval.end = m_space.interval.end;
-
6730 else if (text[this->interval.end] == ';') {
-
6731 this->interval.end++;
-
6732 while (m_space.match(text, this->interval.end, end, flags))
-
6733 this->interval.end = m_space.interval.end;
- -
6735 if (param.match(text, this->interval.end, end, flags)) {
-
6736 this->interval.end = param.interval.end;
-
6737 params.push_back(std::move(param));
-
6738 }
-
6739 else
-
6740 break;
-
6741 }
-
6742 else
-
6743 break;
-
6744 }
-
6745 else
-
6746 break;
-
6747 }
-
6748 this->interval.start = start;
-
6749 this->interval.end = params.empty() ? value.interval.end : params.back().interval.end;
-
6750 return true;
-
6751
-
6752 error:
-
6753 invalidate();
-
6754 return false;
-
6755 }
-
6756
-
6757 http_space m_space;
-
6758 };
+
6682
+
+
6686 class http_cookie : public parser
+
6687 {
+
6688 public:
+
6689 virtual void invalidate()
+
6690 {
+
6691 name.invalidate();
+
6692 value.invalidate();
+
6693 params.clear();
+
6694 parser::invalidate();
+
6695 }
+
6696
+ + +
6699 std::list<http_cookie_parameter> params;
+
6700
+
6701 protected:
+
6702 virtual bool do_match(
+
6703 _In_reads_or_z_(end) const char* text,
+
6704 _In_ size_t start = 0,
+
6705 _In_ size_t end = SIZE_MAX,
+
6706 _In_ int flags = match_default)
+
6707 {
+
6708 _Assume_(text || start >= end);
+
6709 this->interval.end = start;
+
6710 if (name.match(text, this->interval.end, end, flags))
+
6711 this->interval.end = name.interval.end;
+
6712 else
+
6713 goto error;
+
6714 while (m_space.match(text, this->interval.end, end, flags))
+
6715 this->interval.end = m_space.interval.end;
+
6716 if (this->interval.end < end && text[this->interval.end] == '=')
+
6717 this->interval.end++;
+
6718 else
+
6719 goto error;
+
6720 while (m_space.match(text, this->interval.end, end, flags))
+
6721 this->interval.end = m_space.interval.end;
+
6722 if (value.match(text, this->interval.end, end, flags))
+
6723 this->interval.end = value.interval.end;
+
6724 else
+
6725 goto error;
+
6726 params.clear();
+
6727 for (;;) {
+
6728 if (this->interval.end < end && text[this->interval.end]) {
+
6729 if (m_space.match(text, this->interval.end, end, flags))
+
6730 this->interval.end = m_space.interval.end;
+
6731 else if (text[this->interval.end] == ';') {
+
6732 this->interval.end++;
+
6733 while (m_space.match(text, this->interval.end, end, flags))
+
6734 this->interval.end = m_space.interval.end;
+ +
6736 if (param.match(text, this->interval.end, end, flags)) {
+
6737 this->interval.end = param.interval.end;
+
6738 params.push_back(std::move(param));
+
6739 }
+
6740 else
+
6741 break;
+
6742 }
+
6743 else
+
6744 break;
+
6745 }
+
6746 else
+
6747 break;
+
6748 }
+
6749 this->interval.start = start;
+
6750 this->interval.end = params.empty() ? value.interval.end : params.back().interval.end;
+
6751 return true;
+
6752
+
6753 error:
+
6754 invalidate();
+
6755 return false;
+
6756 }
+
6757
+
6758 http_space m_space;
+
6759 };
-
6759
-
-
6763 class http_agent : public parser
-
6764 {
-
6765 public:
-
6766 virtual void invalidate()
-
6767 {
-
6768 type.start = 1;
-
6769 type.end = 0;
-
6770 version.start = 1;
-
6771 version.end = 0;
-
6772 parser::invalidate();
-
6773 }
-
6774
- - -
6777
-
6778 protected:
-
6779 virtual bool do_match(
-
6780 _In_reads_or_z_(end) const char* text,
-
6781 _In_ size_t start = 0,
-
6782 _In_ size_t end = SIZE_MAX,
-
6783 _In_ int flags = match_default)
-
6784 {
-
6785 _Assume_(text || start >= end);
-
6786 this->interval.end = start;
-
6787 type.start = this->interval.end;
-
6788 for (;;) {
-
6789 if (this->interval.end < end && text[this->interval.end]) {
-
6790 if (text[this->interval.end] == '/') {
-
6791 type.end = this->interval.end;
-
6792 this->interval.end++;
-
6793 version.start = this->interval.end;
-
6794 for (;;) {
-
6795 if (this->interval.end < end && text[this->interval.end]) {
-
6796 if (stdex::isspace(text[this->interval.end])) {
-
6797 version.end = this->interval.end;
-
6798 break;
-
6799 }
-
6800 else
-
6801 this->interval.end++;
-
6802 }
-
6803 else {
-
6804 version.end = this->interval.end;
-
6805 break;
-
6806 }
-
6807 }
-
6808 break;
-
6809 }
-
6810 else if (stdex::isspace(text[this->interval.end])) {
-
6811 type.end = this->interval.end;
-
6812 break;
-
6813 }
-
6814 else
-
6815 this->interval.end++;
-
6816 }
-
6817 else {
-
6818 type.end = this->interval.end;
-
6819 break;
-
6820 }
-
6821 }
- -
6823 this->interval.start = start;
-
6824 return true;
-
6825 }
-
6826 type.start = 1;
-
6827 type.end = 0;
-
6828 version.start = 1;
-
6829 version.end = 0;
-
6830 this->interval.invalidate();
-
6831 return false;
-
6832 }
-
6833 };
+
6760
+
+
6764 class http_agent : public parser
+
6765 {
+
6766 public:
+
6767 virtual void invalidate()
+
6768 {
+
6769 type.start = 1;
+
6770 type.end = 0;
+
6771 version.start = 1;
+
6772 version.end = 0;
+
6773 parser::invalidate();
+
6774 }
+
6775
+ + +
6778
+
6779 protected:
+
6780 virtual bool do_match(
+
6781 _In_reads_or_z_(end) const char* text,
+
6782 _In_ size_t start = 0,
+
6783 _In_ size_t end = SIZE_MAX,
+
6784 _In_ int flags = match_default)
+
6785 {
+
6786 _Assume_(text || start >= end);
+
6787 this->interval.end = start;
+
6788 type.start = this->interval.end;
+
6789 for (;;) {
+
6790 if (this->interval.end < end && text[this->interval.end]) {
+
6791 if (text[this->interval.end] == '/') {
+
6792 type.end = this->interval.end;
+
6793 this->interval.end++;
+
6794 version.start = this->interval.end;
+
6795 for (;;) {
+
6796 if (this->interval.end < end && text[this->interval.end]) {
+
6797 if (stdex::isspace(text[this->interval.end])) {
+
6798 version.end = this->interval.end;
+
6799 break;
+
6800 }
+
6801 else
+
6802 this->interval.end++;
+
6803 }
+
6804 else {
+
6805 version.end = this->interval.end;
+
6806 break;
+
6807 }
+
6808 }
+
6809 break;
+
6810 }
+
6811 else if (stdex::isspace(text[this->interval.end])) {
+
6812 type.end = this->interval.end;
+
6813 break;
+
6814 }
+
6815 else
+
6816 this->interval.end++;
+
6817 }
+
6818 else {
+
6819 type.end = this->interval.end;
+
6820 break;
+
6821 }
+
6822 }
+ +
6824 this->interval.start = start;
+
6825 return true;
+
6826 }
+
6827 type.start = 1;
+
6828 type.end = 0;
+
6829 version.start = 1;
+
6830 version.end = 0;
+
6831 this->interval.invalidate();
+
6832 return false;
+
6833 }
+
6834 };
-
6834
-
-
6838 class http_protocol : public parser
-
6839 {
-
6840 public:
-
6841 http_protocol(_In_ const std::locale& locale = std::locale()) :
-
6842 parser(locale),
-
6843 version(0x009)
-
6844 {}
-
6845
-
6846 virtual void invalidate()
-
6847 {
-
6848 type.start = 1;
-
6849 type.end = 0;
-
6850 version_maj.start = 1;
-
6851 version_maj.end = 0;
-
6852 version_min.start = 1;
-
6853 version_min.end = 0;
-
6854 version = 0x009;
-
6855 parser::invalidate();
-
6856 }
-
6857
- -
6859 stdex::interval<size_t> version_maj;
-
6860 stdex::interval<size_t> version_min;
- -
6862
-
6863 protected:
-
6864 virtual bool do_match(
-
6865 _In_reads_or_z_(end) const char* text,
-
6866 _In_ size_t start = 0,
-
6867 _In_ size_t end = SIZE_MAX,
-
6868 _In_ int flags = match_default)
-
6869 {
-
6870 _Assume_(text || start >= end);
-
6871 this->interval.end = start;
-
6872 type.start = this->interval.end;
-
6873 for (;;) {
-
6874 if (this->interval.end < end && text[this->interval.end]) {
-
6875 if (text[this->interval.end] == '/') {
-
6876 type.end = this->interval.end;
-
6877 this->interval.end++;
-
6878 break;
-
6879 }
-
6880 else if (stdex::isspace(text[this->interval.end]))
-
6881 goto error;
-
6882 else
-
6883 this->interval.end++;
-
6884 }
-
6885 else {
-
6886 type.end = this->interval.end;
-
6887 goto error;
-
6888 }
-
6889 }
-
6890 version_maj.start = this->interval.end;
-
6891 for (;;) {
-
6892 if (this->interval.end < end && text[this->interval.end]) {
-
6893 if (text[this->interval.end] == '.') {
-
6894 version_maj.end = this->interval.end;
-
6895 this->interval.end++;
-
6896 version_min.start = this->interval.end;
-
6897 for (;;) {
-
6898 if (this->interval.end < end && text[this->interval.end]) {
-
6899 if (stdex::isspace(text[this->interval.end])) {
-
6900 version_min.end = this->interval.end;
-
6901 version =
-
6902 (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100 +
-
6903 (uint16_t)strtoui(text + version_min.start, version_min.size(), nullptr, 10);
-
6904 break;
-
6905 }
-
6906 else
-
6907 this->interval.end++;
-
6908 }
-
6909 else
-
6910 goto error;
-
6911 }
-
6912 break;
-
6913 }
-
6914 else if (stdex::isspace(text[this->interval.end])) {
-
6915 version_maj.end = this->interval.end;
-
6916 version_min.start = 1;
-
6917 version_min.end = 0;
-
6918 version = (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100;
-
6919 break;
-
6920 }
-
6921 else
-
6922 this->interval.end++;
-
6923 }
-
6924 else
-
6925 goto error;
-
6926 }
-
6927 this->interval.start = start;
-
6928 return true;
-
6929
-
6930 error:
-
6931 invalidate();
-
6932 return false;
-
6933 }
-
6934 };
+
6835
+
+
6839 class http_protocol : public parser
+
6840 {
+
6841 public:
+
6842 http_protocol(_In_ const std::locale& locale = std::locale()) :
+
6843 parser(locale),
+
6844 version(0x009)
+
6845 {}
+
6846
+
6847 virtual void invalidate()
+
6848 {
+
6849 type.start = 1;
+
6850 type.end = 0;
+
6851 version_maj.start = 1;
+
6852 version_maj.end = 0;
+
6853 version_min.start = 1;
+
6854 version_min.end = 0;
+
6855 version = 0x009;
+
6856 parser::invalidate();
+
6857 }
+
6858
+ +
6860 stdex::interval<size_t> version_maj;
+
6861 stdex::interval<size_t> version_min;
+ +
6863
+
6864 protected:
+
6865 virtual bool do_match(
+
6866 _In_reads_or_z_(end) const char* text,
+
6867 _In_ size_t start = 0,
+
6868 _In_ size_t end = SIZE_MAX,
+
6869 _In_ int flags = match_default)
+
6870 {
+
6871 _Assume_(text || start >= end);
+
6872 this->interval.end = start;
+
6873 type.start = this->interval.end;
+
6874 for (;;) {
+
6875 if (this->interval.end < end && text[this->interval.end]) {
+
6876 if (text[this->interval.end] == '/') {
+
6877 type.end = this->interval.end;
+
6878 this->interval.end++;
+
6879 break;
+
6880 }
+
6881 else if (stdex::isspace(text[this->interval.end]))
+
6882 goto error;
+
6883 else
+
6884 this->interval.end++;
+
6885 }
+
6886 else {
+
6887 type.end = this->interval.end;
+
6888 goto error;
+
6889 }
+
6890 }
+
6891 version_maj.start = this->interval.end;
+
6892 for (;;) {
+
6893 if (this->interval.end < end && text[this->interval.end]) {
+
6894 if (text[this->interval.end] == '.') {
+
6895 version_maj.end = this->interval.end;
+
6896 this->interval.end++;
+
6897 version_min.start = this->interval.end;
+
6898 for (;;) {
+
6899 if (this->interval.end < end && text[this->interval.end]) {
+
6900 if (stdex::isspace(text[this->interval.end])) {
+
6901 version_min.end = this->interval.end;
+
6902 version =
+
6903 (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100 +
+
6904 (uint16_t)strtoui(text + version_min.start, version_min.size(), nullptr, 10);
+
6905 break;
+
6906 }
+
6907 else
+
6908 this->interval.end++;
+
6909 }
+
6910 else
+
6911 goto error;
+
6912 }
+
6913 break;
+
6914 }
+
6915 else if (stdex::isspace(text[this->interval.end])) {
+
6916 version_maj.end = this->interval.end;
+
6917 version_min.start = 1;
+
6918 version_min.end = 0;
+
6919 version = (uint16_t)strtoui(text + version_maj.start, version_maj.size(), nullptr, 10) * 0x100;
+
6920 break;
+
6921 }
+
6922 else
+
6923 this->interval.end++;
+
6924 }
+
6925 else
+
6926 goto error;
+
6927 }
+
6928 this->interval.start = start;
+
6929 return true;
+
6930
+
6931 error:
+
6932 invalidate();
+
6933 return false;
+
6934 }
+
6935 };
-
6935
-
-
6939 class http_request : public parser
-
6940 {
-
6941 public:
-
6942 http_request(_In_ const std::locale& locale = std::locale()) :
-
6943 parser(locale),
-
6944 url(locale),
-
6945 protocol(locale)
-
6946 {}
-
6947
-
6948 virtual void invalidate()
-
6949 {
-
6950 verb.start = 1;
-
6951 verb.end = 0;
-
6952 url.invalidate();
-
6953 protocol.invalidate();
-
6954 parser::invalidate();
-
6955 }
-
6956
- -
6958 http_url url;
-
6959 http_protocol protocol;
-
6960
-
6961 protected:
-
6962 virtual bool do_match(
-
6963 _In_reads_or_z_(end) const char* text,
-
6964 _In_ size_t start = 0,
-
6965 _In_ size_t end = SIZE_MAX,
-
6966 _In_ int flags = match_default)
-
6967 {
-
6968 _Assume_(text || start >= end);
-
6969 this->interval.end = start;
-
6970
-
6971 for (;;) {
-
6972 if (m_line_break.match(text, this->interval.end, end, flags))
-
6973 goto error;
-
6974 else if (this->interval.end < end && text[this->interval.end]) {
-
6975 if (stdex::isspace(text[this->interval.end]))
-
6976 this->interval.end++;
-
6977 else
-
6978 break;
-
6979 }
-
6980 else
-
6981 goto error;
-
6982 }
-
6983 verb.start = this->interval.end;
-
6984 for (;;) {
-
6985 if (m_line_break.match(text, this->interval.end, end, flags))
-
6986 goto error;
-
6987 else if (this->interval.end < end && text[this->interval.end]) {
-
6988 if (stdex::isspace(text[this->interval.end])) {
-
6989 verb.end = this->interval.end;
-
6990 this->interval.end++;
-
6991 break;
-
6992 }
-
6993 else
-
6994 this->interval.end++;
-
6995 }
-
6996 else
-
6997 goto error;
-
6998 }
-
6999
-
7000 for (;;) {
-
7001 if (m_line_break.match(text, this->interval.end, end, flags))
-
7002 goto error;
-
7003 else if (this->interval.end < end && text[this->interval.end]) {
-
7004 if (stdex::isspace(text[this->interval.end]))
-
7005 this->interval.end++;
-
7006 else
-
7007 break;
-
7008 }
-
7009 else
-
7010 goto error;
-
7011 }
-
7012 if (url.match(text, this->interval.end, end, flags))
-
7013 this->interval.end = url.interval.end;
-
7014 else
-
7015 goto error;
-
7016
-
7017 protocol.invalidate();
-
7018 for (;;) {
-
7019 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7020 this->interval.end = m_line_break.interval.end;
-
7021 goto end;
-
7022 }
-
7023 else if (this->interval.end < end && text[this->interval.end]) {
-
7024 if (stdex::isspace(text[this->interval.end]))
-
7025 this->interval.end++;
-
7026 else
-
7027 break;
-
7028 }
-
7029 else
-
7030 goto end;
-
7031 }
-
7032 for (;;) {
-
7033 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7034 this->interval.end = m_line_break.interval.end;
-
7035 goto end;
-
7036 }
-
7037 else if (protocol.match(text, this->interval.end, end, flags)) {
-
7038 this->interval.end = protocol.interval.end;
-
7039 break;
-
7040 }
-
7041 else
-
7042 goto end;
-
7043 }
-
7044
-
7045 for (;;) {
-
7046 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7047 this->interval.end = m_line_break.interval.end;
-
7048 break;
-
7049 }
-
7050 else if (this->interval.end < end && text[this->interval.end])
-
7051 this->interval.end++;
-
7052 else
-
7053 goto end;
-
7054 }
-
7055
-
7056 end:
-
7057 this->interval.start = start;
-
7058 return true;
-
7059
-
7060 error:
-
7061 invalidate();
-
7062 return false;
-
7063 }
-
7064
-
7065 http_line_break m_line_break;
-
7066 };
+
6936
+
+
6940 class http_request : public parser
+
6941 {
+
6942 public:
+
6943 http_request(_In_ const std::locale& locale = std::locale()) :
+
6944 parser(locale),
+
6945 url(locale),
+
6946 protocol(locale)
+
6947 {}
+
6948
+
6949 virtual void invalidate()
+
6950 {
+
6951 verb.start = 1;
+
6952 verb.end = 0;
+
6953 url.invalidate();
+
6954 protocol.invalidate();
+
6955 parser::invalidate();
+
6956 }
+
6957
+ +
6959 http_url url;
+
6960 http_protocol protocol;
+
6961
+
6962 protected:
+
6963 virtual bool do_match(
+
6964 _In_reads_or_z_(end) const char* text,
+
6965 _In_ size_t start = 0,
+
6966 _In_ size_t end = SIZE_MAX,
+
6967 _In_ int flags = match_default)
+
6968 {
+
6969 _Assume_(text || start >= end);
+
6970 this->interval.end = start;
+
6971
+
6972 for (;;) {
+
6973 if (m_line_break.match(text, this->interval.end, end, flags))
+
6974 goto error;
+
6975 else if (this->interval.end < end && text[this->interval.end]) {
+
6976 if (stdex::isspace(text[this->interval.end]))
+
6977 this->interval.end++;
+
6978 else
+
6979 break;
+
6980 }
+
6981 else
+
6982 goto error;
+
6983 }
+
6984 verb.start = this->interval.end;
+
6985 for (;;) {
+
6986 if (m_line_break.match(text, this->interval.end, end, flags))
+
6987 goto error;
+
6988 else if (this->interval.end < end && text[this->interval.end]) {
+
6989 if (stdex::isspace(text[this->interval.end])) {
+
6990 verb.end = this->interval.end;
+
6991 this->interval.end++;
+
6992 break;
+
6993 }
+
6994 else
+
6995 this->interval.end++;
+
6996 }
+
6997 else
+
6998 goto error;
+
6999 }
+
7000
+
7001 for (;;) {
+
7002 if (m_line_break.match(text, this->interval.end, end, flags))
+
7003 goto error;
+
7004 else if (this->interval.end < end && text[this->interval.end]) {
+
7005 if (stdex::isspace(text[this->interval.end]))
+
7006 this->interval.end++;
+
7007 else
+
7008 break;
+
7009 }
+
7010 else
+
7011 goto error;
+
7012 }
+
7013 if (url.match(text, this->interval.end, end, flags))
+
7014 this->interval.end = url.interval.end;
+
7015 else
+
7016 goto error;
+
7017
+
7018 protocol.invalidate();
+
7019 for (;;) {
+
7020 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7021 this->interval.end = m_line_break.interval.end;
+
7022 goto end;
+
7023 }
+
7024 else if (this->interval.end < end && text[this->interval.end]) {
+
7025 if (stdex::isspace(text[this->interval.end]))
+
7026 this->interval.end++;
+
7027 else
+
7028 break;
+
7029 }
+
7030 else
+
7031 goto end;
+
7032 }
+
7033 for (;;) {
+
7034 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7035 this->interval.end = m_line_break.interval.end;
+
7036 goto end;
+
7037 }
+
7038 else if (protocol.match(text, this->interval.end, end, flags)) {
+
7039 this->interval.end = protocol.interval.end;
+
7040 break;
+
7041 }
+
7042 else
+
7043 goto end;
+
7044 }
+
7045
+
7046 for (;;) {
+
7047 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7048 this->interval.end = m_line_break.interval.end;
+
7049 break;
+
7050 }
+
7051 else if (this->interval.end < end && text[this->interval.end])
+
7052 this->interval.end++;
+
7053 else
+
7054 goto end;
+
7055 }
+
7056
+
7057 end:
+
7058 this->interval.start = start;
+
7059 return true;
+
7060
+
7061 error:
+
7062 invalidate();
+
7063 return false;
+
7064 }
+
7065
+
7066 http_line_break m_line_break;
+
7067 };
-
7067
-
-
7071 class http_header : public parser
-
7072 {
-
7073 public:
-
7074 virtual void invalidate()
-
7075 {
-
7076 name.start = 1;
-
7077 name.end = 0;
-
7078 value.start = 1;
-
7079 value.end = 0;
-
7080 parser::invalidate();
-
7081 }
-
7082
- - -
7085
-
7086 protected:
-
7087 virtual bool do_match(
-
7088 _In_reads_or_z_(end) const char* text,
-
7089 _In_ size_t start = 0,
-
7090 _In_ size_t end = SIZE_MAX,
-
7091 _In_ int flags = match_default)
-
7092 {
-
7093 _Assume_(text || start >= end);
-
7094 this->interval.end = start;
-
7095
-
7096 if (m_line_break.match(text, this->interval.end, end, flags) ||
-
7097 (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])))
-
7098 goto error;
-
7099 name.start = this->interval.end;
-
7100 for (;;) {
-
7101 if (m_line_break.match(text, this->interval.end, end, flags))
-
7102 goto error;
-
7103 else if (this->interval.end < end && text[this->interval.end]) {
-
7104 if (stdex::isspace(text[this->interval.end])) {
-
7105 name.end = this->interval.end;
-
7106 this->interval.end++;
-
7107 for (;;) {
-
7108 if (m_line_break.match(text, this->interval.end, end, flags))
-
7109 goto error;
-
7110 else if (this->interval.end < end && text[this->interval.end]) {
-
7111 if (stdex::isspace(text[this->interval.end]))
-
7112 this->interval.end++;
-
7113 else
-
7114 break;
-
7115 }
-
7116 else
-
7117 goto error;
-
7118 }
-
7119 if (this->interval.end < end && text[this->interval.end] == ':') {
-
7120 this->interval.end++;
-
7121 break;
-
7122 }
-
7123 else
-
7124 goto error;
-
7125 break;
-
7126 }
-
7127 else if (text[this->interval.end] == ':') {
-
7128 name.end = this->interval.end;
-
7129 this->interval.end++;
-
7130 break;
-
7131 }
-
7132 else
-
7133 this->interval.end++;
-
7134 }
-
7135 else
-
7136 goto error;
-
7137 }
-
7138 value.start = SIZE_MAX;
-
7139 value.end = 0;
-
7140 for (;;) {
-
7141 if (m_line_break.match(text, this->interval.end, end, flags)) {
-
7142 this->interval.end = m_line_break.interval.end;
-
7143 if (!m_line_break.match(text, this->interval.end, end, flags) &&
-
7144 this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end]))
-
7145 this->interval.end++;
-
7146 else
-
7147 break;
-
7148 }
-
7149 else if (this->interval.end < end && text[this->interval.end]) {
-
7150 if (stdex::isspace(text[this->interval.end]))
-
7151 this->interval.end++;
-
7152 else {
-
7153 if (value.start == SIZE_MAX) value.start = this->interval.end;
-
7154 value.end = ++this->interval.end;
-
7155 }
-
7156 }
-
7157 else
-
7158 break;
-
7159 }
-
7160 this->interval.start = start;
-
7161 return true;
-
7162
-
7163 error:
-
7164 invalidate();
-
7165 return false;
-
7166 }
-
7167
-
7168 http_line_break m_line_break;
-
7169 };
+
7068
+
+
7072 class http_header : public parser
+
7073 {
+
7074 public:
+
7075 virtual void invalidate()
+
7076 {
+
7077 name.start = 1;
+
7078 name.end = 0;
+
7079 value.start = 1;
+
7080 value.end = 0;
+
7081 parser::invalidate();
+
7082 }
+
7083
+ + +
7086
+
7087 protected:
+
7088 virtual bool do_match(
+
7089 _In_reads_or_z_(end) const char* text,
+
7090 _In_ size_t start = 0,
+
7091 _In_ size_t end = SIZE_MAX,
+
7092 _In_ int flags = match_default)
+
7093 {
+
7094 _Assume_(text || start >= end);
+
7095 this->interval.end = start;
+
7096
+
7097 if (m_line_break.match(text, this->interval.end, end, flags) ||
+
7098 (this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end])))
+
7099 goto error;
+
7100 name.start = this->interval.end;
+
7101 for (;;) {
+
7102 if (m_line_break.match(text, this->interval.end, end, flags))
+
7103 goto error;
+
7104 else if (this->interval.end < end && text[this->interval.end]) {
+
7105 if (stdex::isspace(text[this->interval.end])) {
+
7106 name.end = this->interval.end;
+
7107 this->interval.end++;
+
7108 for (;;) {
+
7109 if (m_line_break.match(text, this->interval.end, end, flags))
+
7110 goto error;
+
7111 else if (this->interval.end < end && text[this->interval.end]) {
+
7112 if (stdex::isspace(text[this->interval.end]))
+
7113 this->interval.end++;
+
7114 else
+
7115 break;
+
7116 }
+
7117 else
+
7118 goto error;
+
7119 }
+
7120 if (this->interval.end < end && text[this->interval.end] == ':') {
+
7121 this->interval.end++;
+
7122 break;
+
7123 }
+
7124 else
+
7125 goto error;
+
7126 break;
+
7127 }
+
7128 else if (text[this->interval.end] == ':') {
+
7129 name.end = this->interval.end;
+
7130 this->interval.end++;
+
7131 break;
+
7132 }
+
7133 else
+
7134 this->interval.end++;
+
7135 }
+
7136 else
+
7137 goto error;
+
7138 }
+
7139 value.start = SIZE_MAX;
+
7140 value.end = 0;
+
7141 for (;;) {
+
7142 if (m_line_break.match(text, this->interval.end, end, flags)) {
+
7143 this->interval.end = m_line_break.interval.end;
+
7144 if (!m_line_break.match(text, this->interval.end, end, flags) &&
+
7145 this->interval.end < end && text[this->interval.end] && stdex::isspace(text[this->interval.end]))
+
7146 this->interval.end++;
+
7147 else
+
7148 break;
+
7149 }
+
7150 else if (this->interval.end < end && text[this->interval.end]) {
+
7151 if (stdex::isspace(text[this->interval.end]))
+
7152 this->interval.end++;
+
7153 else {
+
7154 if (value.start == SIZE_MAX) value.start = this->interval.end;
+
7155 value.end = ++this->interval.end;
+
7156 }
+
7157 }
+
7158 else
+
7159 break;
+
7160 }
+
7161 this->interval.start = start;
+
7162 return true;
+
7163
+
7164 error:
+
7165 invalidate();
+
7166 return false;
+
7167 }
+
7168
+
7169 http_line_break m_line_break;
+
7170 };
-
7170
-
7174 template <class KEY, class T>
-
-
7175 class http_value_collection : public T
-
7176 {
-
7177 public:
-
7178 void insert(
-
7179 _In_reads_or_z_(end) const char* text,
-
7180 _In_ size_t start = 0,
-
7181 _In_ size_t end = SIZE_MAX,
-
7182 _In_ int flags = match_default)
-
7183 {
-
7184 while (start < end) {
-
7185 while (start < end && text[start] && stdex::isspace(text[start])) start++;
-
7186 if (start < end && text[start] == ',') {
-
7187 start++;
-
7188 while (start < end&& text[start] && stdex::isspace(text[start])) start++;
-
7189 }
-
7190 KEY el;
-
7191 if (el.match(text, start, end, flags)) {
-
7192 start = el.interval.end;
-
7193 T::insert(std::move(el));
-
7194 }
-
7195 else
-
7196 break;
-
7197 }
-
7198 }
-
7199 };
+
7171
+
7175 template <class KEY, class T>
+
+
7176 class http_value_collection : public T
+
7177 {
+
7178 public:
+
7179 void insert(
+
7180 _In_reads_or_z_(end) const char* text,
+
7181 _In_ size_t start = 0,
+
7182 _In_ size_t end = SIZE_MAX,
+
7183 _In_ int flags = match_default)
+
7184 {
+
7185 while (start < end) {
+
7186 while (start < end && text[start] && stdex::isspace(text[start])) start++;
+
7187 if (start < end && text[start] == ',') {
+
7188 start++;
+
7189 while (start < end&& text[start] && stdex::isspace(text[start])) start++;
+
7190 }
+
7191 KEY el;
+
7192 if (el.match(text, start, end, flags)) {
+
7193 start = el.interval.end;
+
7194 T::insert(std::move(el));
+
7195 }
+
7196 else
+
7197 break;
+
7198 }
+
7199 }
+
7200 };
-
7200
-
7201 template <class T>
-
- -
7203 constexpr bool operator()(const T& a, const T& b) const noexcept
-
7204 {
-
7205 return a.factor.value > b.factor.value;
-
7206 }
-
7207 };
+
7201
+
7202 template <class T>
+
+ +
7204 constexpr bool operator()(const T& a, const T& b) const noexcept
+
7205 {
+
7206 return a.factor.value > b.factor.value;
+
7207 }
+
7208 };
-
7208
-
7212 template <class T, class AX = std::allocator<T>>
- -
7214
-
7218 template <class T>
-
- -
7220 {
-
7221 public:
- -
7223 _In_ const std::shared_ptr<basic_parser<T>>& quote,
-
7224 _In_ const std::shared_ptr<basic_parser<T>>& chr,
-
7225 _In_ const std::shared_ptr<basic_parser<T>>& escape,
-
7226 _In_ const std::shared_ptr<basic_parser<T>>& sol,
-
7227 _In_ const std::shared_ptr<basic_parser<T>>& bs,
-
7228 _In_ const std::shared_ptr<basic_parser<T>>& ff,
-
7229 _In_ const std::shared_ptr<basic_parser<T>>& lf,
-
7230 _In_ const std::shared_ptr<basic_parser<T>>& cr,
-
7231 _In_ const std::shared_ptr<basic_parser<T>>& htab,
-
7232 _In_ const std::shared_ptr<basic_parser<T>>& uni,
-
7233 _In_ const std::shared_ptr<basic_integer16<T>>& hex,
-
7234 _In_ const std::locale& locale = std::locale()) :
- -
7236 m_quote(quote),
-
7237 m_chr(chr),
-
7238 m_escape(escape),
-
7239 m_sol(sol),
-
7240 m_bs(bs),
-
7241 m_ff(ff),
-
7242 m_lf(lf),
-
7243 m_cr(cr),
-
7244 m_htab(htab),
-
7245 m_uni(uni),
-
7246 m_hex(hex)
-
7247 {}
-
7248
-
7249 virtual void invalidate()
-
7250 {
-
7251 value.clear();
- -
7253 }
-
7254
-
7255 std::basic_string<T> value;
-
7256
-
7257 protected:
-
7258 virtual bool do_match(
-
7259 _In_reads_or_z_opt_(end) const T* text,
-
7260 _In_ size_t start = 0,
-
7261 _In_ size_t end = SIZE_MAX,
-
7262 _In_ int flags = match_default)
-
7263 {
-
7264 _Assume_(text || start >= end);
-
7265 this->interval.end = start;
-
7266 if (m_quote->match(text, this->interval.end, end, flags)) {
-
7267 this->interval.end = m_quote->interval.end;
-
7268 value.clear();
-
7269 for (;;) {
-
7270 if (m_quote->match(text, this->interval.end, end, flags)) {
-
7271 this->interval.start = start;
-
7272 this->interval.end = m_quote->interval.end;
-
7273 return true;
-
7274 }
-
7275 if (m_escape->match(text, this->interval.end, end, flags)) {
-
7276 if (m_quote->match(text, m_escape->interval.end, end, flags)) {
-
7277 value += '"'; this->interval.end = m_quote->interval.end;
-
7278 continue;
-
7279 }
-
7280 if (m_sol->match(text, m_escape->interval.end, end, flags)) {
-
7281 value += '/'; this->interval.end = m_sol->interval.end;
-
7282 continue;
-
7283 }
-
7284 if (m_bs->match(text, m_escape->interval.end, end, flags)) {
-
7285 value += '\b'; this->interval.end = m_bs->interval.end;
-
7286 continue;
-
7287 }
-
7288 if (m_ff->match(text, m_escape->interval.end, end, flags)) {
-
7289 value += '\f'; this->interval.end = m_ff->interval.end;
-
7290 continue;
-
7291 }
-
7292 if (m_lf->match(text, m_escape->interval.end, end, flags)) {
-
7293 value += '\n'; this->interval.end = m_lf->interval.end;
-
7294 continue;
-
7295 }
-
7296 if (m_cr->match(text, m_escape->interval.end, end, flags)) {
-
7297 value += '\r'; this->interval.end = m_cr->interval.end;
-
7298 continue;
-
7299 }
-
7300 if (m_htab->match(text, m_escape->interval.end, end, flags)) {
-
7301 value += '\t'; this->interval.end = m_htab->interval.end;
-
7302 continue;
-
7303 }
-
7304 if (
-
7305 m_uni->match(text, m_escape->interval.end, end, flags) &&
-
7306 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end), flags | match_case_insensitive) &&
-
7307 m_hex->interval.size() == 4 /* JSON requests 4-digit Unicode sequneces: \u.... */)
-
7308 {
-
7309 _Assume_(m_hex->value <= 0xffff);
-
7310 if (sizeof(T) == 1) {
-
7311 if (m_hex->value > 0x7ff) {
-
7312 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
-
7313 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
-
7314 value += (T)(0x80 | (m_hex->value & 0x3f));
-
7315 }
-
7316 else if (m_hex->value > 0x7f) {
-
7317 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
-
7318 value += (T)(0x80 | (m_hex->value & 0x3f));
-
7319 }
-
7320 else
-
7321 value += (T)(m_hex->value & 0x7f);
-
7322 }
-
7323 else
-
7324 value += (T)m_hex->value;
-
7325 this->interval.end = m_hex->interval.end;
-
7326 continue;
-
7327 }
-
7328 if (m_escape->match(text, m_escape->interval.end, end, flags)) {
-
7329 value += '\\'; this->interval.end = m_escape->interval.end;
-
7330 continue;
-
7331 }
-
7332 }
-
7333 if (m_chr->match(text, this->interval.end, end, flags)) {
-
7334 value.append(text + m_chr->interval.start, m_chr->interval.size());
-
7335 this->interval.end = m_chr->interval.end;
-
7336 continue;
-
7337 }
-
7338 break;
-
7339 }
-
7340 }
-
7341 value.clear();
-
7342 this->interval.invalidate();
-
7343 return false;
-
7344 }
-
7345
-
7346 std::shared_ptr<basic_parser<T>> m_quote;
-
7347 std::shared_ptr<basic_parser<T>> m_chr;
-
7348 std::shared_ptr<basic_parser<T>> m_escape;
-
7349 std::shared_ptr<basic_parser<T>> m_sol;
-
7350 std::shared_ptr<basic_parser<T>> m_bs;
-
7351 std::shared_ptr<basic_parser<T>> m_ff;
-
7352 std::shared_ptr<basic_parser<T>> m_lf;
-
7353 std::shared_ptr<basic_parser<T>> m_cr;
-
7354 std::shared_ptr<basic_parser<T>> m_htab;
-
7355 std::shared_ptr<basic_parser<T>> m_uni;
-
7356 std::shared_ptr<basic_integer16<T>> m_hex;
-
7357 };
+
7209
+
7213 template <class T, class AX = std::allocator<T>>
+ +
7215
+
7219 template <class T>
+
+ +
7221 {
+
7222 public:
+ +
7224 _In_ const std::shared_ptr<basic_parser<T>>& quote,
+
7225 _In_ const std::shared_ptr<basic_parser<T>>& chr,
+
7226 _In_ const std::shared_ptr<basic_parser<T>>& escape,
+
7227 _In_ const std::shared_ptr<basic_parser<T>>& sol,
+
7228 _In_ const std::shared_ptr<basic_parser<T>>& bs,
+
7229 _In_ const std::shared_ptr<basic_parser<T>>& ff,
+
7230 _In_ const std::shared_ptr<basic_parser<T>>& lf,
+
7231 _In_ const std::shared_ptr<basic_parser<T>>& cr,
+
7232 _In_ const std::shared_ptr<basic_parser<T>>& htab,
+
7233 _In_ const std::shared_ptr<basic_parser<T>>& uni,
+
7234 _In_ const std::shared_ptr<basic_integer16<T>>& hex,
+
7235 _In_ const std::locale& locale = std::locale()) :
+ +
7237 m_quote(quote),
+
7238 m_chr(chr),
+
7239 m_escape(escape),
+
7240 m_sol(sol),
+
7241 m_bs(bs),
+
7242 m_ff(ff),
+
7243 m_lf(lf),
+
7244 m_cr(cr),
+
7245 m_htab(htab),
+
7246 m_uni(uni),
+
7247 m_hex(hex)
+
7248 {}
+
7249
+
7250 virtual void invalidate()
+
7251 {
+
7252 value.clear();
+ +
7254 }
+
7255
+
7256 std::basic_string<T> value;
+
7257
+
7258 protected:
+
7259 virtual bool do_match(
+
7260 _In_reads_or_z_opt_(end) const T* text,
+
7261 _In_ size_t start = 0,
+
7262 _In_ size_t end = SIZE_MAX,
+
7263 _In_ int flags = match_default)
+
7264 {
+
7265 _Assume_(text || start >= end);
+
7266 this->interval.end = start;
+
7267 if (m_quote->match(text, this->interval.end, end, flags)) {
+
7268 this->interval.end = m_quote->interval.end;
+
7269 value.clear();
+
7270 for (;;) {
+
7271 if (m_quote->match(text, this->interval.end, end, flags)) {
+
7272 this->interval.start = start;
+
7273 this->interval.end = m_quote->interval.end;
+
7274 return true;
+
7275 }
+
7276 if (m_escape->match(text, this->interval.end, end, flags)) {
+
7277 if (m_quote->match(text, m_escape->interval.end, end, flags)) {
+
7278 value += '"'; this->interval.end = m_quote->interval.end;
+
7279 continue;
+
7280 }
+
7281 if (m_sol->match(text, m_escape->interval.end, end, flags)) {
+
7282 value += '/'; this->interval.end = m_sol->interval.end;
+
7283 continue;
+
7284 }
+
7285 if (m_bs->match(text, m_escape->interval.end, end, flags)) {
+
7286 value += '\b'; this->interval.end = m_bs->interval.end;
+
7287 continue;
+
7288 }
+
7289 if (m_ff->match(text, m_escape->interval.end, end, flags)) {
+
7290 value += '\f'; this->interval.end = m_ff->interval.end;
+
7291 continue;
+
7292 }
+
7293 if (m_lf->match(text, m_escape->interval.end, end, flags)) {
+
7294 value += '\n'; this->interval.end = m_lf->interval.end;
+
7295 continue;
+
7296 }
+
7297 if (m_cr->match(text, m_escape->interval.end, end, flags)) {
+
7298 value += '\r'; this->interval.end = m_cr->interval.end;
+
7299 continue;
+
7300 }
+
7301 if (m_htab->match(text, m_escape->interval.end, end, flags)) {
+
7302 value += '\t'; this->interval.end = m_htab->interval.end;
+
7303 continue;
+
7304 }
+
7305 if (
+
7306 m_uni->match(text, m_escape->interval.end, end, flags) &&
+
7307 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end), flags | match_case_insensitive) &&
+
7308 m_hex->interval.size() == 4 /* JSON requests 4-digit Unicode sequneces: \u.... */)
+
7309 {
+
7310 _Assume_(m_hex->value <= 0xffff);
+
7311 if (sizeof(T) == 1) {
+
7312 if (m_hex->value > 0x7ff) {
+
7313 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
+
7314 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
+
7315 value += (T)(0x80 | (m_hex->value & 0x3f));
+
7316 }
+
7317 else if (m_hex->value > 0x7f) {
+
7318 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
+
7319 value += (T)(0x80 | (m_hex->value & 0x3f));
+
7320 }
+
7321 else
+
7322 value += (T)(m_hex->value & 0x7f);
+
7323 }
+
7324 else
+
7325 value += (T)m_hex->value;
+
7326 this->interval.end = m_hex->interval.end;
+
7327 continue;
+
7328 }
+
7329 if (m_escape->match(text, m_escape->interval.end, end, flags)) {
+
7330 value += '\\'; this->interval.end = m_escape->interval.end;
+
7331 continue;
+
7332 }
+
7333 }
+
7334 if (m_chr->match(text, this->interval.end, end, flags)) {
+
7335 value.append(text + m_chr->interval.start, m_chr->interval.size());
+
7336 this->interval.end = m_chr->interval.end;
+
7337 continue;
+
7338 }
+
7339 break;
+
7340 }
+
7341 }
+
7342 value.clear();
+
7343 this->interval.invalidate();
+
7344 return false;
+
7345 }
+
7346
+
7347 std::shared_ptr<basic_parser<T>> m_quote;
+
7348 std::shared_ptr<basic_parser<T>> m_chr;
+
7349 std::shared_ptr<basic_parser<T>> m_escape;
+
7350 std::shared_ptr<basic_parser<T>> m_sol;
+
7351 std::shared_ptr<basic_parser<T>> m_bs;
+
7352 std::shared_ptr<basic_parser<T>> m_ff;
+
7353 std::shared_ptr<basic_parser<T>> m_lf;
+
7354 std::shared_ptr<basic_parser<T>> m_cr;
+
7355 std::shared_ptr<basic_parser<T>> m_htab;
+
7356 std::shared_ptr<basic_parser<T>> m_uni;
+
7357 std::shared_ptr<basic_integer16<T>> m_hex;
+
7358 };
-
7358
- - -
7361#ifdef _UNICODE
-
7362 using tjson_string = wjson_string;
-
7363#else
-
7364 using tjson_string = json_string;
-
7365#endif
-
7366
-
7370 template <class T>
-
- -
7372 {
-
7373 public:
-
7374 virtual void invalidate()
-
7375 {
-
7376 this->content.invalidate();
- -
7378 }
-
7379
- -
7381
-
7382 protected:
-
7383 virtual bool do_match(
-
7384 _In_reads_or_z_opt_(end) const T* text,
-
7385 _In_ size_t start = 0,
-
7386 _In_ size_t end = SIZE_MAX,
-
7387 _In_ int flags = match_multiline)
-
7388 {
-
7389 _Unreferenced_(flags);
-
7390 _Assume_(text || start + 1 >= end);
-
7391 if (start + 1 < end &&
-
7392 text[start] == '/' &&
-
7393 text[start + 1] == '*')
-
7394 {
-
7395 // /*
-
7396 this->content.start = this->interval.end = start + 2;
-
7397 for (;;) {
-
7398 if (this->interval.end >= end || !text[this->interval.end])
-
7399 break;
-
7400 if (this->interval.end + 1 < end &&
-
7401 text[this->interval.end] == '*' &&
-
7402 text[this->interval.end + 1] == '/')
-
7403 {
-
7404 // /*...*/
-
7405 this->content.end = this->interval.end;
-
7406 this->interval.start = start;
-
7407 this->interval.end = this->interval.end + 2;
-
7408 return true;
-
7409 }
-
7410 this->interval.end++;
-
7411 }
-
7412 }
-
7413 this->content.invalidate();
-
7414 this->interval.invalidate();
-
7415 return false;
-
7416 }
-
7417 };
+
7359
+ + +
7362#ifdef _UNICODE
+
7363 using tjson_string = wjson_string;
+
7364#else
+
7365 using tjson_string = json_string;
+
7366#endif
+
7367
+
7371 template <class T>
+
+ +
7373 {
+
7374 public:
+
7375 virtual void invalidate()
+
7376 {
+
7377 this->content.invalidate();
+ +
7379 }
+
7380
+ +
7382
+
7383 protected:
+
7384 virtual bool do_match(
+
7385 _In_reads_or_z_opt_(end) const T* text,
+
7386 _In_ size_t start = 0,
+
7387 _In_ size_t end = SIZE_MAX,
+
7388 _In_ int flags = match_multiline)
+
7389 {
+
7390 _Unreferenced_(flags);
+
7391 _Assume_(text || start + 1 >= end);
+
7392 if (start + 1 < end &&
+
7393 text[start] == '/' &&
+
7394 text[start + 1] == '*')
+
7395 {
+
7396 // /*
+
7397 this->content.start = this->interval.end = start + 2;
+
7398 for (;;) {
+
7399 if (this->interval.end >= end || !text[this->interval.end])
+
7400 break;
+
7401 if (this->interval.end + 1 < end &&
+
7402 text[this->interval.end] == '*' &&
+
7403 text[this->interval.end + 1] == '/')
+
7404 {
+
7405 // /*...*/
+
7406 this->content.end = this->interval.end;
+
7407 this->interval.start = start;
+
7408 this->interval.end = this->interval.end + 2;
+
7409 return true;
+
7410 }
+
7411 this->interval.end++;
+
7412 }
+
7413 }
+
7414 this->content.invalidate();
+
7415 this->interval.invalidate();
+
7416 return false;
+
7417 }
+
7418 };
-
7418
-
7419 using css_comment = basic_css_comment<char>;
-
7420 using wcss_comment = basic_css_comment<wchar_t>;
-
7421#ifdef _UNICODE
-
7422 using tcss_comment = wcss_comment;
-
7423#else
-
7424 using tcss_comment = css_comment;
-
7425#endif
-
7426
-
7430 template <class T>
-
-
7431 class basic_css_cdo : public basic_parser<T>
-
7432 {
-
7433 protected:
-
7434 virtual bool do_match(
-
7435 _In_reads_or_z_opt_(end) const T* text,
-
7436 _In_ size_t start = 0,
-
7437 _In_ size_t end = SIZE_MAX,
-
7438 _In_ int flags = match_multiline)
-
7439 {
-
7440 _Unreferenced_(flags);
-
7441 _Assume_(text || start + 3 >= end);
-
7442 if (start + 3 < end &&
-
7443 text[start] == '<' &&
-
7444 text[start + 1] == '!' &&
-
7445 text[start + 2] == '-' &&
-
7446 text[start + 3] == '-')
-
7447 {
-
7448 this->interval.start = start;
-
7449 this->interval.end = start + 4;
-
7450 return true;
-
7451 }
-
7452 this->interval.invalidate();
-
7453 return false;
-
7454 }
-
7455 };
+
7419
+
7420 using css_comment = basic_css_comment<char>;
+
7421 using wcss_comment = basic_css_comment<wchar_t>;
+
7422#ifdef _UNICODE
+
7423 using tcss_comment = wcss_comment;
+
7424#else
+
7425 using tcss_comment = css_comment;
+
7426#endif
+
7427
+
7431 template <class T>
+
+
7432 class basic_css_cdo : public basic_parser<T>
+
7433 {
+
7434 protected:
+
7435 virtual bool do_match(
+
7436 _In_reads_or_z_opt_(end) const T* text,
+
7437 _In_ size_t start = 0,
+
7438 _In_ size_t end = SIZE_MAX,
+
7439 _In_ int flags = match_multiline)
+
7440 {
+
7441 _Unreferenced_(flags);
+
7442 _Assume_(text || start + 3 >= end);
+
7443 if (start + 3 < end &&
+
7444 text[start] == '<' &&
+
7445 text[start + 1] == '!' &&
+
7446 text[start + 2] == '-' &&
+
7447 text[start + 3] == '-')
+
7448 {
+
7449 this->interval.start = start;
+
7450 this->interval.end = start + 4;
+
7451 return true;
+
7452 }
+
7453 this->interval.invalidate();
+
7454 return false;
+
7455 }
+
7456 };
-
7456
- - -
7459#ifdef _UNICODE
-
7460 using tcss_cdo = wcss_cdo;
-
7461#else
-
7462 using tcss_cdo = css_cdo;
-
7463#endif
-
7464
-
7468 template <class T>
-
-
7469 class basic_css_cdc : public basic_parser<T>
-
7470 {
-
7471 protected:
-
7472 virtual bool do_match(
-
7473 _In_reads_or_z_opt_(end) const T* text,
-
7474 _In_ size_t start = 0,
-
7475 _In_ size_t end = SIZE_MAX,
-
7476 _In_ int flags = match_multiline)
-
7477 {
-
7478 _Unreferenced_(flags);
-
7479 _Assume_(text || start + 2 >= end);
-
7480 if (start + 2 < end &&
-
7481 text[start] == '-' &&
-
7482 text[start + 1] == '-' &&
-
7483 text[start + 2] == '>')
-
7484 {
-
7485 this->interval.start = start;
-
7486 this->interval.end = start + 3;
-
7487 return true;
-
7488 }
-
7489 this->interval.invalidate();
-
7490 return false;
-
7491 }
-
7492 };
+
7457
+ + +
7460#ifdef _UNICODE
+
7461 using tcss_cdo = wcss_cdo;
+
7462#else
+
7463 using tcss_cdo = css_cdo;
+
7464#endif
+
7465
+
7469 template <class T>
+
+
7470 class basic_css_cdc : public basic_parser<T>
+
7471 {
+
7472 protected:
+
7473 virtual bool do_match(
+
7474 _In_reads_or_z_opt_(end) const T* text,
+
7475 _In_ size_t start = 0,
+
7476 _In_ size_t end = SIZE_MAX,
+
7477 _In_ int flags = match_multiline)
+
7478 {
+
7479 _Unreferenced_(flags);
+
7480 _Assume_(text || start + 2 >= end);
+
7481 if (start + 2 < end &&
+
7482 text[start] == '-' &&
+
7483 text[start + 1] == '-' &&
+
7484 text[start + 2] == '>')
+
7485 {
+
7486 this->interval.start = start;
+
7487 this->interval.end = start + 3;
+
7488 return true;
+
7489 }
+
7490 this->interval.invalidate();
+
7491 return false;
+
7492 }
+
7493 };
-
7493
- - -
7496#ifdef _UNICODE
-
7497 using tcss_cdc = wcss_cdc;
-
7498#else
-
7499 using tcss_cdc = css_cdc;
-
7500#endif
-
7501
-
7505 template <class T>
-
- -
7507 {
-
7508 public:
-
7509 virtual void invalidate()
-
7510 {
-
7511 this->content.invalidate();
- -
7513 }
-
7514
- -
7516
-
7517 protected:
-
7518 virtual bool do_match(
-
7519 _In_reads_or_z_opt_(end) const T* text,
-
7520 _In_ size_t start = 0,
-
7521 _In_ size_t end = SIZE_MAX,
-
7522 _In_ int flags = match_multiline)
-
7523 {
-
7524 _Unreferenced_(flags);
-
7525 this->interval.end = start;
-
7526 _Assume_(text || this->interval.end >= end);
-
7527 if (this->interval.end < end &&
-
7528 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
-
7529 {
-
7530 // "Quoted...
-
7531 T quote = text[this->interval.end];
-
7532 this->content.start = ++this->interval.end;
-
7533 for (;;) {
-
7534 if (this->interval.end >= end || !text[this->interval.end])
-
7535 break;
-
7536 if (text[this->interval.end] == quote) {
-
7537 // End quote"
-
7538 this->content.end = this->interval.end;
-
7539 this->interval.start = start;
-
7540 this->interval.end++;
-
7541 return true;
-
7542 }
-
7543 if (this->interval.end + 1 < end &&
-
7544 text[this->interval.end] == '\\' &&
-
7545 (text[this->interval.end + 1] == '\"' || text[this->interval.end + 1] == '\''))
-
7546 {
-
7547 // Escaped quote
-
7548 this->interval.end = this->interval.end + 2;
-
7549 }
-
7550 else
-
7551 this->interval.end++;
-
7552 }
-
7553 }
-
7554
-
7555 this->content.invalidate();
-
7556 this->interval.invalidate();
-
7557 return false;
-
7558 }
-
7559 };
+
7494
+ + +
7497#ifdef _UNICODE
+
7498 using tcss_cdc = wcss_cdc;
+
7499#else
+
7500 using tcss_cdc = css_cdc;
+
7501#endif
+
7502
+
7506 template <class T>
+
+ +
7508 {
+
7509 public:
+
7510 virtual void invalidate()
+
7511 {
+
7512 this->content.invalidate();
+ +
7514 }
+
7515
+ +
7517
+
7518 protected:
+
7519 virtual bool do_match(
+
7520 _In_reads_or_z_opt_(end) const T* text,
+
7521 _In_ size_t start = 0,
+
7522 _In_ size_t end = SIZE_MAX,
+
7523 _In_ int flags = match_multiline)
+
7524 {
+
7525 _Unreferenced_(flags);
+
7526 this->interval.end = start;
+
7527 _Assume_(text || this->interval.end >= end);
+
7528 if (this->interval.end < end &&
+
7529 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
+
7530 {
+
7531 // "Quoted...
+
7532 T quote = text[this->interval.end];
+
7533 this->content.start = ++this->interval.end;
+
7534 for (;;) {
+
7535 if (this->interval.end >= end || !text[this->interval.end])
+
7536 break;
+
7537 if (text[this->interval.end] == quote) {
+
7538 // End quote"
+
7539 this->content.end = this->interval.end;
+
7540 this->interval.start = start;
+
7541 this->interval.end++;
+
7542 return true;
+
7543 }
+
7544 if (this->interval.end + 1 < end &&
+
7545 text[this->interval.end] == '\\' &&
+
7546 (text[this->interval.end + 1] == '\"' || text[this->interval.end + 1] == '\''))
+
7547 {
+
7548 // Escaped quote
+
7549 this->interval.end = this->interval.end + 2;
+
7550 }
+
7551 else
+
7552 this->interval.end++;
+
7553 }
+
7554 }
+
7555
+
7556 this->content.invalidate();
+
7557 this->interval.invalidate();
+
7558 return false;
+
7559 }
+
7560 };
-
7560
-
7561 using css_string = basic_css_string<char>;
-
7562 using wcss_string = basic_css_string<wchar_t>;
-
7563#ifdef _UNICODE
-
7564 using tcss_string = wcss_string;
-
7565#else
-
7566 using tcss_string = css_string;
-
7567#endif
-
7568
-
7572 template <class T>
-
-
7573 class basic_css_uri : public basic_parser<T>
-
7574 {
-
7575 public:
-
7576 virtual void invalidate()
-
7577 {
-
7578 this->content.invalidate();
- -
7580 }
-
7581
- -
7583
-
7584 protected:
-
7585 virtual bool do_match(
-
7586 _In_reads_or_z_opt_(end) const T* text,
-
7587 _In_ size_t start = 0,
-
7588 _In_ size_t end = SIZE_MAX,
-
7589 _In_ int flags = match_multiline)
-
7590 {
-
7591 _Unreferenced_(flags);
-
7592 this->interval.end = start;
-
7593 _Assume_(text || this->interval.end + 3 >= end);
-
7594 if (this->interval.end + 3 < end &&
-
7595 (text[this->interval.end] == 'u' || text[this->interval.end] == 'U') &&
-
7596 (text[this->interval.end + 1] == 'r' || text[this->interval.end + 1] == 'R') &&
-
7597 (text[this->interval.end + 2] == 'l' || text[this->interval.end + 2] == 'L') &&
-
7598 text[this->interval.end + 3] == '(')
-
7599 {
-
7600 // url(
-
7601 this->interval.end = this->interval.end + 4;
-
7602
-
7603 // Skip whitespace.
-
7604 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
7605 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
7606
-
7607 if (this->interval.end < end &&
-
7608 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
-
7609 {
-
7610 // url("Quoted...
-
7611 T quote = text[this->interval.end];
-
7612 this->content.start = ++this->interval.end;
-
7613 for (;;) {
-
7614 if (this->interval.end >= end || !text[this->interval.end])
-
7615 goto error;
-
7616 if (text[this->interval.end] == quote) {
-
7617 // End quote"
-
7618 this->content.end = this->interval.end;
-
7619 this->interval.end++;
-
7620 break;
-
7621 }
-
7622 if (this->interval.end + 1 < end &&
-
7623 text[this->interval.end] == '\\' &&
-
7624 (text[this->interval.end + 1] == '\"' || text[this->interval.end + 1] == '\''))
-
7625 {
-
7626 // Escaped quote
-
7627 this->interval.end = this->interval.end + 2;
-
7628 }
-
7629 else
-
7630 this->interval.end++;
-
7631 }
-
7632
-
7633 // Skip whitespace.
-
7634 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
7635
-
7636 if (this->interval.end < end &&
-
7637 text[this->interval.end] == ')')
-
7638 {
-
7639 // url("...")
-
7640 this->interval.start = start;
-
7641 this->interval.end++;
-
7642 return true;
-
7643 }
-
7644 }
-
7645 else {
-
7646 // url(...
-
7647 this->content.start = content.end = this->interval.end;
-
7648 for (;;) {
-
7649 if (this->interval.end >= end || !text[this->interval.end])
-
7650 goto error;
-
7651 if (text[this->interval.end] == ')') {
-
7652 // url(...)
-
7653 this->interval.start = start;
-
7654 this->interval.end++;
-
7655 return true;
-
7656 }
-
7657 if (ctype.is(ctype.space, text[this->interval.end]))
-
7658 this->interval.end++;
-
7659 else
-
7660 this->content.end = ++this->interval.end;
-
7661 }
-
7662 }
-
7663 }
-
7664
-
7665 error:
-
7666 invalidate();
-
7667 return false;
-
7668 }
-
7669 };
+
7561
+
7562 using css_string = basic_css_string<char>;
+
7563 using wcss_string = basic_css_string<wchar_t>;
+
7564#ifdef _UNICODE
+
7565 using tcss_string = wcss_string;
+
7566#else
+
7567 using tcss_string = css_string;
+
7568#endif
+
7569
+
7573 template <class T>
+
+
7574 class basic_css_uri : public basic_parser<T>
+
7575 {
+
7576 public:
+
7577 virtual void invalidate()
+
7578 {
+
7579 this->content.invalidate();
+ +
7581 }
+
7582
+ +
7584
+
7585 protected:
+
7586 virtual bool do_match(
+
7587 _In_reads_or_z_opt_(end) const T* text,
+
7588 _In_ size_t start = 0,
+
7589 _In_ size_t end = SIZE_MAX,
+
7590 _In_ int flags = match_multiline)
+
7591 {
+
7592 _Unreferenced_(flags);
+
7593 this->interval.end = start;
+
7594 _Assume_(text || this->interval.end + 3 >= end);
+
7595 if (this->interval.end + 3 < end &&
+
7596 (text[this->interval.end] == 'u' || text[this->interval.end] == 'U') &&
+
7597 (text[this->interval.end + 1] == 'r' || text[this->interval.end + 1] == 'R') &&
+
7598 (text[this->interval.end + 2] == 'l' || text[this->interval.end + 2] == 'L') &&
+
7599 text[this->interval.end + 3] == '(')
+
7600 {
+
7601 // url(
+
7602 this->interval.end = this->interval.end + 4;
+
7603
+
7604 // Skip whitespace.
+
7605 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
7606 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
7607
+
7608 if (this->interval.end < end &&
+
7609 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
+
7610 {
+
7611 // url("Quoted...
+
7612 T quote = text[this->interval.end];
+
7613 this->content.start = ++this->interval.end;
+
7614 for (;;) {
+
7615 if (this->interval.end >= end || !text[this->interval.end])
+
7616 goto error;
+
7617 if (text[this->interval.end] == quote) {
+
7618 // End quote"
+
7619 this->content.end = this->interval.end;
+
7620 this->interval.end++;
+
7621 break;
+
7622 }
+
7623 if (this->interval.end + 1 < end &&
+
7624 text[this->interval.end] == '\\' &&
+
7625 (text[this->interval.end + 1] == '\"' || text[this->interval.end + 1] == '\''))
+
7626 {
+
7627 // Escaped quote
+
7628 this->interval.end = this->interval.end + 2;
+
7629 }
+
7630 else
+
7631 this->interval.end++;
+
7632 }
+
7633
+
7634 // Skip whitespace.
+
7635 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
7636
+
7637 if (this->interval.end < end &&
+
7638 text[this->interval.end] == ')')
+
7639 {
+
7640 // url("...")
+
7641 this->interval.start = start;
+
7642 this->interval.end++;
+
7643 return true;
+
7644 }
+
7645 }
+
7646 else {
+
7647 // url(...
+
7648 this->content.start = content.end = this->interval.end;
+
7649 for (;;) {
+
7650 if (this->interval.end >= end || !text[this->interval.end])
+
7651 goto error;
+
7652 if (text[this->interval.end] == ')') {
+
7653 // url(...)
+
7654 this->interval.start = start;
+
7655 this->interval.end++;
+
7656 return true;
+
7657 }
+
7658 if (ctype.is(ctype.space, text[this->interval.end]))
+
7659 this->interval.end++;
+
7660 else
+
7661 this->content.end = ++this->interval.end;
+
7662 }
+
7663 }
+
7664 }
+
7665
+
7666 error:
+
7667 invalidate();
+
7668 return false;
+
7669 }
+
7670 };
-
7670
-
7671 using css_uri = basic_css_uri<char>;
-
7672 using wcss_uri = basic_css_uri<wchar_t>;
-
7673#ifdef _UNICODE
-
7674 using tcss_uri = wcss_uri;
-
7675#else
-
7676 using tcss_uri = css_uri;
-
7677#endif
-
7678
-
7682 template <class T>
-
- -
7684 {
-
7685 public:
-
7686 virtual void invalidate()
-
7687 {
-
7688 this->content.invalidate();
- -
7690 }
-
7691
- -
7693
-
7694 protected:
-
7695 virtual bool do_match(
-
7696 _In_reads_or_z_opt_(end) const T* text,
-
7697 _In_ size_t start = 0,
-
7698 _In_ size_t end = SIZE_MAX,
-
7699 _In_ int flags = match_multiline)
-
7700 {
-
7701 _Unreferenced_(flags);
-
7702 this->interval.end = start;
-
7703 _Assume_(text || this->interval.end + 6 >= end);
-
7704 if (this->interval.end + 6 < end &&
-
7705 text[this->interval.end] == '@' &&
-
7706 (text[this->interval.end + 1] == 'i' || text[this->interval.end + 1] == 'I') &&
-
7707 (text[this->interval.end + 2] == 'm' || text[this->interval.end + 2] == 'M') &&
-
7708 (text[this->interval.end + 3] == 'p' || text[this->interval.end + 3] == 'P') &&
-
7709 (text[this->interval.end + 4] == 'o' || text[this->interval.end + 4] == 'O') &&
-
7710 (text[this->interval.end + 5] == 'r' || text[this->interval.end + 5] == 'R') &&
-
7711 (text[this->interval.end + 6] == 't' || text[this->interval.end + 6] == 'T'))
-
7712 {
-
7713 // @import...
-
7714 this->interval.end = this->interval.end + 7;
-
7715
-
7716 // Skip whitespace.
-
7717 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
7718 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
7719
-
7720 if (this->interval.end < end &&
-
7721 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
-
7722 {
-
7723 // @import "Quoted
-
7724 T quote = text[this->interval.end];
-
7725 this->content.start = ++this->interval.end;
-
7726 for (;;) {
-
7727 if (this->interval.end >= end || !text[this->interval.end])
-
7728 goto error;
-
7729 if (text[this->interval.end] == quote) {
-
7730 // End quote"
-
7731 this->content.end = this->interval.end;
-
7732 this->interval.start = start;
-
7733 this->interval.end++;
-
7734 return true;
-
7735 }
-
7736 if (this->interval.end + 1 < end &&
-
7737 text[this->interval.end] == '\\' &&
-
7738 (text[this->interval.end + 1] == '\"' || text[this->interval.end + 1] == '\''))
-
7739 {
-
7740 // Escaped quote
-
7741 this->interval.end = this->interval.end + 2;
-
7742 }
-
7743 else
-
7744 this->interval.end++;
-
7745 }
-
7746 }
-
7747 }
-
7748
-
7749 error:
-
7750 invalidate();
-
7751 return false;
-
7752 }
-
7753 };
+
7671
+
7672 using css_uri = basic_css_uri<char>;
+
7673 using wcss_uri = basic_css_uri<wchar_t>;
+
7674#ifdef _UNICODE
+
7675 using tcss_uri = wcss_uri;
+
7676#else
+
7677 using tcss_uri = css_uri;
+
7678#endif
+
7679
+
7683 template <class T>
+
+ +
7685 {
+
7686 public:
+
7687 virtual void invalidate()
+
7688 {
+
7689 this->content.invalidate();
+ +
7691 }
+
7692
+ +
7694
+
7695 protected:
+
7696 virtual bool do_match(
+
7697 _In_reads_or_z_opt_(end) const T* text,
+
7698 _In_ size_t start = 0,
+
7699 _In_ size_t end = SIZE_MAX,
+
7700 _In_ int flags = match_multiline)
+
7701 {
+
7702 _Unreferenced_(flags);
+
7703 this->interval.end = start;
+
7704 _Assume_(text || this->interval.end + 6 >= end);
+
7705 if (this->interval.end + 6 < end &&
+
7706 text[this->interval.end] == '@' &&
+
7707 (text[this->interval.end + 1] == 'i' || text[this->interval.end + 1] == 'I') &&
+
7708 (text[this->interval.end + 2] == 'm' || text[this->interval.end + 2] == 'M') &&
+
7709 (text[this->interval.end + 3] == 'p' || text[this->interval.end + 3] == 'P') &&
+
7710 (text[this->interval.end + 4] == 'o' || text[this->interval.end + 4] == 'O') &&
+
7711 (text[this->interval.end + 5] == 'r' || text[this->interval.end + 5] == 'R') &&
+
7712 (text[this->interval.end + 6] == 't' || text[this->interval.end + 6] == 'T'))
+
7713 {
+
7714 // @import...
+
7715 this->interval.end = this->interval.end + 7;
+
7716
+
7717 // Skip whitespace.
+
7718 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
7719 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
7720
+
7721 if (this->interval.end < end &&
+
7722 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
+
7723 {
+
7724 // @import "Quoted
+
7725 T quote = text[this->interval.end];
+
7726 this->content.start = ++this->interval.end;
+
7727 for (;;) {
+
7728 if (this->interval.end >= end || !text[this->interval.end])
+
7729 goto error;
+
7730 if (text[this->interval.end] == quote) {
+
7731 // End quote"
+
7732 this->content.end = this->interval.end;
+
7733 this->interval.start = start;
+
7734 this->interval.end++;
+
7735 return true;
+
7736 }
+
7737 if (this->interval.end + 1 < end &&
+
7738 text[this->interval.end] == '\\' &&
+
7739 (text[this->interval.end + 1] == '\"' || text[this->interval.end + 1] == '\''))
+
7740 {
+
7741 // Escaped quote
+
7742 this->interval.end = this->interval.end + 2;
+
7743 }
+
7744 else
+
7745 this->interval.end++;
+
7746 }
+
7747 }
+
7748 }
+
7749
+
7750 error:
+
7751 invalidate();
+
7752 return false;
+
7753 }
+
7754 };
-
7754
-
7755 using css_import = basic_css_import<char>;
-
7756 using wcss_import = basic_css_import<wchar_t>;
-
7757#ifdef _UNICODE
-
7758 using tcss_import = wcss_import;
-
7759#else
-
7760 using tcss_import = css_import;
-
7761#endif
-
7762
-
7766 template <class T>
-
- -
7768 {
-
7769 public:
-
7770 virtual void invalidate()
-
7771 {
-
7772 this->base_type.invalidate();
-
7773 this->sub_type.invalidate();
-
7774 this->charset.invalidate();
- -
7776 }
-
7777
- - - -
7781
-
7782 protected:
-
7783 virtual bool do_match(
-
7784 _In_reads_or_z_opt_(end) const T* text,
-
7785 _In_ size_t start = 0,
-
7786 _In_ size_t end = SIZE_MAX,
-
7787 _In_ int flags = match_multiline)
-
7788 {
-
7789 _Unreferenced_(flags);
-
7790 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
7791
-
7792 this->interval.end = start;
-
7793 this->base_type.start = this->interval.end;
-
7794 for (;;) {
-
7795 _Assume_(text || this->interval.end >= end);
-
7796 if (this->interval.end >= end || !text[this->interval.end])
-
7797 break;
-
7798 if (text[this->interval.end] == '/' ||
-
7799 text[this->interval.end] == ';' ||
-
7800 ctype.is(ctype.space, text[this->interval.end]))
-
7801 break;
-
7802 this->interval.end++;
-
7803 }
-
7804 if (this->interval.end <= this->base_type.start)
-
7805 goto error;
-
7806 this->base_type.end = this->interval.end;
-
7807
-
7808 if (end <= this->interval.end || text[this->interval.end] != '/')
-
7809 goto error;
-
7810
-
7811 this->interval.end++;
-
7812 this->sub_type.start = this->interval.end;
-
7813 for (;;) {
-
7814 if (this->interval.end >= end || !text[this->interval.end])
-
7815 break;
-
7816 if (text[this->interval.end] == '/' ||
-
7817 text[this->interval.end] == ';' ||
-
7818 ctype.is(ctype.space, text[this->interval.end]))
-
7819 break;
-
7820 this->interval.end++;
-
7821 }
-
7822 if (this->interval.end <= this->sub_type.start)
-
7823 goto error;
-
7824
-
7825 this->sub_type.end = this->interval.end;
-
7826 this->charset.invalidate();
-
7827 if (this->interval.end < end && text[this->interval.end] == ';') {
-
7828 this->interval.end++;
-
7829
-
7830 // Skip whitespace.
-
7831 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
7832
-
7833 if (this->interval.end + 7 < end &&
-
7834 (text[this->interval.end] == 'c' || text[this->interval.end] == 'C') &&
-
7835 (text[this->interval.end + 1] == 'h' || text[this->interval.end + 1] == 'H') &&
-
7836 (text[this->interval.end + 2] == 'a' || text[this->interval.end + 2] == 'A') &&
-
7837 (text[this->interval.end + 3] == 'r' || text[this->interval.end + 3] == 'R') &&
-
7838 (text[this->interval.end + 4] == 's' || text[this->interval.end + 4] == 'S') &&
-
7839 (text[this->interval.end + 5] == 'e' || text[this->interval.end + 5] == 'E') &&
-
7840 (text[this->interval.end + 6] == 't' || text[this->interval.end + 6] == 'T') &&
-
7841 text[this->interval.end + 7] == '=')
-
7842 {
-
7843 this->interval.end = this->interval.end + 8;
-
7844 if (this->interval.end < end &&
-
7845 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
-
7846 {
-
7847 // "Quoted...
-
7848 T quote = text[this->interval.end];
-
7849 this->charset.start = ++this->interval.end;
-
7850 for (;;) {
-
7851 if (this->interval.end >= end || !text[this->interval.end]) {
-
7852 // No end quote!
-
7853 this->charset.invalidate();
-
7854 break;
-
7855 }
-
7856 if (text[this->interval.end] == quote) {
-
7857 // End quote"
-
7858 this->charset.end = this->interval.end;
-
7859 this->interval.end++;
-
7860 break;
-
7861 }
-
7862 this->interval.end++;
-
7863 }
-
7864 }
-
7865 else {
-
7866 // Nonquoted
-
7867 this->charset.start = this->interval.end;
-
7868 for (;;) {
-
7869 if (this->interval.end >= end || !text[this->interval.end] ||
-
7870 ctype.is(ctype.space, text[this->interval.end])) {
-
7871 this->charset.end = this->interval.end;
-
7872 break;
-
7873 }
-
7874 this->interval.end++;
-
7875 }
-
7876 }
-
7877 }
-
7878 }
-
7879 this->interval.start = start;
-
7880 return true;
-
7881
-
7882 error:
-
7883 invalidate();
-
7884 return false;
-
7885 }
-
7886 };
+
7755
+
7756 using css_import = basic_css_import<char>;
+
7757 using wcss_import = basic_css_import<wchar_t>;
+
7758#ifdef _UNICODE
+
7759 using tcss_import = wcss_import;
+
7760#else
+
7761 using tcss_import = css_import;
+
7762#endif
+
7763
+
7767 template <class T>
+
+ +
7769 {
+
7770 public:
+
7771 virtual void invalidate()
+
7772 {
+
7773 this->base_type.invalidate();
+
7774 this->sub_type.invalidate();
+
7775 this->charset.invalidate();
+ +
7777 }
+
7778
+ + + +
7782
+
7783 protected:
+
7784 virtual bool do_match(
+
7785 _In_reads_or_z_opt_(end) const T* text,
+
7786 _In_ size_t start = 0,
+
7787 _In_ size_t end = SIZE_MAX,
+
7788 _In_ int flags = match_multiline)
+
7789 {
+
7790 _Unreferenced_(flags);
+
7791 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
7792
+
7793 this->interval.end = start;
+
7794 this->base_type.start = this->interval.end;
+
7795 for (;;) {
+
7796 _Assume_(text || this->interval.end >= end);
+
7797 if (this->interval.end >= end || !text[this->interval.end])
+
7798 break;
+
7799 if (text[this->interval.end] == '/' ||
+
7800 text[this->interval.end] == ';' ||
+
7801 ctype.is(ctype.space, text[this->interval.end]))
+
7802 break;
+
7803 this->interval.end++;
+
7804 }
+
7805 if (this->interval.end <= this->base_type.start)
+
7806 goto error;
+
7807 this->base_type.end = this->interval.end;
+
7808
+
7809 if (end <= this->interval.end || text[this->interval.end] != '/')
+
7810 goto error;
+
7811
+
7812 this->interval.end++;
+
7813 this->sub_type.start = this->interval.end;
+
7814 for (;;) {
+
7815 if (this->interval.end >= end || !text[this->interval.end])
+
7816 break;
+
7817 if (text[this->interval.end] == '/' ||
+
7818 text[this->interval.end] == ';' ||
+
7819 ctype.is(ctype.space, text[this->interval.end]))
+
7820 break;
+
7821 this->interval.end++;
+
7822 }
+
7823 if (this->interval.end <= this->sub_type.start)
+
7824 goto error;
+
7825
+
7826 this->sub_type.end = this->interval.end;
+
7827 this->charset.invalidate();
+
7828 if (this->interval.end < end && text[this->interval.end] == ';') {
+
7829 this->interval.end++;
+
7830
+
7831 // Skip whitespace.
+
7832 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
7833
+
7834 if (this->interval.end + 7 < end &&
+
7835 (text[this->interval.end] == 'c' || text[this->interval.end] == 'C') &&
+
7836 (text[this->interval.end + 1] == 'h' || text[this->interval.end + 1] == 'H') &&
+
7837 (text[this->interval.end + 2] == 'a' || text[this->interval.end + 2] == 'A') &&
+
7838 (text[this->interval.end + 3] == 'r' || text[this->interval.end + 3] == 'R') &&
+
7839 (text[this->interval.end + 4] == 's' || text[this->interval.end + 4] == 'S') &&
+
7840 (text[this->interval.end + 5] == 'e' || text[this->interval.end + 5] == 'E') &&
+
7841 (text[this->interval.end + 6] == 't' || text[this->interval.end + 6] == 'T') &&
+
7842 text[this->interval.end + 7] == '=')
+
7843 {
+
7844 this->interval.end = this->interval.end + 8;
+
7845 if (this->interval.end < end &&
+
7846 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
+
7847 {
+
7848 // "Quoted...
+
7849 T quote = text[this->interval.end];
+
7850 this->charset.start = ++this->interval.end;
+
7851 for (;;) {
+
7852 if (this->interval.end >= end || !text[this->interval.end]) {
+
7853 // No end quote!
+
7854 this->charset.invalidate();
+
7855 break;
+
7856 }
+
7857 if (text[this->interval.end] == quote) {
+
7858 // End quote"
+
7859 this->charset.end = this->interval.end;
+
7860 this->interval.end++;
+
7861 break;
+
7862 }
+
7863 this->interval.end++;
+
7864 }
+
7865 }
+
7866 else {
+
7867 // Nonquoted
+
7868 this->charset.start = this->interval.end;
+
7869 for (;;) {
+
7870 if (this->interval.end >= end || !text[this->interval.end] ||
+
7871 ctype.is(ctype.space, text[this->interval.end])) {
+
7872 this->charset.end = this->interval.end;
+
7873 break;
+
7874 }
+
7875 this->interval.end++;
+
7876 }
+
7877 }
+
7878 }
+
7879 }
+
7880 this->interval.start = start;
+
7881 return true;
+
7882
+
7883 error:
+
7884 invalidate();
+
7885 return false;
+
7886 }
+
7887 };
-
7887
-
7888 using mime_type = basic_mime_type<char>;
-
7889 using wmime_type = basic_mime_type<wchar_t>;
-
7890#ifdef _UNICODE
-
7891 using tmime_type = wmime_type;
-
7892#else
-
7893 using tmime_type = mime_type;
-
7894#endif
-
7895
-
7899 template <class T>
-
- -
7901 {
-
7902 protected:
-
7903 virtual bool do_match(
-
7904 _In_reads_or_z_opt_(end) const T* text,
-
7905 _In_ size_t start = 0,
-
7906 _In_ size_t end = SIZE_MAX,
-
7907 _In_ int flags = match_default)
-
7908 {
-
7909 _Unreferenced_(flags);
-
7910 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
7911 this->interval.end = start;
-
7912 for (;;) {
-
7913 _Assume_(text || this->interval.end >= end);
-
7914 if (this->interval.end >= end || !text[this->interval.end]) {
- -
7916 this->interval.start = start;
-
7917 return true;
-
7918 }
-
7919 this->interval.invalidate();
-
7920 return false;
-
7921 }
-
7922 if (text[this->interval.end] == '>' ||
-
7923 text[this->interval.end] == '=' ||
-
7924 (text[this->interval.end] == '/' && this->interval.end + 1 < end && text[this->interval.end + 1] == '>') ||
-
7925 ctype.is(ctype.space, text[this->interval.end]))
-
7926 {
-
7927 this->interval.start = start;
-
7928 return true;
-
7929 }
-
7930 this->interval.end++;
-
7931 }
-
7932 }
-
7933 };
+
7888
+
7889 using mime_type = basic_mime_type<char>;
+
7890 using wmime_type = basic_mime_type<wchar_t>;
+
7891#ifdef _UNICODE
+
7892 using tmime_type = wmime_type;
+
7893#else
+
7894 using tmime_type = mime_type;
+
7895#endif
+
7896
+
7900 template <class T>
+
+ +
7902 {
+
7903 protected:
+
7904 virtual bool do_match(
+
7905 _In_reads_or_z_opt_(end) const T* text,
+
7906 _In_ size_t start = 0,
+
7907 _In_ size_t end = SIZE_MAX,
+
7908 _In_ int flags = match_default)
+
7909 {
+
7910 _Unreferenced_(flags);
+
7911 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
7912 this->interval.end = start;
+
7913 for (;;) {
+
7914 _Assume_(text || this->interval.end >= end);
+
7915 if (this->interval.end >= end || !text[this->interval.end]) {
+ +
7917 this->interval.start = start;
+
7918 return true;
+
7919 }
+
7920 this->interval.invalidate();
+
7921 return false;
+
7922 }
+
7923 if (text[this->interval.end] == '>' ||
+
7924 text[this->interval.end] == '=' ||
+
7925 (text[this->interval.end] == '/' && this->interval.end + 1 < end && text[this->interval.end + 1] == '>') ||
+
7926 ctype.is(ctype.space, text[this->interval.end]))
+
7927 {
+
7928 this->interval.start = start;
+
7929 return true;
+
7930 }
+
7931 this->interval.end++;
+
7932 }
+
7933 }
+
7934 };
-
7934
- - -
7937#ifdef _UNICODE
-
7938 using thtml_ident = whtml_ident;
-
7939#else
-
7940 using thtml_ident = html_ident;
-
7941#endif
-
7942
-
7946 template <class T>
-
- -
7948 {
-
7949 public:
-
7950 virtual void invalidate()
-
7951 {
-
7952 this->content.invalidate();
- -
7954 }
-
7955
- -
7957
-
7958 protected:
-
7959 virtual bool do_match(
-
7960 _In_reads_or_z_opt_(end) const T* text,
-
7961 _In_ size_t start = 0,
-
7962 _In_ size_t end = SIZE_MAX,
-
7963 _In_ int flags = match_default)
-
7964 {
-
7965 _Unreferenced_(flags);
-
7966 this->interval.end = start;
-
7967 _Assume_(text || this->interval.end >= end);
-
7968 if (this->interval.end < end &&
-
7969 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
-
7970 {
-
7971 // "Quoted...
-
7972 T quote = text[this->interval.end];
-
7973 this->content.start = ++this->interval.end;
-
7974 for (;;) {
-
7975 if (this->interval.end >= end || !text[this->interval.end]) {
-
7976 // No end quote!
-
7977 this->content.invalidate();
-
7978 this->interval.invalidate();
-
7979 return false;
-
7980 }
-
7981 if (text[this->interval.end] == quote) {
-
7982 // End quote"
-
7983 this->content.end = this->interval.end;
-
7984 this->interval.start = start;
-
7985 this->interval.end++;
-
7986 return true;
-
7987 }
-
7988 this->interval.end++;
-
7989 }
-
7990 }
-
7991
-
7992 // Nonquoted
-
7993 this->content.start = this->interval.end;
-
7994 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
7995 for (;;) {
-
7996 _Assume_(text || this->interval.end >= end);
-
7997 if (this->interval.end >= end || !text[this->interval.end]) {
-
7998 this->content.end = this->interval.end;
-
7999 this->interval.start = start;
-
8000 return true;
-
8001 }
-
8002 if (text[this->interval.end] == '>' ||
-
8003 (text[this->interval.end] == '/' && this->interval.end + 1 < end && text[this->interval.end + 1] == '>') ||
-
8004 ctype.is(ctype.space, text[this->interval.end]))
-
8005 {
-
8006 this->content.end = this->interval.end;
-
8007 this->interval.start = start;
-
8008 return true;
-
8009 }
-
8010 this->interval.end++;
-
8011 }
-
8012 }
-
8013 };
+
7935
+ + +
7938#ifdef _UNICODE
+
7939 using thtml_ident = whtml_ident;
+
7940#else
+
7941 using thtml_ident = html_ident;
+
7942#endif
+
7943
+
7947 template <class T>
+
+ +
7949 {
+
7950 public:
+
7951 virtual void invalidate()
+
7952 {
+
7953 this->content.invalidate();
+ +
7955 }
+
7956
+ +
7958
+
7959 protected:
+
7960 virtual bool do_match(
+
7961 _In_reads_or_z_opt_(end) const T* text,
+
7962 _In_ size_t start = 0,
+
7963 _In_ size_t end = SIZE_MAX,
+
7964 _In_ int flags = match_default)
+
7965 {
+
7966 _Unreferenced_(flags);
+
7967 this->interval.end = start;
+
7968 _Assume_(text || this->interval.end >= end);
+
7969 if (this->interval.end < end &&
+
7970 (text[this->interval.end] == '\"' || text[this->interval.end] == '\''))
+
7971 {
+
7972 // "Quoted...
+
7973 T quote = text[this->interval.end];
+
7974 this->content.start = ++this->interval.end;
+
7975 for (;;) {
+
7976 if (this->interval.end >= end || !text[this->interval.end]) {
+
7977 // No end quote!
+
7978 this->content.invalidate();
+
7979 this->interval.invalidate();
+
7980 return false;
+
7981 }
+
7982 if (text[this->interval.end] == quote) {
+
7983 // End quote"
+
7984 this->content.end = this->interval.end;
+
7985 this->interval.start = start;
+
7986 this->interval.end++;
+
7987 return true;
+
7988 }
+
7989 this->interval.end++;
+
7990 }
+
7991 }
+
7992
+
7993 // Nonquoted
+
7994 this->content.start = this->interval.end;
+
7995 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
7996 for (;;) {
+
7997 _Assume_(text || this->interval.end >= end);
+
7998 if (this->interval.end >= end || !text[this->interval.end]) {
+
7999 this->content.end = this->interval.end;
+
8000 this->interval.start = start;
+
8001 return true;
+
8002 }
+
8003 if (text[this->interval.end] == '>' ||
+
8004 (text[this->interval.end] == '/' && this->interval.end + 1 < end && text[this->interval.end + 1] == '>') ||
+
8005 ctype.is(ctype.space, text[this->interval.end]))
+
8006 {
+
8007 this->content.end = this->interval.end;
+
8008 this->interval.start = start;
+
8009 return true;
+
8010 }
+
8011 this->interval.end++;
+
8012 }
+
8013 }
+
8014 };
-
8014
-
8015 using html_value = basic_html_value<char>;
-
8016 using whtml_value = basic_html_value<wchar_t>;
-
8017#ifdef _UNICODE
-
8018 using thtml_value = whtml_value;
-
8019#else
-
8020 using thtml_value = html_value;
-
8021#endif
-
8022
-
8026 enum class html_sequence_t {
-
8027 text = 0,
-
8028 element,
-
8029 element_start,
-
8030 element_end,
-
8031 declaration,
-
8032 comment,
-
8033 instruction,
-
8034 PCDATA,
-
8035 CDATA,
-
8036
-
8037 unknown = -1,
-
8038 };
-
8039
-
- - - -
8046 };
+
8015
+
8016 using html_value = basic_html_value<char>;
+
8017 using whtml_value = basic_html_value<wchar_t>;
+
8018#ifdef _UNICODE
+
8019 using thtml_value = whtml_value;
+
8020#else
+
8021 using thtml_value = html_value;
+
8022#endif
+
8023
+
8027 enum class html_sequence_t {
+
8028 text = 0,
+
8029 element,
+
8030 element_start,
+
8031 element_end,
+
8032 declaration,
+
8033 comment,
+
8034 instruction,
+
8035 PCDATA,
+
8036 CDATA,
+
8037
+
8038 unknown = -1,
+
8039 };
+
8040
+ -
8047
-
8051 template <class T>
-
- -
8053 {
-
8054 public:
-
8055 basic_html_tag(_In_ const std::locale& locale = std::locale()) :
- -
8057 type(html_sequence_t::unknown)
-
8058 {}
-
8059
-
8060 virtual void invalidate()
-
8061 {
-
8062 this->type = html_sequence_t::unknown;
-
8063 this->name.invalidate();
-
8064 this->attributes.clear();
- -
8066 }
-
8067
-
8068 html_sequence_t type;
- -
8070 std::vector<html_attribute> attributes;
-
8071
-
8072 protected:
-
8073 virtual bool do_match(
-
8074 _In_reads_or_z_opt_(end) const T* text,
-
8075 _In_ size_t start = 0,
-
8076 _In_ size_t end = SIZE_MAX,
-
8077 _In_ int flags = match_multiline)
-
8078 {
-
8079 _Assume_(text || start >= end);
-
8080 if (start >= end || text[start] != '<')
-
8081 goto error;
-
8082 this->interval.end = start + 1;
-
8083 if (this->interval.end >= end || !text[this->interval.end])
-
8084 goto error;
-
8085 if (text[this->interval.end] == '/' &&
-
8086 this->m_ident.match(text, this->interval.end + 1, end, flags))
-
8087 {
-
8088 // </...
-
8089 this->type = html_sequence_t::element_end;
-
8090 this->name = this->m_ident.interval;
-
8091 this->interval.end = this->m_ident.interval.end;
-
8092 }
-
8093 else if (text[this->interval.end] == '!') {
-
8094 // <!...
-
8095 this->interval.end++;
-
8096 if (this->interval.end + 1 < end &&
-
8097 text[this->interval.end] == '-' &&
-
8098 text[this->interval.end + 1] == '-')
-
8099 {
-
8100 // <!--...
-
8101 this->name.start = this->interval.end = this->interval.end + 2;
-
8102 for (;;) {
-
8103 if (this->interval.end >= end || !text[this->interval.end])
-
8104 goto error;
-
8105 if (this->interval.end + 2 < end &&
-
8106 text[this->interval.end] == '-' &&
-
8107 text[this->interval.end + 1] == '-' &&
-
8108 text[this->interval.end + 2] == '>')
-
8109 {
-
8110 // <!--...-->
-
8111 this->type = html_sequence_t::comment;
-
8112 this->name.end = this->interval.end;
-
8113 this->attributes.clear();
-
8114 this->interval.start = start;
-
8115 this->interval.end = this->interval.end + 3;
-
8116 return true;
-
8117 }
-
8118 this->interval.end++;
-
8119 }
-
8120 }
-
8121 this->type = html_sequence_t::declaration;
-
8122 this->name.start = this->name.end = this->interval.end;
-
8123 }
-
8124 else if (text[this->interval.end] == '?') {
-
8125 // <?...
-
8126 this->name.start = ++this->interval.end;
-
8127 for (;;) {
-
8128 if (this->interval.end >= end || !text[this->interval.end])
-
8129 goto error;
-
8130 if (text[this->interval.end] == '>') {
-
8131 // <?...>
-
8132 this->type = html_sequence_t::instruction;
-
8133 this->name.end = this->interval.end;
-
8134 this->attributes.clear();
-
8135 this->interval.start = start;
-
8136 this->interval.end++;
-
8137 return true;
-
8138 }
-
8139 if (this->interval.end + 1 < end &&
-
8140 text[this->interval.end] == '?' &&
-
8141 text[this->interval.end + 1] == '>')
-
8142 {
-
8143 // <?...?>
-
8144 this->type = html_sequence_t::instruction;
-
8145 this->name.end = this->interval.end;
-
8146 this->attributes.clear();
-
8147 this->interval.start = start;
-
8148 this->interval.end = this->interval.end + 2;
-
8149 return true;
-
8150 }
-
8151 this->interval.end++;
-
8152 }
-
8153 }
-
8154 else if (this->m_ident.match(text, this->interval.end, end, flags)) {
-
8155 // <tag...
-
8156 this->type = html_sequence_t::element_start;
-
8157 this->name = this->m_ident.interval;
-
8158 this->interval.end = this->m_ident.interval.end;
-
8159 }
-
8160 else
-
8161 goto error;
-
8162
-
8163 {
-
8164 // Skip whitespace.
-
8165 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
8166 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
8167
-
8168 this->attributes.clear();
-
8169 for (;;) {
-
8170 if (this->type == html_sequence_t::element_start &&
-
8171 this->interval.end + 1 < end &&
-
8172 text[this->interval.end] == '/' &&
-
8173 text[this->interval.end + 1] == '>')
-
8174 {
-
8175 // <tag .../>
-
8176 this->type = html_sequence_t::element;
-
8177 this->interval.end = this->interval.end + 2;
-
8178 break;
-
8179 }
-
8180 if (this->interval.end < end &&
-
8181 text[this->interval.end] == '>')
-
8182 {
-
8183 // <tag ...>
-
8184 this->interval.end++;
-
8185 break;
-
8186 }
-
8187 if (this->type == html_sequence_t::declaration &&
-
8188 this->interval.end + 1 < end &&
-
8189 text[this->interval.end] == '!' &&
-
8190 text[this->interval.end + 1] == '>')
-
8191 {
-
8192 // "<!...!>".
-
8193 this->interval.end = this->interval.end + 2;
-
8194 break;
-
8195 }
-
8196 if (this->type == html_sequence_t::declaration &&
-
8197 this->interval.end + 1 < end &&
-
8198 text[this->interval.end] == '-' &&
-
8199 text[this->interval.end + 1] == '-')
-
8200 {
-
8201 // "<! ... --...".
-
8202 this->interval.end = this->interval.end + 2;
-
8203 for (;;) {
-
8204 if (this->interval.end >= end || !text[this->interval.end])
-
8205 goto error;
-
8206 if (this->interval.end + 1 < end &&
-
8207 text[this->interval.end] == '-' &&
-
8208 text[this->interval.end + 1] == '-')
-
8209 {
-
8210 // "<! ... --...--".
-
8211 this->interval.end = this->interval.end + 2;
-
8212 break;
-
8213 }
-
8214 this->interval.end++;
-
8215 }
-
8216
-
8217 // Skip whitespace.
-
8218 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
8219 continue;
-
8220 }
-
8221
-
8222 if (this->interval.end >= end || !text[this->interval.end])
-
8223 goto error;
-
8224
-
8225 // Attributes follow...
-
8226 html_attribute* a = nullptr;
-
8227 if (this->m_ident.match(text, this->interval.end, end, flags)) {
-
8228 this->attributes.push_back(std::move(html_attribute{ this->m_ident.interval }));
-
8229 a = &this->attributes.back();
-
8230 _Assume_(a);
-
8231 this->interval.end = this->m_ident.interval.end;
-
8232 }
-
8233 else {
-
8234 // What was that?! Skip.
-
8235 this->interval.end++;
-
8236 continue;
-
8237 }
-
8238
-
8239 // Skip whitespace.
-
8240 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
8241
-
8242 if (this->interval.end < end && text[this->interval.end] == '=') {
-
8243 this->interval.end++;
-
8244
-
8245 // Skip whitespace.
-
8246 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
8247
-
8248 if (this->m_value.match(text, this->interval.end, end, flags)) {
-
8249 // This attribute has value.
-
8250 a->value = this->m_value.content;
-
8251 this->interval.end = this->m_value.interval.end;
-
8252
-
8253 // Skip whitespace.
-
8254 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
8255 }
-
8256 }
-
8257 else {
-
8258 // This attribute has no value.
-
8259 a->value.invalidate();
-
8260 }
-
8261 }
-
8262 }
-
8263
-
8264 this->interval.start = start;
-
8265 return true;
-
8266
-
8267 error:
-
8268 invalidate();
-
8269 return false;
-
8270 }
-
8271
-
8272 basic_html_ident<T> m_ident;
-
8273 basic_html_value<T> m_value;
-
8274 };
+
8048
+
8052 template <class T>
+
+ +
8054 {
+
8055 public:
+
8056 basic_html_tag(_In_ const std::locale& locale = std::locale()) :
+ +
8058 type(html_sequence_t::unknown)
+
8059 {}
+
8060
+
8061 virtual void invalidate()
+
8062 {
+
8063 this->type = html_sequence_t::unknown;
+
8064 this->name.invalidate();
+
8065 this->attributes.clear();
+ +
8067 }
+
8068
+
8069 html_sequence_t type;
+ +
8071 std::vector<html_attribute> attributes;
+
8072
+
8073 protected:
+
8074 virtual bool do_match(
+
8075 _In_reads_or_z_opt_(end) const T* text,
+
8076 _In_ size_t start = 0,
+
8077 _In_ size_t end = SIZE_MAX,
+
8078 _In_ int flags = match_multiline)
+
8079 {
+
8080 _Assume_(text || start >= end);
+
8081 if (start >= end || text[start] != '<')
+
8082 goto error;
+
8083 this->interval.end = start + 1;
+
8084 if (this->interval.end >= end || !text[this->interval.end])
+
8085 goto error;
+
8086 if (text[this->interval.end] == '/' &&
+
8087 this->m_ident.match(text, this->interval.end + 1, end, flags))
+
8088 {
+
8089 // </...
+
8090 this->type = html_sequence_t::element_end;
+
8091 this->name = this->m_ident.interval;
+
8092 this->interval.end = this->m_ident.interval.end;
+
8093 }
+
8094 else if (text[this->interval.end] == '!') {
+
8095 // <!...
+
8096 this->interval.end++;
+
8097 if (this->interval.end + 1 < end &&
+
8098 text[this->interval.end] == '-' &&
+
8099 text[this->interval.end + 1] == '-')
+
8100 {
+
8101 // <!--...
+
8102 this->name.start = this->interval.end = this->interval.end + 2;
+
8103 for (;;) {
+
8104 if (this->interval.end >= end || !text[this->interval.end])
+
8105 goto error;
+
8106 if (this->interval.end + 2 < end &&
+
8107 text[this->interval.end] == '-' &&
+
8108 text[this->interval.end + 1] == '-' &&
+
8109 text[this->interval.end + 2] == '>')
+
8110 {
+
8111 // <!--...-->
+
8112 this->type = html_sequence_t::comment;
+
8113 this->name.end = this->interval.end;
+
8114 this->attributes.clear();
+
8115 this->interval.start = start;
+
8116 this->interval.end = this->interval.end + 3;
+
8117 return true;
+
8118 }
+
8119 this->interval.end++;
+
8120 }
+
8121 }
+
8122 this->type = html_sequence_t::declaration;
+
8123 this->name.start = this->name.end = this->interval.end;
+
8124 }
+
8125 else if (text[this->interval.end] == '?') {
+
8126 // <?...
+
8127 this->name.start = ++this->interval.end;
+
8128 for (;;) {
+
8129 if (this->interval.end >= end || !text[this->interval.end])
+
8130 goto error;
+
8131 if (text[this->interval.end] == '>') {
+
8132 // <?...>
+
8133 this->type = html_sequence_t::instruction;
+
8134 this->name.end = this->interval.end;
+
8135 this->attributes.clear();
+
8136 this->interval.start = start;
+
8137 this->interval.end++;
+
8138 return true;
+
8139 }
+
8140 if (this->interval.end + 1 < end &&
+
8141 text[this->interval.end] == '?' &&
+
8142 text[this->interval.end + 1] == '>')
+
8143 {
+
8144 // <?...?>
+
8145 this->type = html_sequence_t::instruction;
+
8146 this->name.end = this->interval.end;
+
8147 this->attributes.clear();
+
8148 this->interval.start = start;
+
8149 this->interval.end = this->interval.end + 2;
+
8150 return true;
+
8151 }
+
8152 this->interval.end++;
+
8153 }
+
8154 }
+
8155 else if (this->m_ident.match(text, this->interval.end, end, flags)) {
+
8156 // <tag...
+
8157 this->type = html_sequence_t::element_start;
+
8158 this->name = this->m_ident.interval;
+
8159 this->interval.end = this->m_ident.interval.end;
+
8160 }
+
8161 else
+
8162 goto error;
+
8163
+
8164 {
+
8165 // Skip whitespace.
+
8166 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
8167 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
8168
+
8169 this->attributes.clear();
+
8170 for (;;) {
+
8171 if (this->type == html_sequence_t::element_start &&
+
8172 this->interval.end + 1 < end &&
+
8173 text[this->interval.end] == '/' &&
+
8174 text[this->interval.end + 1] == '>')
+
8175 {
+
8176 // <tag .../>
+
8177 this->type = html_sequence_t::element;
+
8178 this->interval.end = this->interval.end + 2;
+
8179 break;
+
8180 }
+
8181 if (this->interval.end < end &&
+
8182 text[this->interval.end] == '>')
+
8183 {
+
8184 // <tag ...>
+
8185 this->interval.end++;
+
8186 break;
+
8187 }
+
8188 if (this->type == html_sequence_t::declaration &&
+
8189 this->interval.end + 1 < end &&
+
8190 text[this->interval.end] == '!' &&
+
8191 text[this->interval.end + 1] == '>')
+
8192 {
+
8193 // "<!...!>".
+
8194 this->interval.end = this->interval.end + 2;
+
8195 break;
+
8196 }
+
8197 if (this->type == html_sequence_t::declaration &&
+
8198 this->interval.end + 1 < end &&
+
8199 text[this->interval.end] == '-' &&
+
8200 text[this->interval.end + 1] == '-')
+
8201 {
+
8202 // "<! ... --...".
+
8203 this->interval.end = this->interval.end + 2;
+
8204 for (;;) {
+
8205 if (this->interval.end >= end || !text[this->interval.end])
+
8206 goto error;
+
8207 if (this->interval.end + 1 < end &&
+
8208 text[this->interval.end] == '-' &&
+
8209 text[this->interval.end + 1] == '-')
+
8210 {
+
8211 // "<! ... --...--".
+
8212 this->interval.end = this->interval.end + 2;
+
8213 break;
+
8214 }
+
8215 this->interval.end++;
+
8216 }
+
8217
+
8218 // Skip whitespace.
+
8219 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
8220 continue;
+
8221 }
+
8222
+
8223 if (this->interval.end >= end || !text[this->interval.end])
+
8224 goto error;
+
8225
+
8226 // Attributes follow...
+
8227 html_attribute* a = nullptr;
+
8228 if (this->m_ident.match(text, this->interval.end, end, flags)) {
+
8229 this->attributes.push_back(std::move(html_attribute{ this->m_ident.interval }));
+
8230 a = &this->attributes.back();
+
8231 _Assume_(a);
+
8232 this->interval.end = this->m_ident.interval.end;
+
8233 }
+
8234 else {
+
8235 // What was that?! Skip.
+
8236 this->interval.end++;
+
8237 continue;
+
8238 }
+
8239
+
8240 // Skip whitespace.
+
8241 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
8242
+
8243 if (this->interval.end < end && text[this->interval.end] == '=') {
+
8244 this->interval.end++;
+
8245
+
8246 // Skip whitespace.
+
8247 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
8248
+
8249 if (this->m_value.match(text, this->interval.end, end, flags)) {
+
8250 // This attribute has value.
+
8251 a->value = this->m_value.content;
+
8252 this->interval.end = this->m_value.interval.end;
+
8253
+
8254 // Skip whitespace.
+
8255 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
8256 }
+
8257 }
+
8258 else {
+
8259 // This attribute has no value.
+
8260 a->value.invalidate();
+
8261 }
+
8262 }
+
8263 }
+
8264
+
8265 this->interval.start = start;
+
8266 return true;
+
8267
+
8268 error:
+
8269 invalidate();
+
8270 return false;
+
8271 }
+
8272
+
8273 basic_html_ident<T> m_ident;
+
8274 basic_html_value<T> m_value;
+
8275 };
-
8275
-
8276 using html_tag = basic_html_tag<char>;
-
8277 using whtml_tag = basic_html_tag<wchar_t>;
-
8278#ifdef _UNICODE
-
8279 using thtml_tag = whtml_tag;
-
8280#else
-
8281 using thtml_tag = html_tag;
-
8282#endif
-
8283
-
8287 template <class T>
-
- -
8289 {
-
8290 public:
-
8291 virtual void invalidate()
-
8292 {
-
8293 this->condition.invalidate();
- -
8295 }
-
8296
-
8297 stdex::interval<size_t> condition;
-
8298
-
8299 protected:
-
-
8300 virtual bool do_match(
-
8301 _In_reads_or_z_opt_(end) const T* text,
-
8302 _In_ size_t start = 0,
-
8303 _In_ size_t end = SIZE_MAX,
-
8304 _In_ int flags = match_multiline)
-
8305 {
-
8306 _Unreferenced_(flags);
-
8307 _Assume_(text || start + 2 >= end);
-
8308 if (start + 2 < end &&
-
8309 text[start] == '<' &&
-
8310 text[start + 1] == '!' &&
-
8311 text[start + 2] == '[')
-
8312 {
-
8313 this->interval.end = start + 3;
-
8314
-
8315 // Skip whitespace.
-
8316 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
-
8317 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
-
8318
-
8319 this->condition.start = this->condition.end = this->interval.end;
-
8320
-
8321 for (;;) {
-
8322 if (this->interval.end >= end || !text[this->interval.end])
-
8323 break;
-
8324 if (text[this->interval.end] == '[') {
-
8325 this->interval.start = start;
-
8326 this->interval.end++;
-
8327 return true;
-
8328 }
-
8329 if (ctype.is(ctype.space, text[this->interval.end]))
-
8330 this->interval.end++;
-
8331 else
-
8332 this->condition.end = ++this->interval.end;
-
8333 }
-
8334 }
-
8335
-
8336 this->condition.invalidate();
-
8337 this->interval.invalidate();
-
8338 return false;
-
8339 }
+
8276
+
8277 using html_tag = basic_html_tag<char>;
+
8278 using whtml_tag = basic_html_tag<wchar_t>;
+
8279#ifdef _UNICODE
+
8280 using thtml_tag = whtml_tag;
+
8281#else
+
8282 using thtml_tag = html_tag;
+
8283#endif
+
8284
+
8288 template <class T>
+
+ +
8290 {
+
8291 public:
+
8292 virtual void invalidate()
+
8293 {
+
8294 this->condition.invalidate();
+ +
8296 }
+
8297
+
8298 stdex::interval<size_t> condition;
+
8299
+
8300 protected:
+
+
8301 virtual bool do_match(
+
8302 _In_reads_or_z_opt_(end) const T* text,
+
8303 _In_ size_t start = 0,
+
8304 _In_ size_t end = SIZE_MAX,
+
8305 _In_ int flags = match_multiline)
+
8306 {
+
8307 _Unreferenced_(flags);
+
8308 _Assume_(text || start + 2 >= end);
+
8309 if (start + 2 < end &&
+
8310 text[start] == '<' &&
+
8311 text[start + 1] == '!' &&
+
8312 text[start + 2] == '[')
+
8313 {
+
8314 this->interval.end = start + 3;
+
8315
+
8316 // Skip whitespace.
+
8317 const auto& ctype = std::use_facet<std::ctype<T>>(this->m_locale);
+
8318 for (; this->interval.end < end && text[this->interval.end] && ctype.is(ctype.space, text[this->interval.end]); this->interval.end++);
+
8319
+
8320 this->condition.start = this->condition.end = this->interval.end;
+
8321
+
8322 for (;;) {
+
8323 if (this->interval.end >= end || !text[this->interval.end])
+
8324 break;
+
8325 if (text[this->interval.end] == '[') {
+
8326 this->interval.start = start;
+
8327 this->interval.end++;
+
8328 return true;
+
8329 }
+
8330 if (ctype.is(ctype.space, text[this->interval.end]))
+
8331 this->interval.end++;
+
8332 else
+
8333 this->condition.end = ++this->interval.end;
+
8334 }
+
8335 }
+
8336
+
8337 this->condition.invalidate();
+
8338 this->interval.invalidate();
+
8339 return false;
+
8340 }
-
8340 };
+
8341 };
-
8341
-
8342 using html_declaration_condition_start = basic_html_declaration_condition_start<char>;
-
8343 using whtml_declaration_condition_start = basic_html_declaration_condition_start<wchar_t>;
-
8344#ifdef _UNICODE
-
8345 using thtml_declaration_condition_start = whtml_declaration_condition_start;
-
8346#else
-
8347 using thtml_declaration_condition_start = html_declaration_condition_start;
-
8348#endif
-
8349
-
8353 template <class T>
-
- -
8355 {
-
8356 protected:
-
8357 virtual bool do_match(
-
8358 _In_reads_or_z_opt_(end) const T* text,
-
8359 _In_ size_t start = 0,
-
8360 _In_ size_t end = SIZE_MAX,
-
8361 _In_ int flags = match_multiline)
-
8362 {
-
8363 _Unreferenced_(flags);
-
8364 _Assume_(text || start + 2 >= end);
-
8365 if (start + 2 < end &&
-
8366 text[start] == ']' &&
-
8367 text[start + 1] == ']' &&
-
8368 text[start + 2] == '>')
-
8369 {
-
8370 this->interval.start = start;
-
8371 this->interval.end = start + 3;
-
8372 return true;
-
8373 }
-
8374 this->interval.invalidate();
-
8375 return false;
-
8376 }
-
8377 };
+
8342
+
8343 using html_declaration_condition_start = basic_html_declaration_condition_start<char>;
+
8344 using whtml_declaration_condition_start = basic_html_declaration_condition_start<wchar_t>;
+
8345#ifdef _UNICODE
+
8346 using thtml_declaration_condition_start = whtml_declaration_condition_start;
+
8347#else
+
8348 using thtml_declaration_condition_start = html_declaration_condition_start;
+
8349#endif
+
8350
+
8354 template <class T>
+
+ +
8356 {
+
8357 protected:
+
8358 virtual bool do_match(
+
8359 _In_reads_or_z_opt_(end) const T* text,
+
8360 _In_ size_t start = 0,
+
8361 _In_ size_t end = SIZE_MAX,
+
8362 _In_ int flags = match_multiline)
+
8363 {
+
8364 _Unreferenced_(flags);
+
8365 _Assume_(text || start + 2 >= end);
+
8366 if (start + 2 < end &&
+
8367 text[start] == ']' &&
+
8368 text[start + 1] == ']' &&
+
8369 text[start + 2] == '>')
+
8370 {
+
8371 this->interval.start = start;
+
8372 this->interval.end = start + 3;
+
8373 return true;
+
8374 }
+
8375 this->interval.invalidate();
+
8376 return false;
+
8377 }
+
8378 };
-
8378
- - -
8381#ifdef _UNICODE
- -
8383#else
- -
8385#endif
-
8386 }
-
8387}
-
8388
-
8389#undef ENUM_FLAG_OPERATOR
-
8390#undef ENUM_FLAGS
-
8391
-
8392#if defined(_MSC_VER)
-
8393#pragma warning(pop)
-
8394#elif defined(__GNUC__)
-
8395#pragma GCC diagnostic pop
-
8396#endif
-
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:69
-
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4380
-
Test for any code unit.
Definition parser.hpp:235
-
Test for beginning of line.
Definition parser.hpp:634
-
Test for any.
Definition parser.hpp:1077
-
Test for chemical formula.
Definition parser.hpp:5509
-
Test for Creditor Reference.
Definition parser.hpp:4944
-
T reference[22]
Normalized national reference number.
Definition parser.hpp:4966
-
T check_digits[3]
Two check digits.
Definition parser.hpp:4965
-
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:4967
-
Legacy CSS comment end -->
Definition parser.hpp:7470
-
Legacy CSS comment start <!--
Definition parser.hpp:7432
-
CSS comment.
Definition parser.hpp:7372
-
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7380
-
CSS import directive.
Definition parser.hpp:7684
-
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7692
-
CSS string.
Definition parser.hpp:7507
-
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7515
-
URI in CSS.
Definition parser.hpp:7574
-
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7582
-
Test for any code unit from a given string of code units.
Definition parser.hpp:739
-
Test for specific code unit.
Definition parser.hpp:307
-
Test for date.
Definition parser.hpp:4013
-
Test for valid DNS domain character.
Definition parser.hpp:2795
-
bool allow_on_edge
Is character allowed at the beginning or an end of a DNS domain?
Definition parser.hpp:2805
-
Test for DNS domain/hostname.
Definition parser.hpp:2895
-
bool m_allow_absolute
May DNS names end with a dot (absolute name)?
Definition parser.hpp:2959
-
Test for e-mail address.
Definition parser.hpp:3787
-
Test for emoticon.
Definition parser.hpp:3890
-
std::shared_ptr< basic_parser< T > > apex
apex/eyebrows/halo (e.g. O, 0)
Definition parser.hpp:3918
-
std::shared_ptr< basic_parser< T > > eyes
eyes (e.g. :, ;, >, |, B)
Definition parser.hpp:3919
-
std::shared_ptr< basic_set< T > > mouth
mouth (e.g. ), ), (, (, |, P, D, p, d)
Definition parser.hpp:3921
-
std::shared_ptr< basic_parser< T > > nose
nose (e.g. -, o)
Definition parser.hpp:3920
-
std::shared_ptr< basic_parser< T > > emoticon
emoticon as a whole (e.g. 😀, 🤔, 😶)
Definition parser.hpp:3917
-
Test for end of line.
Definition parser.hpp:673
-
Test for fraction.
Definition parser.hpp:1705
-
End of condition ...]]>
Definition parser.hpp:8355
-
Start of condition <![condition[...
Definition parser.hpp:8289
-
virtual bool do_match(_In_reads_or_z_opt_(end) const T *text, size_t start=0, size_t end=SIZE_MAX, int flags=match_multiline)
condition position in source
Definition parser.hpp:8300
-
Contiguous sequence of characters representing name of element, attribute etc.
Definition parser.hpp:7901
-
Tag.
Definition parser.hpp:8053
-
std::vector< html_attribute > attributes
tag attributes
Definition parser.hpp:8070
-
html_sequence_t type
tag type
Definition parser.hpp:8068
-
stdex::interval< size_t > name
tag name position in source
Definition parser.hpp:8069
-
Optionally-quoted string representing value of an attribute.
Definition parser.hpp:7948
-
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7956
-
Test for International Bank Account Number.
Definition parser.hpp:4655
-
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4680
-
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4678
-
T check_digits[3]
Two check digits.
Definition parser.hpp:4679
-
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4681
-
Test for decimal integer.
Definition parser.hpp:1315
-
Test for decimal integer possibly containing thousand separators.
Definition parser.hpp:1400
-
bool has_separators
Did integer have any separators?
Definition parser.hpp:1421
-
size_t digit_count
Total number of digits in integer.
Definition parser.hpp:1420
-
Test for hexadecimal integer.
Definition parser.hpp:1480
-
Base class for integer testing.
Definition parser.hpp:1293
-
size_t value
Calculated value of the numeral.
Definition parser.hpp:1307
-
Test for IPv4 address.
Definition parser.hpp:2363
-
stdex::interval< size_t > components[4]
Individual component intervals.
Definition parser.hpp:2408
-
struct in_addr value
IPv4 address value.
Definition parser.hpp:2409
-
Test for IPv6 address.
Definition parser.hpp:2575
-
std::shared_ptr< basic_parser< T > > scope_id
Scope ID (e.g. NIC index with link-local addresses)
Definition parser.hpp:2647
-
stdex::interval< size_t > components[8]
Individual component intervals.
Definition parser.hpp:2645
-
struct in6_addr value
IPv6 address value.
Definition parser.hpp:2646
-
Test for valid IPv6 address scope ID character.
Definition parser.hpp:2501
-
Test for repeating.
Definition parser.hpp:929
-
bool m_greedy
try to match as long sequence as possible
Definition parser.hpp:968
-
std::shared_ptr< basic_parser< T > > m_el
repeating element
Definition parser.hpp:965
-
size_t m_min_iterations
minimum number of iterations
Definition parser.hpp:966
-
size_t m_max_iterations
maximum number of iterations
Definition parser.hpp:967
-
Test for JSON string.
Definition parser.hpp:7220
-
MIME content type.
Definition parser.hpp:7768
-
stdex::interval< size_t > base_type
basic type position in source
Definition parser.hpp:7778
-
stdex::interval< size_t > sub_type
sub-type position in source
Definition parser.hpp:7779
-
stdex::interval< size_t > charset
charset position in source
Definition parser.hpp:7780
-
Test for mixed numeral.
Definition parser.hpp:1940
-
std::shared_ptr< basic_parser< T > > fraction
fraction
Definition parser.hpp:1973
-
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1971
-
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1970
-
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1969
-
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:1972
-
Test for monetary numeral.
Definition parser.hpp:2234
-
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2267
-
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2272
-
std::shared_ptr< basic_parser< T > > currency
Currency part.
Definition parser.hpp:2270
-
std::shared_ptr< basic_parser< T > > decimal
Decimal part.
Definition parser.hpp:2273
-
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2271
-
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2268
-
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2269
-
"No-op" match
Definition parser.hpp:203
-
Base template for all parsers.
Definition parser.hpp:79
-
stdex::interval< size_t > interval
Region of the last match.
Definition parser.hpp:119
-
Test for permutation.
Definition parser.hpp:1217
-
Test for phone number.
Definition parser.hpp:4503
-
std::basic_string< T > value
Normalized phone number.
Definition parser.hpp:4528
-
Test for any punctuation code unit.
Definition parser.hpp:480
-
Test for Roman numeral.
Definition parser.hpp:1589
-
Test for scientific numeral.
Definition parser.hpp:2065
-
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2111
-
std::shared_ptr< basic_parser< T > > exponent_symbol
Exponent symbol (e.g. 'e')
Definition parser.hpp:2115
-
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2109
-
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2110
-
double value
Calculated value of the numeral.
Definition parser.hpp:2119
-
std::shared_ptr< basic_parser< T > > negative_exp_sign
Negative exponent sign (e.g. '-')
Definition parser.hpp:2117
-
std::shared_ptr< basic_integer< T > > decimal
Decimal part.
Definition parser.hpp:2114
-
std::shared_ptr< basic_parser< T > > positive_exp_sign
Positive exponent sign (e.g. '+')
Definition parser.hpp:2116
-
std::shared_ptr< basic_integer< T > > exponent
Exponent part.
Definition parser.hpp:2118
-
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2113
-
std::shared_ptr< basic_integer< T > > integer
Integer part.
Definition parser.hpp:2112
-
Test for match score.
Definition parser.hpp:1768
-
Test for sequence.
Definition parser.hpp:1025
-
Definition parser.hpp:708
-
Test for SI Reference delimiter.
Definition parser.hpp:5138
-
Test for SI Reference part.
Definition parser.hpp:5092
-
Test for SI Reference.
Definition parser.hpp:5177
-
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5206
-
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5204
-
bool is_valid
Is reference valid.
Definition parser.hpp:5207
-
T model[3]
Reference model.
Definition parser.hpp:5203
-
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5205
-
Test for signed numeral.
Definition parser.hpp:1854
-
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1880
-
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1879
-
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1878
-
std::shared_ptr< basic_parser< T > > number
Number.
Definition parser.hpp:1881
-
Test for any space code unit.
Definition parser.hpp:400
-
Test for any space or punctuation code unit.
Definition parser.hpp:555
-
Test for any string.
Definition parser.hpp:1145
-
Test for given string.
Definition parser.hpp:834
-
Test for time.
Definition parser.hpp:4278
-
Test for valid URL password character.
Definition parser.hpp:3079
-
Test for valid URL path character.
Definition parser.hpp:3181
-
Test for URL path.
Definition parser.hpp:3291
-
Test for valid URL username character.
Definition parser.hpp:2978
-
Test for URL.
Definition parser.hpp:3431
-
Test for HTTP agent.
Definition parser.hpp:6764
-
Test for HTTP any type.
Definition parser.hpp:5907
-
Test for HTTP asterisk.
Definition parser.hpp:6535
- - - - - -
Test for HTTP header.
Definition parser.hpp:7072
-
Test for HTTP language (RFC1766)
Definition parser.hpp:6403
-
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5589
-
Test for HTTP media range (RFC2616: media-range)
Definition parser.hpp:5939
-
Test for HTTP media type (RFC2616: media-type)
Definition parser.hpp:5991
-
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5855
-
http_token name
Parameter name.
Definition parser.hpp:5864
-
http_value value
Parameter value.
Definition parser.hpp:5865
-
Test for HTTP protocol.
Definition parser.hpp:6839
-
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:6861
-
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5748
-
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5757
-
Test for HTTP request.
Definition parser.hpp:6940
-
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5625
-
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5661
-
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5694
-
Test for HTTP URL parameter.
Definition parser.hpp:6228
-
Test for HTTP URL path segment.
Definition parser.hpp:6140
-
Test for HTTP URL path segment.
Definition parser.hpp:6173
-
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6181
-
Test for HTTP URL port.
Definition parser.hpp:6084
-
Test for HTTP URL server.
Definition parser.hpp:6047
-
Test for HTTP URL.
Definition parser.hpp:6305
-
Collection of HTTP values.
Definition parser.hpp:7176
-
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5811
-
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5820
-
http_token token
Value when matched as token.
Definition parser.hpp:5821
-
Test for HTTP weight factor.
Definition parser.hpp:6466
-
float value
Calculated value of the weight factor.
Definition parser.hpp:6479
-
Test for HTTP weighted value.
Definition parser.hpp:6558
-
Base template for collection-holding parsers.
Definition parser.hpp:985
-
Test for any SGML code point.
Definition parser.hpp:268
-
Test for any SGML code point from a given string of SGML code points.
Definition parser.hpp:791
-
Test for specific SGML code point.
Definition parser.hpp:356
-
Test for valid DNS domain SGML character.
Definition parser.hpp:2850
-
Test for valid IPv6 address scope ID SGML character.
Definition parser.hpp:2540
-
Test for any SGML punctuation code point.
Definition parser.hpp:521
-
Test for any SGML space code point.
Definition parser.hpp:443
-
Test for any SGML space or punctuation code point.
Definition parser.hpp:598
-
Test for SGML given string.
Definition parser.hpp:881
-
Test for valid URL password SGML character.
Definition parser.hpp:3132
-
Test for valid URL path SGML character.
Definition parser.hpp:3238
-
Test for valid URL username SGML character.
Definition parser.hpp:3030
+
8379
+ + +
8382#ifdef _UNICODE
+ +
8384#else
+ +
8386#endif
+
8387 }
+
8388}
+
8389
+
8390#undef ENUM_FLAG_OPERATOR
+
8391#undef ENUM_FLAGS
+
8392
+
8393#if defined(_MSC_VER)
+
8394#pragma warning(pop)
+
8395#elif defined(__GNUC__)
+
8396#pragma GCC diagnostic pop
+
8397#endif
+
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:74
+
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4381
+
Test for any code unit.
Definition parser.hpp:236
+
Test for beginning of line.
Definition parser.hpp:635
+
Test for any.
Definition parser.hpp:1078
+
Test for chemical formula.
Definition parser.hpp:5510
+
Test for Creditor Reference.
Definition parser.hpp:4945
+
T reference[22]
Normalized national reference number.
Definition parser.hpp:4967
+
T check_digits[3]
Two check digits.
Definition parser.hpp:4966
+
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:4968
+
Legacy CSS comment end -->
Definition parser.hpp:7471
+
Legacy CSS comment start <!--
Definition parser.hpp:7433
+
CSS comment.
Definition parser.hpp:7373
+
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7381
+
CSS import directive.
Definition parser.hpp:7685
+
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7693
+
CSS string.
Definition parser.hpp:7508
+
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7516
+
URI in CSS.
Definition parser.hpp:7575
+
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7583
+
Test for any code unit from a given string of code units.
Definition parser.hpp:740
+
Test for specific code unit.
Definition parser.hpp:308
+
Test for date.
Definition parser.hpp:4014
+
Test for valid DNS domain character.
Definition parser.hpp:2796
+
bool allow_on_edge
Is character allowed at the beginning or an end of a DNS domain?
Definition parser.hpp:2806
+
Test for DNS domain/hostname.
Definition parser.hpp:2896
+
bool m_allow_absolute
May DNS names end with a dot (absolute name)?
Definition parser.hpp:2960
+
Test for e-mail address.
Definition parser.hpp:3788
+
Test for emoticon.
Definition parser.hpp:3891
+
std::shared_ptr< basic_parser< T > > apex
apex/eyebrows/halo (e.g. O, 0)
Definition parser.hpp:3919
+
std::shared_ptr< basic_parser< T > > eyes
eyes (e.g. :, ;, >, |, B)
Definition parser.hpp:3920
+
std::shared_ptr< basic_set< T > > mouth
mouth (e.g. ), ), (, (, |, P, D, p, d)
Definition parser.hpp:3922
+
std::shared_ptr< basic_parser< T > > nose
nose (e.g. -, o)
Definition parser.hpp:3921
+
std::shared_ptr< basic_parser< T > > emoticon
emoticon as a whole (e.g. 😀, 🤔, 😶)
Definition parser.hpp:3918
+
Test for end of line.
Definition parser.hpp:674
+
Test for fraction.
Definition parser.hpp:1706
+
End of condition ...]]>
Definition parser.hpp:8356
+
Start of condition <![condition[...
Definition parser.hpp:8290
+
virtual bool do_match(_In_reads_or_z_opt_(end) const T *text, size_t start=0, size_t end=SIZE_MAX, int flags=match_multiline)
condition position in source
Definition parser.hpp:8301
+
Contiguous sequence of characters representing name of element, attribute etc.
Definition parser.hpp:7902
+
Tag.
Definition parser.hpp:8054
+
std::vector< html_attribute > attributes
tag attributes
Definition parser.hpp:8071
+
html_sequence_t type
tag type
Definition parser.hpp:8069
+
stdex::interval< size_t > name
tag name position in source
Definition parser.hpp:8070
+
Optionally-quoted string representing value of an attribute.
Definition parser.hpp:7949
+
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7957
+
Test for International Bank Account Number.
Definition parser.hpp:4656
+
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4681
+
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4679
+
T check_digits[3]
Two check digits.
Definition parser.hpp:4680
+
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4682
+
Test for decimal integer.
Definition parser.hpp:1316
+
Test for decimal integer possibly containing thousand separators.
Definition parser.hpp:1401
+
bool has_separators
Did integer have any separators?
Definition parser.hpp:1422
+
size_t digit_count
Total number of digits in integer.
Definition parser.hpp:1421
+
Test for hexadecimal integer.
Definition parser.hpp:1481
+
Base class for integer testing.
Definition parser.hpp:1294
+
size_t value
Calculated value of the numeral.
Definition parser.hpp:1308
+
Test for IPv4 address.
Definition parser.hpp:2364
+
stdex::interval< size_t > components[4]
Individual component intervals.
Definition parser.hpp:2409
+
struct in_addr value
IPv4 address value.
Definition parser.hpp:2410
+
Test for IPv6 address.
Definition parser.hpp:2576
+
std::shared_ptr< basic_parser< T > > scope_id
Scope ID (e.g. NIC index with link-local addresses)
Definition parser.hpp:2648
+
stdex::interval< size_t > components[8]
Individual component intervals.
Definition parser.hpp:2646
+
struct in6_addr value
IPv6 address value.
Definition parser.hpp:2647
+
Test for valid IPv6 address scope ID character.
Definition parser.hpp:2502
+
Test for repeating.
Definition parser.hpp:930
+
bool m_greedy
try to match as long sequence as possible
Definition parser.hpp:969
+
std::shared_ptr< basic_parser< T > > m_el
repeating element
Definition parser.hpp:966
+
size_t m_min_iterations
minimum number of iterations
Definition parser.hpp:967
+
size_t m_max_iterations
maximum number of iterations
Definition parser.hpp:968
+
Test for JSON string.
Definition parser.hpp:7221
+
MIME content type.
Definition parser.hpp:7769
+
stdex::interval< size_t > base_type
basic type position in source
Definition parser.hpp:7779
+
stdex::interval< size_t > sub_type
sub-type position in source
Definition parser.hpp:7780
+
stdex::interval< size_t > charset
charset position in source
Definition parser.hpp:7781
+
Test for mixed numeral.
Definition parser.hpp:1941
+
std::shared_ptr< basic_parser< T > > fraction
fraction
Definition parser.hpp:1974
+
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1972
+
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1971
+
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1970
+
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:1973
+
Test for monetary numeral.
Definition parser.hpp:2235
+
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2268
+
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2273
+
std::shared_ptr< basic_parser< T > > currency
Currency part.
Definition parser.hpp:2271
+
std::shared_ptr< basic_parser< T > > decimal
Decimal part.
Definition parser.hpp:2274
+
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2272
+
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2269
+
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2270
+
"No-op" match
Definition parser.hpp:204
+
Base template for all parsers.
Definition parser.hpp:80
+
stdex::interval< size_t > interval
Region of the last match.
Definition parser.hpp:120
+
Test for permutation.
Definition parser.hpp:1218
+
Test for phone number.
Definition parser.hpp:4504
+
std::basic_string< T > value
Normalized phone number.
Definition parser.hpp:4529
+
Test for any punctuation code unit.
Definition parser.hpp:481
+
Test for Roman numeral.
Definition parser.hpp:1590
+
Test for scientific numeral.
Definition parser.hpp:2066
+
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2112
+
std::shared_ptr< basic_parser< T > > exponent_symbol
Exponent symbol (e.g. 'e')
Definition parser.hpp:2116
+
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2110
+
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2111
+
double value
Calculated value of the numeral.
Definition parser.hpp:2120
+
std::shared_ptr< basic_parser< T > > negative_exp_sign
Negative exponent sign (e.g. '-')
Definition parser.hpp:2118
+
std::shared_ptr< basic_integer< T > > decimal
Decimal part.
Definition parser.hpp:2115
+
std::shared_ptr< basic_parser< T > > positive_exp_sign
Positive exponent sign (e.g. '+')
Definition parser.hpp:2117
+
std::shared_ptr< basic_integer< T > > exponent
Exponent part.
Definition parser.hpp:2119
+
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2114
+
std::shared_ptr< basic_integer< T > > integer
Integer part.
Definition parser.hpp:2113
+
Test for match score.
Definition parser.hpp:1769
+
Test for sequence.
Definition parser.hpp:1026
+
Definition parser.hpp:709
+
Test for SI Reference delimiter.
Definition parser.hpp:5139
+
Test for SI Reference part.
Definition parser.hpp:5093
+
Test for SI Reference.
Definition parser.hpp:5178
+
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5207
+
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5205
+
bool is_valid
Is reference valid.
Definition parser.hpp:5208
+
T model[3]
Reference model.
Definition parser.hpp:5204
+
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5206
+
Test for signed numeral.
Definition parser.hpp:1855
+
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1881
+
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1880
+
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1879
+
std::shared_ptr< basic_parser< T > > number
Number.
Definition parser.hpp:1882
+
Test for any space code unit.
Definition parser.hpp:401
+
Test for any space or punctuation code unit.
Definition parser.hpp:556
+
Test for any string.
Definition parser.hpp:1146
+
Test for given string.
Definition parser.hpp:835
+
Test for time.
Definition parser.hpp:4279
+
Test for valid URL password character.
Definition parser.hpp:3080
+
Test for valid URL path character.
Definition parser.hpp:3182
+
Test for URL path.
Definition parser.hpp:3292
+
Test for valid URL username character.
Definition parser.hpp:2979
+
Test for URL.
Definition parser.hpp:3432
+
Test for HTTP agent.
Definition parser.hpp:6765
+
Test for HTTP any type.
Definition parser.hpp:5908
+
Test for HTTP asterisk.
Definition parser.hpp:6536
+ + + + + +
Test for HTTP header.
Definition parser.hpp:7073
+
Test for HTTP language (RFC1766)
Definition parser.hpp:6404
+
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5590
+
Test for HTTP media range (RFC2616: media-range)
Definition parser.hpp:5940
+
Test for HTTP media type (RFC2616: media-type)
Definition parser.hpp:5992
+
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5856
+
http_token name
Parameter name.
Definition parser.hpp:5865
+
http_value value
Parameter value.
Definition parser.hpp:5866
+
Test for HTTP protocol.
Definition parser.hpp:6840
+
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:6862
+
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5749
+
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5758
+
Test for HTTP request.
Definition parser.hpp:6941
+
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5626
+
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5662
+
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5695
+
Test for HTTP URL parameter.
Definition parser.hpp:6229
+
Test for HTTP URL path segment.
Definition parser.hpp:6141
+
Test for HTTP URL path segment.
Definition parser.hpp:6174
+
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6182
+
Test for HTTP URL port.
Definition parser.hpp:6085
+
Test for HTTP URL server.
Definition parser.hpp:6048
+
Test for HTTP URL.
Definition parser.hpp:6306
+
Collection of HTTP values.
Definition parser.hpp:7177
+
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5812
+
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5821
+
http_token token
Value when matched as token.
Definition parser.hpp:5822
+
Test for HTTP weight factor.
Definition parser.hpp:6467
+
float value
Calculated value of the weight factor.
Definition parser.hpp:6480
+
Test for HTTP weighted value.
Definition parser.hpp:6559
+
Base template for collection-holding parsers.
Definition parser.hpp:986
+
Test for any SGML code point.
Definition parser.hpp:269
+
Test for any SGML code point from a given string of SGML code points.
Definition parser.hpp:792
+
Test for specific SGML code point.
Definition parser.hpp:357
+
Test for valid DNS domain SGML character.
Definition parser.hpp:2851
+
Test for valid IPv6 address scope ID SGML character.
Definition parser.hpp:2541
+
Test for any SGML punctuation code point.
Definition parser.hpp:522
+
Test for any SGML space code point.
Definition parser.hpp:444
+
Test for any SGML space or punctuation code point.
Definition parser.hpp:599
+
Test for SGML given string.
Definition parser.hpp:882
+
Test for valid URL password SGML character.
Definition parser.hpp:3133
+
Test for valid URL path SGML character.
Definition parser.hpp:3239
+
Test for valid URL username SGML character.
Definition parser.hpp:3031
Numerical interval.
Definition interval.hpp:18
T size() const
Returns interval size.
Definition interval.hpp:47
T end
interval end
Definition interval.hpp:20
interval() noexcept
Constructs an invalid interval.
Definition interval.hpp:25
void invalidate()
Invalidates interval.
Definition interval.hpp:59
T start
interval start
Definition interval.hpp:19
-
Tag attribute.
Definition parser.hpp:8043
-
stdex::interval< size_t > name
attribute name position in source
Definition parser.hpp:8044
-
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8045
-
Definition parser.hpp:7202
+
Tag attribute.
Definition parser.hpp:8044
+
stdex::interval< size_t > name
attribute name position in source
Definition parser.hpp:8045
+
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8046
+
Definition parser.hpp:7203
diff --git a/pch_8hpp_source.html b/pch_8hpp_source.html index 26cf98f43..58d730b73 100644 --- a/pch_8hpp_source.html +++ b/pch_8hpp_source.html @@ -209,7 +209,7 @@ $(function() { codefold.init(0); });
diff --git a/pool_8hpp_source.html b/pool_8hpp_source.html index 7d35b252e..e8ce79deb 100644 --- a/pool_8hpp_source.html +++ b/pool_8hpp_source.html @@ -189,7 +189,7 @@ $(function() { codefold.init(0); });
diff --git a/progress_8hpp_source.html b/progress_8hpp_source.html index 934501629..1b25ebcae 100644 --- a/progress_8hpp_source.html +++ b/progress_8hpp_source.html @@ -105,439 +105,441 @@ $(function() { codefold.init(0); });
22 {
23 public:
-
-
29 virtual void set_text(_In_z_ const char* msg)
-
30 {
-
31 _Unreferenced_(msg);
-
32 }
+
24 virtual ~progress() {}
+
25
+
+
31 virtual void set_text(_In_z_ const char* msg)
+
32 {
+
33 _Unreferenced_(msg);
+
34 }
-
33
-
-
40 virtual void set_range(_In_ T start, _In_ T end)
-
41 {
-
42 start; end;
-
43 }
+
35
+
+
42 virtual void set_range(_In_ T start, _In_ T end)
+
43 {
+
44 start; end;
+
45 }
-
44
-
-
50 virtual void set(_In_ T value)
-
51 {
-
52 value;
-
53 }
+
46
+
+
52 virtual void set(_In_ T value)
+
53 {
+
54 value;
+
55 }
-
54
-
-
60 virtual void show(_In_ bool show = true)
-
61 {
-
62 _Unreferenced_(show);
-
63 }
+
56
+
+
62 virtual void show(_In_ bool show = true)
+
63 {
+
64 _Unreferenced_(show);
+
65 }
-
64
-
-
68 virtual bool cancel()
-
69 {
-
70 return false;
-
71 }
+
66
+
+
70 virtual bool cancel()
+
71 {
+
72 return false;
+
73 }
-
72 };
+
74 };
-
73
-
79 template <class T>
-
-
80 class lazy_progress : public progress<T>
-
81 {
-
82 public:
-
-
88 lazy_progress(_In_ const std::chrono::nanoseconds& timeout = std::chrono::milliseconds(500)) :
-
89 m_timeout(timeout),
-
90 m_start(0),
-
91 m_end(0),
-
92 m_value(-1)
-
93 {}
+
75
+
81 template <class T>
+
+
82 class lazy_progress : public progress<T>
+
83 {
+
84 public:
+
+
90 lazy_progress(_In_ const std::chrono::nanoseconds& timeout = std::chrono::milliseconds(500)) :
+
91 m_timeout(timeout),
+
92 m_start(0),
+
93 m_end(0),
+
94 m_value(-1)
+
95 {}
-
94
-
-
101 virtual void set_range(_In_ T start, _In_ T end)
-
102 {
-
103 m_start = start;
-
104 m_end = end;
-
105 }
+
96
+
+
103 virtual void set_range(_In_ T start, _In_ T end)
+
104 {
+
105 m_start = start;
+
106 m_end = end;
+
107 }
-
106
-
-
112 virtual void set(_In_ T value)
-
113 {
-
114 if (value == m_start || value == m_end)
-
115 m_last = std::chrono::high_resolution_clock::now();
-
116 else if (value == m_value)
-
117 return;
-
118 else {
-
119 auto now = std::chrono::high_resolution_clock::now();
-
120 if (now - m_last < m_timeout)
-
121 return;
-
122 m_last = now;
-
123 }
-
124 m_value = value;
-
125 do_set();
-
126 }
+
108
+
+
114 virtual void set(_In_ T value)
+
115 {
+
116 if (value == m_start || value == m_end)
+
117 m_last = std::chrono::high_resolution_clock::now();
+
118 else if (value == m_value)
+
119 return;
+
120 else {
+
121 auto now = std::chrono::high_resolution_clock::now();
+
122 if (now - m_last < m_timeout)
+
123 return;
+
124 m_last = now;
+
125 }
+
126 m_value = value;
+
127 do_set();
+
128 }
-
127
-
128 protected:
-
132 virtual void do_set() {}
-
133
-
134 protected:
-
135 std::chrono::nanoseconds m_timeout;
-
136 std::chrono::system_clock::time_point m_last;
-
137 T m_start, m_end, m_value;
-
138 };
+
129
+
130 protected:
+
134 virtual void do_set() {}
+
135
+
136 protected:
+
137 std::chrono::nanoseconds m_timeout;
+
138 std::chrono::system_clock::time_point m_last;
+
139 T m_start, m_end, m_value;
+
140 };
-
139
-
145 template <class T>
-
-
146 class timeout_progress : public progress<T>
-
147 {
-
148 public:
-
-
154 timeout_progress(_In_ const std::chrono::nanoseconds& timeout = std::chrono::seconds(60), _In_opt_ progress<T>* host = nullptr) :
-
155 m_host(host),
-
156 m_deadline(std::chrono::high_resolution_clock::now() + timeout)
-
157 {}
+
141
+
147 template <class T>
+
+
148 class timeout_progress : public progress<T>
+
149 {
+
150 public:
+
+
156 timeout_progress(_In_ const std::chrono::nanoseconds& timeout = std::chrono::seconds(60), _In_opt_ progress<T>* host = nullptr) :
+
157 m_host(host),
+
158 m_deadline(std::chrono::high_resolution_clock::now() + timeout)
+
159 {}
-
158
-
-
164 virtual void set_text(_In_z_ const char* msg)
-
165 {
-
166 if (m_host)
-
167 m_host->set_text(msg);
-
168 }
+
160
+
+
166 virtual void set_text(_In_z_ const char* msg)
+
167 {
+
168 if (m_host)
+
169 m_host->set_text(msg);
+
170 }
-
169
-
-
176 virtual void set_range(_In_ T start, _In_ T end)
-
177 {
-
178 if (m_host)
-
179 m_host->set_range(start, end);
-
180 }
+
171
+
+
178 virtual void set_range(_In_ T start, _In_ T end)
+
179 {
+
180 if (m_host)
+
181 m_host->set_range(start, end);
+
182 }
-
181
-
-
187 virtual void set(_In_ T value)
-
188 {
-
189 if (m_host)
-
190 m_host->set(value);
-
191 }
+
183
+
+
189 virtual void set(_In_ T value)
+
190 {
+
191 if (m_host)
+
192 m_host->set(value);
+
193 }
-
192
-
-
198 virtual void show(_In_ bool show = true)
-
199 {
-
200 if (m_host)
-
201 m_host->show(show);
-
202 }
+
194
+
+
200 virtual void show(_In_ bool show = true)
+
201 {
+
202 if (m_host)
+
203 m_host->show(show);
+
204 }
-
203
-
-
207 virtual bool cancel()
-
208 {
-
209 return
-
210 (m_host && m_host->cancel()) ||
-
211 m_deadline < std::chrono::high_resolution_clock::now();
-
212 }
+
205
+
+
209 virtual bool cancel()
+
210 {
+
211 return
+
212 (m_host && m_host->cancel()) ||
+
213 m_deadline < std::chrono::high_resolution_clock::now();
+
214 }
-
213
-
214 protected:
-
215 progress<T>* m_host;
-
216 std::chrono::high_resolution_clock::time_point m_deadline;
-
217 };
+
215
+
216 protected:
+
217 progress<T>* m_host;
+
218 std::chrono::high_resolution_clock::time_point m_deadline;
+
219 };
-
218
-
224 template <class T>
-
-
225 class global_progress : public progress<T>
-
226 {
-
227 public:
-
-
233 global_progress(_In_opt_ progress<T>* host = nullptr) : m_host(host)
-
234 {}
+
220
+
226 template <class T>
+
+
227 class global_progress : public progress<T>
+
228 {
+
229 public:
+
+
235 global_progress(_In_opt_ progress<T>* host = nullptr) : m_host(host)
+
236 {}
-
235
-
-
241 void attach(_In_opt_ progress<T>* host)
-
242 {
-
243 m_host = host;
-
244 }
+
237
+
+
243 void attach(_In_opt_ progress<T>* host)
+
244 {
+
245 m_host = host;
+
246 }
-
245
-
- -
252 {
-
253 progress<T>* k = m_host;
-
254 m_host = nullptr;
-
255 return k;
-
256 }
+
247
+
+ +
254 {
+
255 progress<T>* k = m_host;
+
256 m_host = nullptr;
+
257 return k;
+
258 }
-
257
-
-
264 void set_global_range(_In_ T start, _In_ T end)
-
265 {
-
266 m_global.start = start;
-
267 m_global.end = end;
-
268 if (m_host)
-
269 m_host->set_range(m_global.start, m_global.end);
-
270 }
+
259
+
+
266 void set_global_range(_In_ T start, _In_ T end)
+
267 {
+
268 m_global.start = start;
+
269 m_global.end = end;
+
270 if (m_host)
+
271 m_host->set_range(m_global.start, m_global.end);
+
272 }
-
271
-
-
278 void set_section_range(_In_ T start, _In_ T end)
-
279 {
-
280 m_section.start = start;
-
281 m_section.end = end;
-
282 }
+
273
+
+
280 void set_section_range(_In_ T start, _In_ T end)
+
281 {
+
282 m_section.start = start;
+
283 m_section.end = end;
+
284 }
-
283
-
-
289 virtual void set_text(_In_ const char* msg)
-
290 {
-
291 if (m_host)
-
292 m_host->set_text(msg);
-
293 }
+
285
+
+
291 virtual void set_text(_In_ const char* msg)
+
292 {
+
293 if (m_host)
+
294 m_host->set_text(msg);
+
295 }
-
294
-
-
301 virtual void set_range(_In_ T start, _In_ T end)
-
302 {
-
303 m_local.start = start;
-
304 m_local.end = end;
-
305 }
+
296
+
+
303 virtual void set_range(_In_ T start, _In_ T end)
+
304 {
+
305 m_local.start = start;
+
306 m_local.end = end;
+
307 }
-
306
-
-
312 virtual void set(_In_ T value)
-
313 {
-
314 if (m_host) {
-
315 T size = m_local.size();
-
316 if (size != 0) {
-
317 // TODO: Implement with muldiv.
-
318 m_host->set(((value - m_local.start) * m_section.size() / size) + m_section.start);
-
319 }
-
320 }
-
321 }
+
308
+
+
314 virtual void set(_In_ T value)
+
315 {
+
316 if (m_host) {
+
317 T size = m_local.size();
+
318 if (size != 0) {
+
319 // TODO: Implement with muldiv.
+
320 m_host->set(((value - m_local.start) * m_section.size() / size) + m_section.start);
+
321 }
+
322 }
+
323 }
-
322
-
-
328 virtual void show(_In_ bool show = true)
-
329 {
-
330 if (m_host)
-
331 m_host->show(show);
-
332 }
+
324
+
+
330 virtual void show(_In_ bool show = true)
+
331 {
+
332 if (m_host)
+
333 m_host->show(show);
+
334 }
-
333
-
-
337 virtual bool cancel()
-
338 {
-
339 return m_host && m_host->cancel();
-
340 }
+
335
+
+
339 virtual bool cancel()
+
340 {
+
341 return m_host && m_host->cancel();
+
342 }
-
341
-
342 protected:
-
343 progress<T>* m_host;
-
344 interval<T> m_local, m_global, m_section;
-
345 };
+
343
+
344 protected:
+
345 progress<T>* m_host;
+
346 interval<T> m_local, m_global, m_section;
+
347 };
-
346
-
352 template <class T>
-
- -
354 {
-
355 public:
- -
357 global_progress<T>(host),
-
358 m_host_ref(host)
-
359 {
-
360 m_host_ref = this;
-
361 }
-
362
- -
364 {
-
365 m_host_ref = this->detach();
-
366 }
-
367
-
368 protected:
-
369 progress<T>*& m_host_ref;
-
370 };
+
348
+
354 template <class T>
+
+ +
356 {
+
357 public:
+ +
359 global_progress<T>(host),
+
360 m_host_ref(host)
+
361 {
+
362 m_host_ref = this;
+
363 }
+
364
+ +
366 {
+
367 m_host_ref = this->detach();
+
368 }
+
369
+
370 protected:
+
371 progress<T>*& m_host_ref;
+
372 };
-
371
-
377 template <class T>
-
- -
379 {
-
380 protected:
-
-
384 class worker_progress : public progress<T>
-
385 {
-
386 protected:
-
387 aggregate_progress<T>& m_host;
-
388 T m_start, m_end, m_value;
-
389
-
390 public:
- -
392 m_host(host),
-
393 m_start(0), m_end(0),
-
394 m_value(0)
-
395 {}
-
396
-
-
402 virtual void set_text(_In_ const char* msg)
-
403 {
-
404 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
-
405 if (m_host.m_host)
-
406 m_host.m_host->set_text(msg);
-
407 }
+
373
+
379 template <class T>
+
+ +
381 {
+
382 protected:
+
+
386 class worker_progress : public progress<T>
+
387 {
+
388 protected:
+
389 aggregate_progress<T>& m_host;
+
390 T m_start, m_end, m_value;
+
391
+
392 public:
+ +
394 m_host(host),
+
395 m_start(0), m_end(0),
+
396 m_value(0)
+
397 {}
+
398
+
+
404 virtual void set_text(_In_ const char* msg)
+
405 {
+
406 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
+
407 if (m_host.m_host)
+
408 m_host.m_host->set_text(msg);
+
409 }
-
408
-
-
415 virtual void set_range(_In_ T start, _In_ T end)
-
416 {
-
417 T
-
418 combined_start = m_host.m_start += start - m_start,
-
419 combined_end = m_host.m_end += end - m_end;
-
420 m_start = start;
-
421 m_end = end;
-
422 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
-
423 if (m_host.m_host)
-
424 m_host.m_host->set_range(combined_start, combined_end);
-
425 }
+
410
+
+
417 virtual void set_range(_In_ T start, _In_ T end)
+
418 {
+
419 T
+
420 combined_start = m_host.m_start += start - m_start,
+
421 combined_end = m_host.m_end += end - m_end;
+
422 m_start = start;
+
423 m_end = end;
+
424 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
+
425 if (m_host.m_host)
+
426 m_host.m_host->set_range(combined_start, combined_end);
+
427 }
-
426
-
-
432 virtual void set(_In_ T value)
-
433 {
-
434 T combined_value = m_host.m_value += value - m_value;
-
435 m_value = value;
-
436 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
-
437 if (m_host.m_host)
-
438 m_host.m_host->set(combined_value);
-
439 }
+
428
+
+
434 virtual void set(_In_ T value)
+
435 {
+
436 T combined_value = m_host.m_value += value - m_value;
+
437 m_value = value;
+
438 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
+
439 if (m_host.m_host)
+
440 m_host.m_host->set(combined_value);
+
441 }
-
440
-
-
446 virtual void show(_In_ bool show = true)
-
447 {
-
448 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
-
449 if (m_host.m_host)
-
450 m_host.m_host->show(show);
-
451 }
+
442
+
+
448 virtual void show(_In_ bool show = true)
+
449 {
+
450 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
+
451 if (m_host.m_host)
+
452 m_host.m_host->show(show);
+
453 }
-
452
-
-
456 virtual bool cancel()
-
457 {
-
458 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
-
459 return m_host.m_host && m_host.m_host->cancel();
-
460 }
+
454
+
+
458 virtual bool cancel()
+
459 {
+
460 std::shared_lock<std::shared_mutex> lk(m_host.m_mutex);
+
461 return m_host.m_host && m_host.m_host->cancel();
+
462 }
-
461 };
+
463 };
-
462
-
463 progress<T>* m_host;
-
464 std::atomic<T> m_start, m_end, m_value;
-
465 std::vector<worker_progress> m_workers;
-
466 std::shared_mutex m_mutex;
-
467
-
468 public:
-
-
475 aggregate_progress(_In_ size_t num_workers, _In_opt_ progress<T>* host = nullptr) :
-
476 m_host(host),
-
477 m_start(0), m_end(0),
-
478 m_value(0)
-
479 {
-
480 m_workers.reserve(num_workers);
-
481 for (size_t i = 0; i < num_workers; ++i)
-
482 m_workers.push_back(std::move(worker_progress(*this)));
-
483 if (m_host) {
-
484 m_host->set_range(m_start, m_end);
-
485 m_host->set(m_value);
-
486 }
-
487 }
+
464
+
465 progress<T>* m_host;
+
466 std::atomic<T> m_start, m_end, m_value;
+
467 std::vector<worker_progress> m_workers;
+
468 std::shared_mutex m_mutex;
+
469
+
470 public:
+
+
477 aggregate_progress(_In_ size_t num_workers, _In_opt_ progress<T>* host = nullptr) :
+
478 m_host(host),
+
479 m_start(0), m_end(0),
+
480 m_value(0)
+
481 {
+
482 m_workers.reserve(num_workers);
+
483 for (size_t i = 0; i < num_workers; ++i)
+
484 m_workers.push_back(std::move(worker_progress(*this)));
+
485 if (m_host) {
+
486 m_host->set_range(m_start, m_end);
+
487 m_host->set(m_value);
+
488 }
+
489 }
-
488
-
-
494 void attach(_In_opt_ progress<T>* host)
-
495 {
-
496 std::unique_lock<std::shared_mutex> lk(m_mutex);
-
497 m_host = host;
-
498 if (m_host) {
-
499 m_host->set_range(m_start, m_end);
-
500 m_host->set(m_value);
-
501 }
-
502 }
+
490
+
+
496 void attach(_In_opt_ progress<T>* host)
+
497 {
+
498 std::unique_lock<std::shared_mutex> lk(m_mutex);
+
499 m_host = host;
+
500 if (m_host) {
+
501 m_host->set_range(m_start, m_end);
+
502 m_host->set(m_value);
+
503 }
+
504 }
-
503
-
- -
510 {
-
511 std::unique_lock<std::shared_mutex> lk(m_mutex);
-
512 progress<T>* k = m_host;
-
513 m_host = nullptr;
-
514 return k;
-
515 }
+
505
+
+ +
512 {
+
513 std::unique_lock<std::shared_mutex> lk(m_mutex);
+
514 progress<T>* k = m_host;
+
515 m_host = nullptr;
+
516 return k;
+
517 }
-
516
-
-
524 progress<T>& operator[](_In_ size_t index)
-
525 {
-
526 return m_workers[index];
-
527 }
+
518
+
+
526 progress<T>& operator[](_In_ size_t index)
+
527 {
+
528 return m_workers[index];
+
529 }
-
528 };
+
530 };
-
529}
-
Progress indicator for individual worker.
Definition progress.hpp:385
-
virtual void set(T value)
Set local current progress.
Definition progress.hpp:432
-
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:456
-
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:446
-
virtual void set_range(T start, T end)
Set local extend of the progress indicator.
Definition progress.hpp:415
-
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:402
-
Aggregated progress indicator.
Definition progress.hpp:379
-
progress< T > & operator[](size_t index)
Returns progress indicator for specific worker.
Definition progress.hpp:524
-
void attach(progress< T > *host)
Attach to a host progress indicator.
Definition progress.hpp:494
-
progress< T > * detach()
Detach host progress indicator.
Definition progress.hpp:509
-
aggregate_progress(size_t num_workers, progress< T > *host=nullptr)
Constructs a progress indicator.
Definition progress.hpp:475
-
Global progress indicator.
Definition progress.hpp:226
-
void set_section_range(T start, T end)
Set section extend of the progress indicator.
Definition progress.hpp:278
-
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:328
-
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:337
-
virtual void set(T value)
Set local current progress.
Definition progress.hpp:312
-
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:289
-
progress< T > * detach()
Detach host progress indicator.
Definition progress.hpp:251
-
void set_global_range(T start, T end)
Set global extend of the progress indicator.
Definition progress.hpp:264
-
global_progress(progress< T > *host=nullptr)
Constructs a progress indicator.
Definition progress.hpp:233
-
void attach(progress< T > *host)
Attach to a host progress indicator.
Definition progress.hpp:241
-
virtual void set_range(T start, T end)
Set local extend of the progress indicator.
Definition progress.hpp:301
-
Lazy progress indicator.
Definition progress.hpp:81
-
lazy_progress(const std::chrono::nanoseconds &timeout=std::chrono::milliseconds(500))
Constructs a lazy progress indicator.
Definition progress.hpp:88
-
virtual void set(T value)
Set current progress.
Definition progress.hpp:112
-
virtual void do_set()
Called when progress reporting is due. Should override this method to implement actual progress refre...
Definition progress.hpp:132
-
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:101
-
Progress indicator switcher.
Definition progress.hpp:354
+
531}
+
Progress indicator for individual worker.
Definition progress.hpp:387
+
virtual void set(T value)
Set local current progress.
Definition progress.hpp:434
+
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:458
+
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:448
+
virtual void set_range(T start, T end)
Set local extend of the progress indicator.
Definition progress.hpp:417
+
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:404
+
Aggregated progress indicator.
Definition progress.hpp:381
+
progress< T > & operator[](size_t index)
Returns progress indicator for specific worker.
Definition progress.hpp:526
+
void attach(progress< T > *host)
Attach to a host progress indicator.
Definition progress.hpp:496
+
progress< T > * detach()
Detach host progress indicator.
Definition progress.hpp:511
+
aggregate_progress(size_t num_workers, progress< T > *host=nullptr)
Constructs a progress indicator.
Definition progress.hpp:477
+
Global progress indicator.
Definition progress.hpp:228
+
void set_section_range(T start, T end)
Set section extend of the progress indicator.
Definition progress.hpp:280
+
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:330
+
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:339
+
virtual void set(T value)
Set local current progress.
Definition progress.hpp:314
+
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:291
+
progress< T > * detach()
Detach host progress indicator.
Definition progress.hpp:253
+
void set_global_range(T start, T end)
Set global extend of the progress indicator.
Definition progress.hpp:266
+
global_progress(progress< T > *host=nullptr)
Constructs a progress indicator.
Definition progress.hpp:235
+
void attach(progress< T > *host)
Attach to a host progress indicator.
Definition progress.hpp:243
+
virtual void set_range(T start, T end)
Set local extend of the progress indicator.
Definition progress.hpp:303
+
Lazy progress indicator.
Definition progress.hpp:83
+
lazy_progress(const std::chrono::nanoseconds &timeout=std::chrono::milliseconds(500))
Constructs a lazy progress indicator.
Definition progress.hpp:90
+
virtual void set(T value)
Set current progress.
Definition progress.hpp:114
+
virtual void do_set()
Called when progress reporting is due. Should override this method to implement actual progress refre...
Definition progress.hpp:134
+
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:103
+
Progress indicator switcher.
Definition progress.hpp:356
Progress indicator base class.
Definition progress.hpp:22
-
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:68
-
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:29
-
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:60
-
virtual void set(T value)
Set current progress.
Definition progress.hpp:50
-
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:40
-
Timeout progress indicator.
Definition progress.hpp:147
-
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:176
-
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:164
-
virtual void set(T value)
Set current progress.
Definition progress.hpp:187
-
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:207
-
timeout_progress(const std::chrono::nanoseconds &timeout=std::chrono::seconds(60), progress< T > *host=nullptr)
Constructs a timeout progress indicator.
Definition progress.hpp:154
-
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:198
+
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:70
+
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:31
+
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:62
+
virtual void set(T value)
Set current progress.
Definition progress.hpp:52
+
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:42
+
Timeout progress indicator.
Definition progress.hpp:149
+
virtual void set_range(T start, T end)
Set progress range extent.
Definition progress.hpp:178
+
virtual void set_text(const char *msg)
Set progress indicator text.
Definition progress.hpp:166
+
virtual void set(T value)
Set current progress.
Definition progress.hpp:189
+
virtual bool cancel()
Query whether user requested abort.
Definition progress.hpp:209
+
timeout_progress(const std::chrono::nanoseconds &timeout=std::chrono::seconds(60), progress< T > *host=nullptr)
Constructs a timeout progress indicator.
Definition progress.hpp:156
+
virtual void show(bool show=true)
Show or hide progress.
Definition progress.hpp:200
Numerical interval.
Definition interval.hpp:18
diff --git a/ring_8hpp_source.html b/ring_8hpp_source.html index 5fa8762a5..dc07e153a 100644 --- a/ring_8hpp_source.html +++ b/ring_8hpp_source.html @@ -234,7 +234,7 @@ $(function() { codefold.init(0); });
diff --git a/sgml_8hpp_source.html b/sgml_8hpp_source.html index 22b3fa722..2926dbc3c 100644 --- a/sgml_8hpp_source.html +++ b/sgml_8hpp_source.html @@ -100,690 +100,699 @@ $(function() { codefold.init(0); });
14#include <string_view>
15#include <string>
16
-
17namespace stdex
-
18{
-
20 template <class T>
-
21 const wchar_t* sgml2uni(_In_reads_or_z_(count) const T* entity, _In_ size_t count)
-
22 {
-
23 _Assume_(entity && count);
-
24 _Assume_(count < 2 || entity[0] != '#'); // No numeric entities
-
25
-
26 for (size_t i = 0, j = _countof(sgml_unicode); i < j; ) {
-
27 size_t m = (i + j) / 2;
-
28 if (sgml_unicode[m].sgml[0] < entity[0])
-
29 i = m + 1;
-
30 else if (sgml_unicode[m].sgml[0] > entity[0])
-
31 j = m;
-
32 else {
-
33 auto r = strncmp<char, T>(sgml_unicode[m].sgml + 1, _countof(sgml_unicode[0].sgml) - 1, entity + 1, count - 1);
-
34 if (r < 0)
-
35 i = m + 1;
-
36 else if (r > 0)
-
37 j = m;
-
38 else {
-
39 for (; i < m && strncmp<char, T>(sgml_unicode[m - 1].sgml, _countof(sgml_unicode[0].sgml), entity, count) == 0; m--);
-
40 return sgml_unicode[m].unicode;
-
41 }
-
42 }
-
43 }
-
44 return nullptr;
-
45 }
-
46
-
47 template <class T>
-
48 const T* sgmlend(
-
49 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count)
-
50 {
-
51 _Assume_(str || !count);
-
52 for (size_t i = 0; i < count; i++) {
-
53 if (str[i] == ';')
-
54 return str + i;
-
55 if (!str[i] || str[i] == '&' || isspace(str[i]))
-
56 break;
-
57 }
-
58 return nullptr;
-
59 }
-
61
-
62 constexpr int sgml_full = 0x40000000;
-
63 constexpr int sgml_quot = 0x00000001;
-
64 constexpr int sgml_apos = 0x00000002;
-
65 constexpr int sgml_quot_apos = sgml_quot | sgml_apos;
-
66 constexpr int sgml_amp = 0x00000004;
-
67 constexpr int sgml_lt_gt = 0x00000008;
-
68 constexpr int sgml_bsol = 0x00000010;
-
69 constexpr int sgml_dollar = 0x00000020;
-
70 constexpr int sgml_percnt = 0x00000040;
-
71 constexpr int sgml_commat = 0x00000080;
-
72 constexpr int sgml_num = 0x00000100;
-
73 constexpr int sgml_lpar_rpar = 0x00000200;
-
74 constexpr int sgml_lcub_rcub = 0x00000400;
-
75 constexpr int sgml_lsqb_rsqb = 0x00000800;
-
76 constexpr int sgml_sgml = sgml_amp | sgml_lt_gt;
-
77 constexpr int sgml_ml_attrib = sgml_amp | sgml_quot_apos;
-
78 constexpr int sgml_c = sgml_amp | sgml_bsol | sgml_quot_apos;
-
79 // constexpr int sgml_kolos = sgml_amp | sgml_quot | sgml_dollar | sgml_percnt | sgml_lt_gt | sgml_bsol/* | sgml_commat | sgml_num*/ | sgml_lpar_rpar | sgml_lcub_rcub | sgml_lsqb_rsqb;
-
80
-
90 template <class T_from>
-
91 size_t sgmlerr(
-
92 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
-
93 _In_ int what = 0)
-
94 {
-
95 _Assume_(src || !count_src);
-
96
-
97 const bool
-
98 do_ascii = (what & sgml_full) == 0;
-
99
-
100 for (size_t i = 0; i < count_src && src[i];) {
-
101 if (src[i] == '&') {
-
102 auto end = sgmlend(src + i + 1, count_src - i - 1);
-
103 if (end) {
-
104 const wchar_t* entity_w;
-
105 wchar_t chr[3];
-
106 size_t n = end - src - i - 1;
-
107 if (n >= 2 && src[i + 1] == '#') {
-
108 utf32_t unicode;
-
109 if (src[i + 2] == 'x' || src[i + 2] == 'X')
-
110 unicode = strtou32(src + i + 3, n - 2, nullptr, 16);
-
111 else
-
112 unicode = strtou32(src + i + 2, n - 1, nullptr, 10);
-
113#ifdef _WIN32
-
114 if (unicode < 0x10000) {
-
115 chr[0] = (wchar_t)unicode;
-
116 chr[1] = 0;
-
117 }
-
118 else {
-
119 ucs4_to_surrogate_pair(chr, unicode);
-
120 chr[2] = 0;
-
121 }
-
122#else
-
123 chr[0] = (wchar_t)unicode;
-
124 chr[1] = 0;
-
125#endif
-
126 entity_w = chr;
-
127 }
-
128 else
-
129 entity_w = sgml2uni(src + i + 1, n);
-
130
-
131 if (entity_w) {
-
132 i = end - src + 1;
-
133 continue;
-
134 }
+
17#if defined(__GNUC__)
+
18#pragma GCC diagnostic push
+
19#pragma GCC diagnostic ignored "-Wexit-time-destructors"
+
20#endif
+
21
+
22namespace stdex
+
23{
+
25 template <class T>
+
26 const wchar_t* sgml2uni(_In_reads_or_z_(count) const T* entity, _In_ size_t count)
+
27 {
+
28 _Assume_(entity && count);
+
29 _Assume_(count < 2 || entity[0] != '#'); // No numeric entities
+
30
+
31 for (size_t i = 0, j = _countof(sgml_unicode); i < j; ) {
+
32 size_t m = (i + j) / 2;
+
33 if (sgml_unicode[m].sgml[0] < entity[0])
+
34 i = m + 1;
+
35 else if (sgml_unicode[m].sgml[0] > entity[0])
+
36 j = m;
+
37 else {
+
38 auto r = strncmp<char, T>(sgml_unicode[m].sgml + 1, _countof(sgml_unicode[0].sgml) - 1, entity + 1, count - 1);
+
39 if (r < 0)
+
40 i = m + 1;
+
41 else if (r > 0)
+
42 j = m;
+
43 else {
+
44 for (; i < m && strncmp<char, T>(sgml_unicode[m - 1].sgml, _countof(sgml_unicode[0].sgml), entity, count) == 0; m--);
+
45 return sgml_unicode[m].unicode;
+
46 }
+
47 }
+
48 }
+
49 return nullptr;
+
50 }
+
51
+
52 template <class T>
+
53 const T* sgmlend(
+
54 _In_reads_or_z_opt_(count) const T* str, _In_ size_t count)
+
55 {
+
56 _Assume_(str || !count);
+
57 for (size_t i = 0; i < count; i++) {
+
58 if (str[i] == ';')
+
59 return str + i;
+
60 if (!str[i] || str[i] == '&' || isspace(str[i]))
+
61 break;
+
62 }
+
63 return nullptr;
+
64 }
+
66
+
67 constexpr int sgml_full = 0x40000000;
+
68 constexpr int sgml_quot = 0x00000001;
+
69 constexpr int sgml_apos = 0x00000002;
+
70 constexpr int sgml_quot_apos = sgml_quot | sgml_apos;
+
71 constexpr int sgml_amp = 0x00000004;
+
72 constexpr int sgml_lt_gt = 0x00000008;
+
73 constexpr int sgml_bsol = 0x00000010;
+
74 constexpr int sgml_dollar = 0x00000020;
+
75 constexpr int sgml_percnt = 0x00000040;
+
76 constexpr int sgml_commat = 0x00000080;
+
77 constexpr int sgml_num = 0x00000100;
+
78 constexpr int sgml_lpar_rpar = 0x00000200;
+
79 constexpr int sgml_lcub_rcub = 0x00000400;
+
80 constexpr int sgml_lsqb_rsqb = 0x00000800;
+
81 constexpr int sgml_sgml = sgml_amp | sgml_lt_gt;
+
82 constexpr int sgml_ml_attrib = sgml_amp | sgml_quot_apos;
+
83 constexpr int sgml_c = sgml_amp | sgml_bsol | sgml_quot_apos;
+
84 // constexpr int sgml_kolos = sgml_amp | sgml_quot | sgml_dollar | sgml_percnt | sgml_lt_gt | sgml_bsol/* | sgml_commat | sgml_num*/ | sgml_lpar_rpar | sgml_lcub_rcub | sgml_lsqb_rsqb;
+
85
+
95 template <class T_from>
+
96 size_t sgmlerr(
+
97 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
+
98 _In_ int what = 0)
+
99 {
+
100 _Assume_(src || !count_src);
+
101
+
102 const bool
+
103 do_ascii = (what & sgml_full) == 0;
+
104
+
105 for (size_t i = 0; i < count_src && src[i];) {
+
106 if (src[i] == '&') {
+
107 auto end = sgmlend(src + i + 1, count_src - i - 1);
+
108 if (end) {
+
109 const wchar_t* entity_w;
+
110 wchar_t chr[3];
+
111 size_t n = end - src - i - 1;
+
112 if (n >= 2 && src[i + 1] == '#') {
+
113 utf32_t unicode;
+
114 if (src[i + 2] == 'x' || src[i + 2] == 'X')
+
115 unicode = strtou32(src + i + 3, n - 2, nullptr, 16);
+
116 else
+
117 unicode = strtou32(src + i + 2, n - 1, nullptr, 10);
+
118#ifdef _WIN32
+
119 if (unicode < 0x10000) {
+
120 chr[0] = (wchar_t)unicode;
+
121 chr[1] = 0;
+
122 }
+
123 else {
+
124 ucs4_to_surrogate_pair(chr, unicode);
+
125 chr[2] = 0;
+
126 }
+
127#else
+
128 chr[0] = (wchar_t)unicode;
+
129 chr[1] = 0;
+
130#endif
+
131 entity_w = chr;
+
132 }
+
133 else
+
134 entity_w = sgml2uni(src + i + 1, n);
135
-
136 // Unknown entity.
-
137 return i;
-
138 }
-
139
-
140 // Unterminated entity.
-
141 return i;
-
142 }
-
143
-
144 if (do_ascii && !is7bit(src[i])) {
-
145 // Non-ASCII character
+
136 if (entity_w) {
+
137 i = end - src + 1;
+
138 continue;
+
139 }
+
140
+
141 // Unknown entity.
+
142 return i;
+
143 }
+
144
+
145 // Unterminated entity.
146 return i;
147 }
-
148 i++;
-
149 }
-
150
-
151 return npos;
-
152 }
-
153
-
164 template <class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
165 void sgml2strcat(
-
166 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
167 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
-
168 _In_ int skip = 0,
-
169 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
170 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
171 {
-
172 _Assume_(src || !count_src);
-
173
-
174 const bool
-
175 skip_quot = (skip & sgml_quot) == 0,
-
176 skip_apos = (skip & sgml_apos) == 0,
-
177 skip_amp = (skip & sgml_amp) == 0,
-
178 skip_lt_gt = (skip & sgml_lt_gt) == 0,
-
179 skip_bsol = (skip & sgml_bsol) == 0,
-
180 skip_dollar = (skip & sgml_dollar) == 0,
-
181 skip_percnt = (skip & sgml_percnt) == 0,
-
182 skip_commat = (skip & sgml_commat) == 0,
-
183 skip_num = (skip & sgml_num) == 0,
-
184 skip_lpar_rpar = (skip & sgml_lpar_rpar) == 0,
-
185 skip_lcub_rcub = (skip & sgml_lcub_rcub) == 0,
-
186 skip_lsqb_rsqb = (skip & sgml_lsqb_rsqb) == 0;
-
187
-
188 count_src = strnlen(src, count_src);
-
189 dst.reserve(dst.size() + count_src);
-
190 for (size_t i = 0; i < count_src;) {
-
191 if (src[i] == '&') {
-
192 auto end = sgmlend(src + i + 1, count_src - i - 1);
-
193 if (end) {
-
194 const wchar_t* entity_w;
-
195 wchar_t chr[3];
-
196 _Assume_(src + i + 1 <= end);
-
197 size_t n = static_cast<size_t>(end - src) - i - 1;
-
198 if (n >= 2 && src[i + 1] == '#') {
-
199 utf32_t unicode;
-
200 if (src[i + 2] == 'x' || src[i + 2] == 'X')
-
201 unicode = static_cast<utf32_t>(strtou32(src + i + 3, n - 2, nullptr, 16));
-
202 else
-
203 unicode = static_cast<utf32_t>(strtou32(src + i + 2, n - 1, nullptr, 10));
-
204#ifdef _WIN32
-
205 if (unicode < 0x10000) {
-
206 chr[0] = (wchar_t)unicode;
-
207 chr[1] = 0;
-
208 }
-
209 else {
-
210 ucs4_to_surrogate_pair(chr, unicode);
-
211 chr[2] = 0;
-
212 }
-
213#else
-
214 chr[0] = (wchar_t)unicode;
-
215 chr[1] = 0;
-
216#endif
-
217 entity_w = chr;
-
218 }
-
219 else
-
220 entity_w = sgml2uni(src + i + 1, n);
-
221
-
222 if (entity_w &&
-
223 (skip_quot || (entity_w[0] != L'"')) &&
-
224 (skip_apos || (entity_w[0] != L'\'')) &&
-
225 (skip_amp || (entity_w[0] != L'&')) &&
-
226 (skip_lt_gt || (entity_w[0] != L'<' && entity_w[0] != L'>')) &&
-
227 (skip_bsol || (entity_w[0] != L'\\')) &&
-
228 (skip_dollar || (entity_w[0] != L'$')) &&
-
229 (skip_percnt || (entity_w[0] != L'%')) &&
-
230 (skip_commat || (entity_w[0] != L'@')) &&
-
231 (skip_num || (entity_w[0] != L'#')) &&
-
232 (skip_lpar_rpar || (entity_w[0] != L'(' && entity_w[0] != L')')) &&
-
233 (skip_lcub_rcub || (entity_w[0] != L'{' && entity_w[0] != L'}')) &&
-
234 (skip_lsqb_rsqb || (entity_w[0] != L'[' && entity_w[0] != L']')))
-
235 {
-
236 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + dst.size()));
-
237 dst.append(entity_w);
-
238 _Assume_(src <= end);
-
239 i = static_cast<size_t>(end - src) + 1;
-
240 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + dst.size()));
-
241 continue;
-
242 }
-
243 }
-
244 }
-
245 dst.append(1, src[i++]);
-
246 }
-
247 }
-
248
-
258 template <class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>, class TR_from = std::char_traits<T_from>, class AX_from = std::allocator<T_from>>
-
259 void sgml2strcat(
-
260 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
261 _In_ const std::basic_string<T_from, TR_from, AX_from>& src,
-
262 _In_ int skip = 0,
-
263 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
264 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
265 {
-
266 sgml2strcat(dst, src.data(), src.size(), skip, offset, map);
-
267 }
-
268
-
282 template <class T_from>
-
283 size_t sgml2strcat(
-
284 _Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst,
-
285 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
-
286 _In_ int skip = 0,
-
287 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
288 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
289 {
-
290 _Assume_(dst || !count_dst);
-
291 _Assume_(src || !count_src);
-
292
-
293 static const std::invalid_argument buffer_overrun("buffer overrun");
-
294 const bool
-
295 skip_quot = (skip & sgml_quot) == 0,
-
296 skip_apos = (skip & sgml_apos) == 0,
-
297 skip_amp = (skip & sgml_amp) == 0,
-
298 skip_lt_gt = (skip & sgml_lt_gt) == 0,
-
299 skip_bsol = (skip & sgml_bsol) == 0,
-
300 skip_dollar = (skip & sgml_dollar) == 0,
-
301 skip_percnt = (skip & sgml_percnt) == 0,
-
302 skip_commat = (skip & sgml_commat) == 0,
-
303 skip_num = (skip & sgml_num) == 0,
-
304 skip_lpar_rpar = (skip & sgml_lpar_rpar) == 0,
-
305 skip_lcub_rcub = (skip & sgml_lcub_rcub) == 0,
-
306 skip_lsqb_rsqb = (skip & sgml_lsqb_rsqb) == 0;
-
307
-
308 size_t j = strnlen(dst, count_dst);
-
309 count_src = strnlen(src, count_src);
-
310 for (size_t i = 0; i < count_src;) {
-
311 if (src[i] == '&') {
-
312 auto end = sgmlend(src + i + 1, count_src - i - 1);
-
313 if (end) {
-
314 const wchar_t* entity_w;
-
315 wchar_t chr[3];
-
316 size_t n = end - src - i - 1;
-
317 if (n >= 2 && src[i + 1] == '#') {
-
318 utf32_t unicode;
-
319 if (src[i + 2] == 'x' || src[i + 2] == 'X')
-
320 unicode = strtou32(src + i + 3, n - 2, nullptr, 16);
-
321 else
-
322 unicode = strtou32(src + i + 2, n - 1, nullptr, 10);
-
323#ifdef _WIN32
-
324 if (unicode < 0x10000) {
-
325 chr[0] = (wchar_t)unicode;
-
326 chr[1] = 0;
-
327 }
-
328 else {
-
329 ucs4_to_surrogate_pair(chr, unicode);
-
330 chr[2] = 0;
-
331 }
-
332#else
-
333 chr[0] = (wchar_t)unicode;
-
334 chr[1] = 0;
-
335#endif
-
336 entity_w = chr;
-
337 }
-
338 else
-
339 entity_w = sgml2uni(src + i + 1, n);
-
340
-
341 if (entity_w &&
-
342 (skip_quot || (entity_w[0] != L'"')) &&
-
343 (skip_apos || (entity_w[0] != L'\'')) &&
-
344 (skip_amp || (entity_w[0] != L'&')) &&
-
345 (skip_lt_gt || (entity_w[0] != L'<' && entity_w[0] != L'>')) &&
-
346 (skip_bsol || (entity_w[0] != L'\\')) &&
-
347 (skip_dollar || (entity_w[0] != L'$')) &&
-
348 (skip_percnt || (entity_w[0] != L'%')) &&
-
349 (skip_commat || (entity_w[0] != L'@')) &&
-
350 (skip_num || (entity_w[0] != L'#')) &&
-
351 (skip_lpar_rpar || (entity_w[0] != L'(' && entity_w[0] != L')')) &&
-
352 (skip_lcub_rcub || (entity_w[0] != L'{' && entity_w[0] != L'}')) &&
-
353 (skip_lsqb_rsqb || (entity_w[0] != L'[' && entity_w[0] != L']')))
-
354 {
-
355 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + j));
-
356 size_t m = wcslen(entity_w);
-
357 if (j + m >= count_dst)
-
358 throw buffer_overrun;
-
359 memcpy(dst + j, entity_w, m * sizeof(wchar_t)); j += m;
-
360 i = end - src + 1;
-
361 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + j));
-
362 continue;
-
363 }
-
364 }
-
365 }
-
366 if (j + 1 >= count_dst)
-
367 throw buffer_overrun;
-
368 dst[j++] = src[i++];
-
369 }
-
370 if (j >= count_dst)
-
371 throw buffer_overrun;
-
372 dst[j] = 0;
-
373 return j;
-
374 }
-
375
-
386 template <class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
387 void sgml2strcpy(
-
388 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
389 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
-
390 _In_ int skip = 0,
-
391 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
392 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
393 {
-
394 dst.clear();
-
395 if (map)
-
396 map->clear();
-
397 sgml2strcat(dst, src, count_src, skip, offset, map);
-
398 }
-
399
-
409 template<class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>, class TR_from = std::char_traits<T_from>, class AX_from = std::allocator<T_from>>
-
410 void sgml2strcpy(
-
411 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
412 _In_ const std::basic_string<T_from, TR_from, AX_from>& src,
-
413 _In_ int skip = 0,
-
414 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
415 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
416 {
-
417 sgml2strcpy(dst, src.data(), src.size(), skip, offset, map);
-
418 }
-
419
-
433 template <class T_from>
-
434 size_t sgml2strcpy(
-
435 _Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst,
-
436 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
-
437 _In_ int skip = 0,
-
438 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
439 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
440 {
-
441 _Assume_(dst || !count_dst);
-
442 if (count_dst)
-
443 dst[0] = 0;
-
444 if (map)
-
445 map->clear();
-
446 return sgml2strcat(dst, count_dst, src, count_src, skip, offset, map);
-
447 }
-
448
-
460 template <class T_from>
-
461 std::wstring sgml2str(
-
462 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
-
463 _In_ int skip = 0,
-
464 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
465 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
466 {
-
467 std::wstring dst;
-
468 sgml2strcat(dst, src, count_src, skip, offset, map);
-
469 return dst;
-
470 }
-
471
-
482 template <class T_from, class TR_from = std::char_traits<T_from>, class AX_from = std::allocator<T_from>>
-
483 std::wstring sgml2str(
-
484 _In_ const std::basic_string<T_from, TR_from, AX_from>& src,
-
485 _In_ int skip = 0,
-
486 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
-
487 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
-
488 {
-
489 return sgml2str(src.data(), src.size(), skip, offset, map);
-
490 }
-
491
-
493 inline const char* chr2sgml(_In_reads_or_z_(count) const wchar_t* entity, _In_ size_t count)
-
494 {
-
495 _Assume_(entity && count);
+
148
+
149 if (do_ascii && !is7bit(src[i])) {
+
150 // Non-ASCII character
+
151 return i;
+
152 }
+
153 i++;
+
154 }
+
155
+
156 return npos;
+
157 }
+
158
+
169 template <class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
170 void sgml2strcat(
+
171 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
172 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
+
173 _In_ int skip = 0,
+
174 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
175 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
176 {
+
177 _Assume_(src || !count_src);
+
178
+
179 const bool
+
180 skip_quot = (skip & sgml_quot) == 0,
+
181 skip_apos = (skip & sgml_apos) == 0,
+
182 skip_amp = (skip & sgml_amp) == 0,
+
183 skip_lt_gt = (skip & sgml_lt_gt) == 0,
+
184 skip_bsol = (skip & sgml_bsol) == 0,
+
185 skip_dollar = (skip & sgml_dollar) == 0,
+
186 skip_percnt = (skip & sgml_percnt) == 0,
+
187 skip_commat = (skip & sgml_commat) == 0,
+
188 skip_num = (skip & sgml_num) == 0,
+
189 skip_lpar_rpar = (skip & sgml_lpar_rpar) == 0,
+
190 skip_lcub_rcub = (skip & sgml_lcub_rcub) == 0,
+
191 skip_lsqb_rsqb = (skip & sgml_lsqb_rsqb) == 0;
+
192
+
193 count_src = strnlen(src, count_src);
+
194 dst.reserve(dst.size() + count_src);
+
195 for (size_t i = 0; i < count_src;) {
+
196 if (src[i] == '&') {
+
197 auto end = sgmlend(src + i + 1, count_src - i - 1);
+
198 if (end) {
+
199 const wchar_t* entity_w;
+
200 wchar_t chr[3];
+
201 _Assume_(src + i + 1 <= end);
+
202 size_t n = static_cast<size_t>(end - src) - i - 1;
+
203 if (n >= 2 && src[i + 1] == '#') {
+
204 utf32_t unicode;
+
205 if (src[i + 2] == 'x' || src[i + 2] == 'X')
+
206 unicode = static_cast<utf32_t>(strtou32(src + i + 3, n - 2, nullptr, 16));
+
207 else
+
208 unicode = static_cast<utf32_t>(strtou32(src + i + 2, n - 1, nullptr, 10));
+
209#ifdef _WIN32
+
210 if (unicode < 0x10000) {
+
211 chr[0] = (wchar_t)unicode;
+
212 chr[1] = 0;
+
213 }
+
214 else {
+
215 ucs4_to_surrogate_pair(chr, unicode);
+
216 chr[2] = 0;
+
217 }
+
218#else
+
219 chr[0] = (wchar_t)unicode;
+
220 chr[1] = 0;
+
221#endif
+
222 entity_w = chr;
+
223 }
+
224 else
+
225 entity_w = sgml2uni(src + i + 1, n);
+
226
+
227 if (entity_w &&
+
228 (skip_quot || (entity_w[0] != L'"')) &&
+
229 (skip_apos || (entity_w[0] != L'\'')) &&
+
230 (skip_amp || (entity_w[0] != L'&')) &&
+
231 (skip_lt_gt || (entity_w[0] != L'<' && entity_w[0] != L'>')) &&
+
232 (skip_bsol || (entity_w[0] != L'\\')) &&
+
233 (skip_dollar || (entity_w[0] != L'$')) &&
+
234 (skip_percnt || (entity_w[0] != L'%')) &&
+
235 (skip_commat || (entity_w[0] != L'@')) &&
+
236 (skip_num || (entity_w[0] != L'#')) &&
+
237 (skip_lpar_rpar || (entity_w[0] != L'(' && entity_w[0] != L')')) &&
+
238 (skip_lcub_rcub || (entity_w[0] != L'{' && entity_w[0] != L'}')) &&
+
239 (skip_lsqb_rsqb || (entity_w[0] != L'[' && entity_w[0] != L']')))
+
240 {
+
241 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + dst.size()));
+
242 dst.append(entity_w);
+
243 _Assume_(src <= end);
+
244 i = static_cast<size_t>(end - src) + 1;
+
245 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + dst.size()));
+
246 continue;
+
247 }
+
248 }
+
249 }
+
250 dst.append(1, src[i++]);
+
251 }
+
252 }
+
253
+
263 template <class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>, class TR_from = std::char_traits<T_from>, class AX_from = std::allocator<T_from>>
+
264 void sgml2strcat(
+
265 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
266 _In_ const std::basic_string<T_from, TR_from, AX_from>& src,
+
267 _In_ int skip = 0,
+
268 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
269 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
270 {
+
271 sgml2strcat(dst, src.data(), src.size(), skip, offset, map);
+
272 }
+
273
+
287 template <class T_from>
+
288 size_t sgml2strcat(
+
289 _Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst,
+
290 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
+
291 _In_ int skip = 0,
+
292 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
293 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
294 {
+
295 _Assume_(dst || !count_dst);
+
296 _Assume_(src || !count_src);
+
297
+
298 static const std::invalid_argument buffer_overrun("buffer overrun");
+
299 const bool
+
300 skip_quot = (skip & sgml_quot) == 0,
+
301 skip_apos = (skip & sgml_apos) == 0,
+
302 skip_amp = (skip & sgml_amp) == 0,
+
303 skip_lt_gt = (skip & sgml_lt_gt) == 0,
+
304 skip_bsol = (skip & sgml_bsol) == 0,
+
305 skip_dollar = (skip & sgml_dollar) == 0,
+
306 skip_percnt = (skip & sgml_percnt) == 0,
+
307 skip_commat = (skip & sgml_commat) == 0,
+
308 skip_num = (skip & sgml_num) == 0,
+
309 skip_lpar_rpar = (skip & sgml_lpar_rpar) == 0,
+
310 skip_lcub_rcub = (skip & sgml_lcub_rcub) == 0,
+
311 skip_lsqb_rsqb = (skip & sgml_lsqb_rsqb) == 0;
+
312
+
313 size_t j = strnlen(dst, count_dst);
+
314 count_src = strnlen(src, count_src);
+
315 for (size_t i = 0; i < count_src;) {
+
316 if (src[i] == '&') {
+
317 auto end = sgmlend(src + i + 1, count_src - i - 1);
+
318 if (end) {
+
319 const wchar_t* entity_w;
+
320 wchar_t chr[3];
+
321 size_t n = end - src - i - 1;
+
322 if (n >= 2 && src[i + 1] == '#') {
+
323 utf32_t unicode;
+
324 if (src[i + 2] == 'x' || src[i + 2] == 'X')
+
325 unicode = strtou32(src + i + 3, n - 2, nullptr, 16);
+
326 else
+
327 unicode = strtou32(src + i + 2, n - 1, nullptr, 10);
+
328#ifdef _WIN32
+
329 if (unicode < 0x10000) {
+
330 chr[0] = (wchar_t)unicode;
+
331 chr[1] = 0;
+
332 }
+
333 else {
+
334 ucs4_to_surrogate_pair(chr, unicode);
+
335 chr[2] = 0;
+
336 }
+
337#else
+
338 chr[0] = (wchar_t)unicode;
+
339 chr[1] = 0;
+
340#endif
+
341 entity_w = chr;
+
342 }
+
343 else
+
344 entity_w = sgml2uni(src + i + 1, n);
+
345
+
346 if (entity_w &&
+
347 (skip_quot || (entity_w[0] != L'"')) &&
+
348 (skip_apos || (entity_w[0] != L'\'')) &&
+
349 (skip_amp || (entity_w[0] != L'&')) &&
+
350 (skip_lt_gt || (entity_w[0] != L'<' && entity_w[0] != L'>')) &&
+
351 (skip_bsol || (entity_w[0] != L'\\')) &&
+
352 (skip_dollar || (entity_w[0] != L'$')) &&
+
353 (skip_percnt || (entity_w[0] != L'%')) &&
+
354 (skip_commat || (entity_w[0] != L'@')) &&
+
355 (skip_num || (entity_w[0] != L'#')) &&
+
356 (skip_lpar_rpar || (entity_w[0] != L'(' && entity_w[0] != L')')) &&
+
357 (skip_lcub_rcub || (entity_w[0] != L'{' && entity_w[0] != L'}')) &&
+
358 (skip_lsqb_rsqb || (entity_w[0] != L'[' && entity_w[0] != L']')))
+
359 {
+
360 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + j));
+
361 size_t m = wcslen(entity_w);
+
362 if (j + m >= count_dst)
+
363 throw buffer_overrun;
+
364 memcpy(dst + j, entity_w, m * sizeof(wchar_t)); j += m;
+
365 i = end - src + 1;
+
366 if (map) map->push_back(mapping<size_t>(offset.from + i, offset.to + j));
+
367 continue;
+
368 }
+
369 }
+
370 }
+
371 if (j + 1 >= count_dst)
+
372 throw buffer_overrun;
+
373 dst[j++] = src[i++];
+
374 }
+
375 if (j >= count_dst)
+
376 throw buffer_overrun;
+
377 dst[j] = 0;
+
378 return j;
+
379 }
+
380
+
391 template <class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
392 void sgml2strcpy(
+
393 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
394 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
+
395 _In_ int skip = 0,
+
396 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
397 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
398 {
+
399 dst.clear();
+
400 if (map)
+
401 map->clear();
+
402 sgml2strcat(dst, src, count_src, skip, offset, map);
+
403 }
+
404
+
414 template<class T_from, class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>, class TR_from = std::char_traits<T_from>, class AX_from = std::allocator<T_from>>
+
415 void sgml2strcpy(
+
416 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
417 _In_ const std::basic_string<T_from, TR_from, AX_from>& src,
+
418 _In_ int skip = 0,
+
419 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
420 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
421 {
+
422 sgml2strcpy(dst, src.data(), src.size(), skip, offset, map);
+
423 }
+
424
+
438 template <class T_from>
+
439 size_t sgml2strcpy(
+
440 _Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst,
+
441 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
+
442 _In_ int skip = 0,
+
443 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
444 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
445 {
+
446 _Assume_(dst || !count_dst);
+
447 if (count_dst)
+
448 dst[0] = 0;
+
449 if (map)
+
450 map->clear();
+
451 return sgml2strcat(dst, count_dst, src, count_src, skip, offset, map);
+
452 }
+
453
+
465 template <class T_from>
+
466 std::wstring sgml2str(
+
467 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src,
+
468 _In_ int skip = 0,
+
469 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
470 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
471 {
+
472 std::wstring dst;
+
473 sgml2strcat(dst, src, count_src, skip, offset, map);
+
474 return dst;
+
475 }
+
476
+
487 template <class T_from, class TR_from = std::char_traits<T_from>, class AX_from = std::allocator<T_from>>
+
488 std::wstring sgml2str(
+
489 _In_ const std::basic_string<T_from, TR_from, AX_from>& src,
+
490 _In_ int skip = 0,
+
491 _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
+
492 _Inout_opt_ mapping_vector<size_t>* map = nullptr)
+
493 {
+
494 return sgml2str(src.data(), src.size(), skip, offset, map);
+
495 }
496
-
497 const wchar_t e2 = entity[0];
-
498 for (size_t i = 0, j = _countof(unicode_sgml); i < j; ) {
-
499 size_t m = (i + j) / 2;
-
500 wchar_t e1 = sgml_unicode[unicode_sgml[m]].unicode[0];
-
501 if (e1 < e2)
-
502 i = m + 1;
-
503 else if (e1 > e2)
-
504 j = m;
-
505 else {
-
506 auto r = strncmp(sgml_unicode[unicode_sgml[m]].unicode + 1, _countof(sgml_unicode[0].unicode) - 1, entity + 1, count - 1);
-
507 if (r < 0)
-
508 i = m + 1;
-
509 else if (r > 0)
-
510 j = m;
-
511 else {
-
512 for (; i < m && sgml_unicode[unicode_sgml[m - 1]].unicode[0] == e2 && strncmp(sgml_unicode[unicode_sgml[m - 1]].unicode + 1, _countof(sgml_unicode[0].unicode) - 1, entity + 1, count - 1) == 0; m--);
-
513 return sgml_unicode[unicode_sgml[m]].sgml;
-
514 }
-
515 }
-
516 }
-
517 return nullptr;
-
518 }
-
520
-
529 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
530 inline void str2sgmlcat(
-
531 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
532 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
533 _In_ int what = 0)
-
534 {
-
535 _Assume_(src || !count_src);
-
536
-
537 const bool
-
538 do_ascii = (what & sgml_full) == 0,
-
539 do_quot = (what & sgml_quot) == 0,
-
540 do_apos = (what & sgml_apos) == 0,
-
541 do_lt_gt = (what & sgml_lt_gt) == 0,
-
542 do_bsol = (what & sgml_bsol) == 0,
-
543 do_dollar = (what & sgml_dollar) == 0,
-
544 do_percnt = (what & sgml_percnt) == 0,
-
545 do_commat = (what & sgml_commat) == 0,
-
546 do_num = (what & sgml_num) == 0,
-
547 do_lpar_rpar = (what & sgml_lpar_rpar) == 0,
-
548 do_lcub_rcub = (what & sgml_lcub_rcub) == 0,
-
549 do_lsqb_rsqb = (what & sgml_lsqb_rsqb) == 0;
-
550
-
551 count_src = strnlen(src, count_src);
-
552 dst.reserve(dst.size() + count_src);
-
553 for (size_t i = 0; i < count_src;) {
-
554 size_t n = glyphlen(src + i, count_src - i);
-
555 if (n == 1 &&
-
556 do_ascii && is7bit(src[i]) &&
-
557 src[i] != L'&' &&
-
558 (do_quot || (src[i] != L'"')) &&
-
559 (do_apos || (src[i] != L'\'')) &&
-
560 (do_lt_gt || (src[i] != L'<' && src[i] != L'>')) &&
-
561 (do_bsol || (src[i] != L'\\')) &&
-
562 (do_dollar || (src[i] != L'$')) &&
-
563 (do_percnt || (src[i] != L'%')) &&
-
564 (do_commat || (src[i] != L'@')) &&
-
565 (do_num || (src[i] != L'#')) &&
-
566 (do_lpar_rpar || (src[i] != L'(' && src[i] != L')')) &&
-
567 (do_lcub_rcub || (src[i] != L'{' && src[i] != L'}')) &&
-
568 (do_lsqb_rsqb || (src[i] != L'[' && src[i] != L']')))
-
569 {
-
570 // 7-bit ASCII and no desire to encode it as an SGML entity.
-
571 dst.append(1, static_cast<char>(src[i++]));
-
572 }
-
573 else {
-
574 const char* entity = chr2sgml(src + i, n);
-
575 if (entity) {
-
576 dst.append(1, '&');
-
577 dst.append(entity);
-
578 dst.append(1, ';');
-
579 i += n;
-
580 }
-
581 else if (n == 1) {
-
582 // Trivial character (1 code unit, 1 glyph), no entity available.
-
583 if (is7bit(src[i]))
-
584 dst.append(1, static_cast<char>(src[i++]));
-
585 else {
-
586 char tmp[3 + 8 + 1 + 1];
-
587 snprintf(tmp, _countof(tmp), "&#x%x;", src[i++]);
-
588 dst.append(tmp);
-
589 }
-
590 }
-
591 else {
-
592 // Non-trivial character. Decompose.
-
593 const size_t end = i + n;
-
594 while (i < end) {
-
595 if ((entity = chr2sgml(src + i, 1)) != nullptr) {
-
596 dst.append(1, '&');
-
597 dst.append(entity);
-
598 dst.append(1, ';');
-
599 i++;
-
600 }
-
601 else if (is7bit(src[i]))
-
602 dst.append(1, static_cast<char>(src[i++]));
-
603 else {
-
604 utf32_t unicode;
-
605#ifdef _WIN32
-
606 if (i + 1 < end && is_surrogate_pair(src + i)) {
-
607 unicode = surrogate_pair_to_ucs4(src + i);
-
608 i += 2;
-
609 }
-
610 else
-
611#endif
-
612 {
-
613 unicode = src[i++];
+
498 inline const char* chr2sgml(_In_reads_or_z_(count) const wchar_t* entity, _In_ size_t count)
+
499 {
+
500 _Assume_(entity && count);
+
501
+
502 const wchar_t e2 = entity[0];
+
503 for (size_t i = 0, j = _countof(unicode_sgml); i < j; ) {
+
504 size_t m = (i + j) / 2;
+
505 wchar_t e1 = sgml_unicode[unicode_sgml[m]].unicode[0];
+
506 if (e1 < e2)
+
507 i = m + 1;
+
508 else if (e1 > e2)
+
509 j = m;
+
510 else {
+
511 auto r = strncmp(sgml_unicode[unicode_sgml[m]].unicode + 1, _countof(sgml_unicode[0].unicode) - 1, entity + 1, count - 1);
+
512 if (r < 0)
+
513 i = m + 1;
+
514 else if (r > 0)
+
515 j = m;
+
516 else {
+
517 for (; i < m && sgml_unicode[unicode_sgml[m - 1]].unicode[0] == e2 && strncmp(sgml_unicode[unicode_sgml[m - 1]].unicode + 1, _countof(sgml_unicode[0].unicode) - 1, entity + 1, count - 1) == 0; m--);
+
518 return sgml_unicode[unicode_sgml[m]].sgml;
+
519 }
+
520 }
+
521 }
+
522 return nullptr;
+
523 }
+
525
+
534 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
535 inline void str2sgmlcat(
+
536 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
537 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
538 _In_ int what = 0)
+
539 {
+
540 _Assume_(src || !count_src);
+
541
+
542 const bool
+
543 do_ascii = (what & sgml_full) == 0,
+
544 do_quot = (what & sgml_quot) == 0,
+
545 do_apos = (what & sgml_apos) == 0,
+
546 do_lt_gt = (what & sgml_lt_gt) == 0,
+
547 do_bsol = (what & sgml_bsol) == 0,
+
548 do_dollar = (what & sgml_dollar) == 0,
+
549 do_percnt = (what & sgml_percnt) == 0,
+
550 do_commat = (what & sgml_commat) == 0,
+
551 do_num = (what & sgml_num) == 0,
+
552 do_lpar_rpar = (what & sgml_lpar_rpar) == 0,
+
553 do_lcub_rcub = (what & sgml_lcub_rcub) == 0,
+
554 do_lsqb_rsqb = (what & sgml_lsqb_rsqb) == 0;
+
555
+
556 count_src = strnlen(src, count_src);
+
557 dst.reserve(dst.size() + count_src);
+
558 for (size_t i = 0; i < count_src;) {
+
559 size_t n = glyphlen(src + i, count_src - i);
+
560 if (n == 1 &&
+
561 do_ascii && is7bit(src[i]) &&
+
562 src[i] != L'&' &&
+
563 (do_quot || (src[i] != L'"')) &&
+
564 (do_apos || (src[i] != L'\'')) &&
+
565 (do_lt_gt || (src[i] != L'<' && src[i] != L'>')) &&
+
566 (do_bsol || (src[i] != L'\\')) &&
+
567 (do_dollar || (src[i] != L'$')) &&
+
568 (do_percnt || (src[i] != L'%')) &&
+
569 (do_commat || (src[i] != L'@')) &&
+
570 (do_num || (src[i] != L'#')) &&
+
571 (do_lpar_rpar || (src[i] != L'(' && src[i] != L')')) &&
+
572 (do_lcub_rcub || (src[i] != L'{' && src[i] != L'}')) &&
+
573 (do_lsqb_rsqb || (src[i] != L'[' && src[i] != L']')))
+
574 {
+
575 // 7-bit ASCII and no desire to encode it as an SGML entity.
+
576 dst.append(1, static_cast<char>(src[i++]));
+
577 }
+
578 else {
+
579 const char* entity = chr2sgml(src + i, n);
+
580 if (entity) {
+
581 dst.append(1, '&');
+
582 dst.append(entity);
+
583 dst.append(1, ';');
+
584 i += n;
+
585 }
+
586 else if (n == 1) {
+
587 // Trivial character (1 code unit, 1 glyph), no entity available.
+
588 if (is7bit(src[i]))
+
589 dst.append(1, static_cast<char>(src[i++]));
+
590 else {
+
591 char tmp[3 + 8 + 1 + 1];
+
592 snprintf(tmp, _countof(tmp), "&#x%x;", src[i++]);
+
593 dst.append(tmp);
+
594 }
+
595 }
+
596 else {
+
597 // Non-trivial character. Decompose.
+
598 const size_t end = i + n;
+
599 while (i < end) {
+
600 if ((entity = chr2sgml(src + i, 1)) != nullptr) {
+
601 dst.append(1, '&');
+
602 dst.append(entity);
+
603 dst.append(1, ';');
+
604 i++;
+
605 }
+
606 else if (is7bit(src[i]))
+
607 dst.append(1, static_cast<char>(src[i++]));
+
608 else {
+
609 utf32_t unicode;
+
610#ifdef _WIN32
+
611 if (i + 1 < end && is_surrogate_pair(src + i)) {
+
612 unicode = surrogate_pair_to_ucs4(src + i);
+
613 i += 2;
614 }
-
615 char tmp[3 + 8 + 1 + 1];
-
616 snprintf(tmp, _countof(tmp), "&#x%x;", unicode);
-
617 dst.append(tmp);
-
618 }
-
619 }
-
620 }
-
621 }
-
622 }
-
623 }
-
624
-
632 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
633 void str2sgmlcat(
-
634 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
635 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
636 _In_ int what = 0)
-
637 {
-
638 str2sgmlcat(dst, src.data(), src.size(), what);
-
639 }
-
640
-
652 inline size_t str2sgmlcat(
-
653 _Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
-
654 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
655 _In_ int what = 0)
-
656 {
-
657 _Assume_(dst || !count_dst);
-
658 _Assume_(src || !count_src);
-
659
-
660 static const std::invalid_argument buffer_overrun("buffer overrun");
-
661 const bool
-
662 do_ascii = (what & sgml_full) == 0,
-
663 do_quot = (what & sgml_quot) == 0,
-
664 do_apos = (what & sgml_apos) == 0,
-
665 do_lt_gt = (what & sgml_lt_gt) == 0,
-
666 do_bsol = (what & sgml_bsol) == 0,
-
667 do_dollar = (what & sgml_dollar) == 0,
-
668 do_percnt = (what & sgml_percnt) == 0,
-
669 do_commat = (what & sgml_commat) == 0,
-
670 do_num = (what & sgml_num) == 0,
-
671 do_lpar_rpar = (what & sgml_lpar_rpar) == 0,
-
672 do_lcub_rcub = (what & sgml_lcub_rcub) == 0,
-
673 do_lsqb_rsqb = (what & sgml_lsqb_rsqb) == 0;
-
674
-
675 size_t j = strnlen(dst, count_dst);
-
676 count_src = strnlen(src, count_src);
-
677 for (size_t i = 0; i < count_src;) {
-
678 size_t n = glyphlen(src + i, count_src - i);
-
679 if (n == 1 &&
-
680 do_ascii && is7bit(src[i]) &&
-
681 src[i] != L'&' &&
-
682 (do_quot || (src[i] != L'"')) &&
-
683 (do_apos || (src[i] != L'\'')) &&
-
684 (do_lt_gt || (src[i] != L'<' && src[i] != L'>')) &&
-
685 (do_bsol || (src[i] != L'\\')) &&
-
686 (do_dollar || (src[i] != L'$')) &&
-
687 (do_percnt || (src[i] != L'%')) &&
-
688 (do_commat || (src[i] != L'@')) &&
-
689 (do_num || (src[i] != L'#')) &&
-
690 (do_lpar_rpar || (src[i] != L'(' && src[i] != L')')) &&
-
691 (do_lcub_rcub || (src[i] != L'{' && src[i] != L'}')) &&
-
692 (do_lsqb_rsqb || (src[i] != L'[' && src[i] != L']')))
-
693 {
-
694 // 7-bit ASCII and no desire to encode it as an SGML entity.
-
695 if (j + 1 >= count_dst)
-
696 throw buffer_overrun;
-
697 dst[j++] = static_cast<char>(src[i++]);
-
698 }
-
699 else {
-
700 const char* entity = chr2sgml(src + i, n);
-
701 if (entity) {
-
702 size_t m = strlen(entity);
-
703 if (j + m + 2 >= count_dst)
-
704 throw buffer_overrun;
-
705 dst[j++] = '&';
-
706 memcpy(dst + j, entity, m * sizeof(char)); j += m;
-
707 dst[j++] = ';';
-
708 i += n;
-
709 }
-
710 else if (n == 1) {
-
711 // Trivial character (1 code unit, 1 glyph), no entity available.
-
712 if (is7bit(src[i])) {
-
713 if (j + 1 >= count_dst)
-
714 throw buffer_overrun;
-
715 dst[j++] = static_cast<char>(src[i++]);
-
716 }
-
717 else {
-
718 char tmp[3 + 8 + 1 + 1];
-
719 int m = snprintf(tmp, _countof(tmp), "&#x%x;", src[i++]);
-
720 _Assume_(m >= 0);
-
721 if (static_cast<size_t>(m) >= count_dst)
-
722 throw buffer_overrun;
-
723 memcpy(dst + j, tmp, static_cast<size_t>(m) * sizeof(char));
-
724 j += static_cast<size_t>(m);
-
725 }
-
726 }
-
727 else {
-
728 // Non-trivial character. Decompose.
-
729 const size_t end = i + n;
-
730 while (i < end) {
-
731 if ((entity = chr2sgml(src + i, 1)) != nullptr) {
-
732 size_t m = strlen(entity);
-
733 if (j + m + 2 >= count_dst)
-
734 throw buffer_overrun;
-
735 dst[j++] = '&';
-
736 memcpy(dst + j, entity, m * sizeof(char)); j += m;
-
737 dst[j++] = ';';
-
738 i++;
-
739 }
-
740 else if (is7bit(src[i])) {
-
741 if (j + 1 >= count_dst)
-
742 throw buffer_overrun;
-
743 dst[j++] = static_cast<char>(src[i++]);
+
615 else
+
616#endif
+
617 {
+
618 unicode = src[i++];
+
619 }
+
620 char tmp[3 + 8 + 1 + 1];
+
621 snprintf(tmp, _countof(tmp), "&#x%x;", unicode);
+
622 dst.append(tmp);
+
623 }
+
624 }
+
625 }
+
626 }
+
627 }
+
628 }
+
629
+
637 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
638 void str2sgmlcat(
+
639 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
640 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
641 _In_ int what = 0)
+
642 {
+
643 str2sgmlcat(dst, src.data(), src.size(), what);
+
644 }
+
645
+
657 inline size_t str2sgmlcat(
+
658 _Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
+
659 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
660 _In_ int what = 0)
+
661 {
+
662 _Assume_(dst || !count_dst);
+
663 _Assume_(src || !count_src);
+
664
+
665 static const std::invalid_argument buffer_overrun("buffer overrun");
+
666 const bool
+
667 do_ascii = (what & sgml_full) == 0,
+
668 do_quot = (what & sgml_quot) == 0,
+
669 do_apos = (what & sgml_apos) == 0,
+
670 do_lt_gt = (what & sgml_lt_gt) == 0,
+
671 do_bsol = (what & sgml_bsol) == 0,
+
672 do_dollar = (what & sgml_dollar) == 0,
+
673 do_percnt = (what & sgml_percnt) == 0,
+
674 do_commat = (what & sgml_commat) == 0,
+
675 do_num = (what & sgml_num) == 0,
+
676 do_lpar_rpar = (what & sgml_lpar_rpar) == 0,
+
677 do_lcub_rcub = (what & sgml_lcub_rcub) == 0,
+
678 do_lsqb_rsqb = (what & sgml_lsqb_rsqb) == 0;
+
679
+
680 size_t j = strnlen(dst, count_dst);
+
681 count_src = strnlen(src, count_src);
+
682 for (size_t i = 0; i < count_src;) {
+
683 size_t n = glyphlen(src + i, count_src - i);
+
684 if (n == 1 &&
+
685 do_ascii && is7bit(src[i]) &&
+
686 src[i] != L'&' &&
+
687 (do_quot || (src[i] != L'"')) &&
+
688 (do_apos || (src[i] != L'\'')) &&
+
689 (do_lt_gt || (src[i] != L'<' && src[i] != L'>')) &&
+
690 (do_bsol || (src[i] != L'\\')) &&
+
691 (do_dollar || (src[i] != L'$')) &&
+
692 (do_percnt || (src[i] != L'%')) &&
+
693 (do_commat || (src[i] != L'@')) &&
+
694 (do_num || (src[i] != L'#')) &&
+
695 (do_lpar_rpar || (src[i] != L'(' && src[i] != L')')) &&
+
696 (do_lcub_rcub || (src[i] != L'{' && src[i] != L'}')) &&
+
697 (do_lsqb_rsqb || (src[i] != L'[' && src[i] != L']')))
+
698 {
+
699 // 7-bit ASCII and no desire to encode it as an SGML entity.
+
700 if (j + 1 >= count_dst)
+
701 throw buffer_overrun;
+
702 dst[j++] = static_cast<char>(src[i++]);
+
703 }
+
704 else {
+
705 const char* entity = chr2sgml(src + i, n);
+
706 if (entity) {
+
707 size_t m = strlen(entity);
+
708 if (j + m + 2 >= count_dst)
+
709 throw buffer_overrun;
+
710 dst[j++] = '&';
+
711 memcpy(dst + j, entity, m * sizeof(char)); j += m;
+
712 dst[j++] = ';';
+
713 i += n;
+
714 }
+
715 else if (n == 1) {
+
716 // Trivial character (1 code unit, 1 glyph), no entity available.
+
717 if (is7bit(src[i])) {
+
718 if (j + 1 >= count_dst)
+
719 throw buffer_overrun;
+
720 dst[j++] = static_cast<char>(src[i++]);
+
721 }
+
722 else {
+
723 char tmp[3 + 8 + 1 + 1];
+
724 int m = snprintf(tmp, _countof(tmp), "&#x%x;", src[i++]);
+
725 _Assume_(m >= 0);
+
726 if (static_cast<size_t>(m) >= count_dst)
+
727 throw buffer_overrun;
+
728 memcpy(dst + j, tmp, static_cast<size_t>(m) * sizeof(char));
+
729 j += static_cast<size_t>(m);
+
730 }
+
731 }
+
732 else {
+
733 // Non-trivial character. Decompose.
+
734 const size_t end = i + n;
+
735 while (i < end) {
+
736 if ((entity = chr2sgml(src + i, 1)) != nullptr) {
+
737 size_t m = strlen(entity);
+
738 if (j + m + 2 >= count_dst)
+
739 throw buffer_overrun;
+
740 dst[j++] = '&';
+
741 memcpy(dst + j, entity, m * sizeof(char)); j += m;
+
742 dst[j++] = ';';
+
743 i++;
744 }
-
745 else {
-
746 utf32_t unicode;
-
747#ifdef _WIN32
-
748 if (i + 1 < end && is_surrogate_pair(src + i)) {
-
749 unicode = surrogate_pair_to_ucs4(src + i);
-
750 i += 2;
-
751 }
-
752 else
-
753#endif
-
754 {
-
755 unicode = src[i++];
+
745 else if (is7bit(src[i])) {
+
746 if (j + 1 >= count_dst)
+
747 throw buffer_overrun;
+
748 dst[j++] = static_cast<char>(src[i++]);
+
749 }
+
750 else {
+
751 utf32_t unicode;
+
752#ifdef _WIN32
+
753 if (i + 1 < end && is_surrogate_pair(src + i)) {
+
754 unicode = surrogate_pair_to_ucs4(src + i);
+
755 i += 2;
756 }
-
757 char tmp[3 + 8 + 1 + 1];
-
758 int m = snprintf(tmp, _countof(tmp), "&#x%x;", unicode);
-
759 _Assume_(m >= 0);
-
760 if (static_cast<size_t>(m) >= count_dst)
-
761 throw buffer_overrun;
-
762 memcpy(dst + j, tmp, static_cast<size_t>(m) * sizeof(char));
-
763 j += static_cast<size_t>(m);
-
764 }
-
765 }
-
766 }
-
767 }
-
768 }
-
769 if (j >= count_dst)
-
770 throw buffer_overrun;
-
771 dst[j] = 0;
-
772 return j;
-
773 }
-
774
-
783 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
784 inline void str2sgmlcpy(
-
785 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
786 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
787 _In_ int what = 0)
-
788 {
-
789 dst.clear();
-
790 str2sgmlcat(dst, src, count_src, what);
-
791 }
-
792
-
800 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
801 void str2sgmlcpy(
-
802 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
803 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
804 _In_ int what = 0)
-
805 {
-
806 str2sgmlcpy(dst, src.data(), src.size(), what);
-
807 }
-
808
-
820 inline size_t str2sgmlcpy(
-
821 _Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
-
822 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
823 _In_ int what = 0)
-
824 {
-
825 _Assume_(dst || !count_dst);
-
826 if (count_dst)
-
827 dst[0] = 0;
-
828 return str2sgmlcat(dst, count_dst, src, count_src, what);
-
829 }
-
830
-
840 inline std::string str2sgml(
-
841 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
842 _In_ int what = 0)
-
843 {
-
844 std::string dst;
-
845 str2sgmlcat(dst, src, count_src, what);
-
846 return dst;
-
847 }
-
848
-
857 inline std::string str2sgml(
-
858 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
859 _In_ int what = 0)
-
860 {
-
861 return str2sgml(src.data(), src.size(), what);
-
862 }
-
863}
+
757 else
+
758#endif
+
759 {
+
760 unicode = src[i++];
+
761 }
+
762 char tmp[3 + 8 + 1 + 1];
+
763 int m = snprintf(tmp, _countof(tmp), "&#x%x;", unicode);
+
764 _Assume_(m >= 0);
+
765 if (static_cast<size_t>(m) >= count_dst)
+
766 throw buffer_overrun;
+
767 memcpy(dst + j, tmp, static_cast<size_t>(m) * sizeof(char));
+
768 j += static_cast<size_t>(m);
+
769 }
+
770 }
+
771 }
+
772 }
+
773 }
+
774 if (j >= count_dst)
+
775 throw buffer_overrun;
+
776 dst[j] = 0;
+
777 return j;
+
778 }
+
779
+
788 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
789 inline void str2sgmlcpy(
+
790 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
791 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
792 _In_ int what = 0)
+
793 {
+
794 dst.clear();
+
795 str2sgmlcat(dst, src, count_src, what);
+
796 }
+
797
+
805 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
806 void str2sgmlcpy(
+
807 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
808 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
809 _In_ int what = 0)
+
810 {
+
811 str2sgmlcpy(dst, src.data(), src.size(), what);
+
812 }
+
813
+
825 inline size_t str2sgmlcpy(
+
826 _Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
+
827 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
828 _In_ int what = 0)
+
829 {
+
830 _Assume_(dst || !count_dst);
+
831 if (count_dst)
+
832 dst[0] = 0;
+
833 return str2sgmlcat(dst, count_dst, src, count_src, what);
+
834 }
+
835
+
845 inline std::string str2sgml(
+
846 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
847 _In_ int what = 0)
+
848 {
+
849 std::string dst;
+
850 str2sgmlcat(dst, src, count_src, what);
+
851 return dst;
+
852 }
+
853
+
862 inline std::string str2sgml(
+
863 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
864 _In_ int what = 0)
+
865 {
+
866 return str2sgml(src.data(), src.size(), what);
+
867 }
+
868}
+
869
+
870#if defined(__GNUC__)
+
871#pragma GCC diagnostic pop
+
872#endif
diff --git a/sgml__unicode_8hpp_source.html b/sgml__unicode_8hpp_source.html index 8f4563368..c59929b6a 100644 --- a/sgml__unicode_8hpp_source.html +++ b/sgml__unicode_8hpp_source.html @@ -3177,7 +3177,7 @@ $(function() { codefold.init(0); });
diff --git a/socket_8hpp_source.html b/socket_8hpp_source.html index 07b85dd6a..51a1b2dd1 100644 --- a/socket_8hpp_source.html +++ b/socket_8hpp_source.html @@ -115,7 +115,7 @@ $(function() { codefold.init(0); });
diff --git a/spinlock_8hpp_source.html b/spinlock_8hpp_source.html index ea6fd5bd0..2bcedee7c 100644 --- a/spinlock_8hpp_source.html +++ b/spinlock_8hpp_source.html @@ -159,7 +159,7 @@ $(function() { codefold.init(0); });
diff --git a/stream_8hpp_source.html b/stream_8hpp_source.html index d239b6215..f2a904ae5 100644 --- a/stream_8hpp_source.html +++ b/stream_8hpp_source.html @@ -2977,1199 +2977,1200 @@ $(function() { codefold.init(0); });
3027 return;
3028 throw std::system_error(GetLastError(), std::system_category(), "SetFileTime failed");
3029#else
-
3030 throw std::runtime_error("not supported");
-
3031#endif
-
3032 }
+
3030 _Unreferenced_(date);
+
3031 throw std::runtime_error("not supported");
+
3032#endif
+
3033 }
-
3033
-
-
3034 virtual void set_atime(time_point date)
-
3035 {
-
3036 _Assume_(m_h != invalid_handle);
-
3037#ifdef _WIN32
-
3038 FILETIME ft;
-
3039 tp2ft(date, ft);
-
3040 if (SetFileTime(m_h, nullptr, &ft, nullptr))
-
3041 return;
-
3042 throw std::system_error(GetLastError(), std::system_category(), "SetFileTime failed");
-
3043#else
-
3044 struct timespec ts[2] = {
-
3045 { date.time_since_epoch().count(), 0 },
-
3046 { 0, UTIME_OMIT },
-
3047 };
-
3048 if (futimens(m_h, ts) >= 0)
-
3049 return;
-
3050 throw std::system_error(errno, std::system_category(), "futimens failed");
-
3051#endif
-
3052 }
+
3034
+
+
3035 virtual void set_atime(time_point date)
+
3036 {
+
3037 _Assume_(m_h != invalid_handle);
+
3038#ifdef _WIN32
+
3039 FILETIME ft;
+
3040 tp2ft(date, ft);
+
3041 if (SetFileTime(m_h, nullptr, &ft, nullptr))
+
3042 return;
+
3043 throw std::system_error(GetLastError(), std::system_category(), "SetFileTime failed");
+
3044#else
+
3045 struct timespec ts[2] = {
+
3046 { date.time_since_epoch().count(), 0 },
+
3047 { 0, UTIME_OMIT },
+
3048 };
+
3049 if (futimens(m_h, ts) >= 0)
+
3050 return;
+
3051 throw std::system_error(errno, std::system_category(), "futimens failed");
+
3052#endif
+
3053 }
-
3053
-
-
3054 virtual void set_mtime(time_point date)
-
3055 {
-
3056#ifdef _WIN32
-
3057 FILETIME ft;
-
3058 tp2ft(date, ft);
-
3059 if (SetFileTime(m_h, nullptr, nullptr, &ft))
-
3060 return;
-
3061 throw std::system_error(GetLastError(), std::system_category(), "SetFileTime failed");
-
3062#else
-
3063 struct timespec ts[2] = {
-
3064 { 0, UTIME_OMIT },
-
3065 { date.time_since_epoch().count(), 0 },
-
3066 };
-
3067 if (futimens(m_h, ts) >= 0)
-
3068 return;
-
3069 throw std::system_error(errno, std::system_category(), "futimens failed");
-
3070#endif
-
3071 }
+
3054
+
+
3055 virtual void set_mtime(time_point date)
+
3056 {
+
3057#ifdef _WIN32
+
3058 FILETIME ft;
+
3059 tp2ft(date, ft);
+
3060 if (SetFileTime(m_h, nullptr, nullptr, &ft))
+
3061 return;
+
3062 throw std::system_error(GetLastError(), std::system_category(), "SetFileTime failed");
+
3063#else
+
3064 struct timespec ts[2] = {
+
3065 { 0, UTIME_OMIT },
+
3066 { date.time_since_epoch().count(), 0 },
+
3067 };
+
3068 if (futimens(m_h, ts) >= 0)
+
3069 return;
+
3070 throw std::system_error(errno, std::system_category(), "futimens failed");
+
3071#endif
+
3072 }
-
3072
-
-
3078 static bool exists(_In_z_ const stdex::schar_t* filename)
-
3079 {
-
3080#ifdef _WIN32
-
3081 return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
-
3082#else
-
3083 struct stat s;
-
3084 return stat(filename, &s) == 0;
-
3085#endif
-
3086 }
+
3073
+
+
3079 static bool exists(_In_z_ const stdex::schar_t* filename)
+
3080 {
+
3081#ifdef _WIN32
+
3082 return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
+
3083#else
+
3084 struct stat s;
+
3085 return stat(filename, &s) == 0;
+
3086#endif
+
3087 }
-
3087
-
3093 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
-
3094 static bool exists(_In_ const std::basic_string<TR, AX>& filename)
-
3095 {
-
3096 return exists(filename.c_str());
-
3097 }
+
3088
+
3094 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
+
3095 static bool exists(_In_ const std::basic_string<TR, AX>& filename)
+
3096 {
+
3097 return exists(filename.c_str());
+
3098 }
-
3098
-
-
3106 static bool readonly(_In_z_ const stdex::schar_t* filename)
-
3107 {
-
3108#ifdef _WIN32
-
3109 DWORD dwAttr = GetFileAttributes(filename);
-
3110 return dwAttr != INVALID_FILE_ATTRIBUTES && (dwAttr & FILE_ATTRIBUTE_READONLY) != 0;
-
3111#else
-
3112 struct stat s;
-
3113 return stat(filename, &s) == 0 && (s.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) == 0;
-
3114#endif
-
3115 }
+
3099
+
+
3107 static bool readonly(_In_z_ const stdex::schar_t* filename)
+
3108 {
+
3109#ifdef _WIN32
+
3110 DWORD dwAttr = GetFileAttributes(filename);
+
3111 return dwAttr != INVALID_FILE_ATTRIBUTES && (dwAttr & FILE_ATTRIBUTE_READONLY) != 0;
+
3112#else
+
3113 struct stat s;
+
3114 return stat(filename, &s) == 0 && (s.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) == 0;
+
3115#endif
+
3116 }
-
3116
-
3124 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
-
3125 static bool readonly(_In_ const std::basic_string<TR, AX>& filename)
-
3126 {
-
3127 return readonly(filename.c_str());
-
3128 }
+
3117
+
3125 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
+
3126 static bool readonly(_In_ const std::basic_string<TR, AX>& filename)
+
3127 {
+
3128 return readonly(filename.c_str());
+
3129 }
-
3129 };
+
3130 };
-
3130#pragma warning(pop)
-
3131
-
-
3135 class cached_file : public cache
-
3136 {
-
3137 public:
-
3138 cached_file(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok, _In_ size_t cache_size = default_cache_size) :
-
3139 cache(cache_size),
-
3140 m_source(h, state)
-
3141 {
-
3142 init(m_source);
-
3143 }
-
3144
-
-
3152 cached_file(_In_z_ const schar_t* filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) :
-
3153 cache(cache_size),
-
3154 m_source(filename, mode & mode_for_writing ? mode | mode_for_reading : mode)
-
3155 {
-
3156 init(m_source);
-
3157 }
+
3131#pragma warning(pop)
+
3132
+
+
3136 class cached_file : public cache
+
3137 {
+
3138 public:
+
3139 cached_file(_In_opt_ sys_handle h = invalid_handle, _In_ state_t state = state_t::ok, _In_ size_t cache_size = default_cache_size) :
+
3140 cache(cache_size),
+
3141 m_source(h, state)
+
3142 {
+
3143 init(m_source);
+
3144 }
+
3145
+
+
3153 cached_file(_In_z_ const schar_t* filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) :
+
3154 cache(cache_size),
+
3155 m_source(filename, mode & mode_for_writing ? mode | mode_for_reading : mode)
+
3156 {
+
3157 init(m_source);
+
3158 }
-
3158
-
3166 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
3167 cached_file(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) : cached_file(filename.c_str(), mode, cache_size) {}
-
3168
-
3169 virtual ~cached_file()
-
3170 {
-
3171 done();
-
3172 }
-
3173
-
-
3180 void open(_In_z_ const schar_t* filename, _In_ int mode)
-
3181 {
-
3182 invalidate_cache();
-
3183 if (!ok()) _Unlikely_{
-
3184 m_state = state_t::fail;
-
3185 return;
-
3186 }
-
3187 m_source.open(filename, mode & mode_for_writing ? mode | mode_for_reading : mode);
-
3188 if (m_source.ok()) {
-
3189 init();
-
3190 return;
-
3191 }
-
3192 m_state = state_t::fail;
-
3193 }
+
3159
+
3167 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
3168 cached_file(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) : cached_file(filename.c_str(), mode, cache_size) {}
+
3169
+
3170 virtual ~cached_file()
+
3171 {
+
3172 done();
+
3173 }
+
3174
+
+
3181 void open(_In_z_ const schar_t* filename, _In_ int mode)
+
3182 {
+
3183 invalidate_cache();
+
3184 if (!ok()) _Unlikely_{
+
3185 m_state = state_t::fail;
+
3186 return;
+
3187 }
+
3188 m_source.open(filename, mode & mode_for_writing ? mode | mode_for_reading : mode);
+
3189 if (m_source.ok()) {
+
3190 init();
+
3191 return;
+
3192 }
+
3193 m_state = state_t::fail;
+
3194 }
-
3194
-
3201 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
-
3202 void open(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode)
-
3203 {
-
3204 open(filename.c_str(), mode);
-
3205 }
+
3195
+
3202 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
+
3203 void open(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode)
+
3204 {
+
3205 open(filename.c_str(), mode);
+
3206 }
-
3206
-
3210 operator bool() const noexcept { return m_source; }
-
3211
-
3212 protected:
-
3213 file m_source;
-
3214 };
+
3207
+
3211 operator bool() const noexcept { return m_source; }
+
3212
+
3213 protected:
+
3214 file m_source;
+
3215 };
-
3215
-
- -
3220 {
-
3221 public:
-
3222 memory_file(_In_ state_t state = state_t::ok) :
-
3223 basic(state),
-
3224 m_data(nullptr),
-
3225 m_offset(0),
-
3226 m_size(0),
-
3227 m_reserved(0),
-
3228 m_manage(true)
-
3229 {
-
3230#if SET_FILE_OP_TIMES
-
3231 m_ctime = m_atime = m_mtime = time_point::now();
-
3232#endif
-
3233 }
-
3234
-
-
3241 memory_file(_In_ size_t size, _In_ state_t state = state_t::ok) :
-
3242 basic(state),
-
3243 m_data(reinterpret_cast<uint8_t*>(malloc(size))),
-
3244 m_offset(0),
-
3245 m_size(0),
- -
3247 m_manage(true)
-
3248 {
-
3249 if (!m_data) {
-
3250 m_state = state_t::fail;
-
3251 throw std::bad_alloc();
-
3252 }
-
3253#if SET_FILE_OP_TIMES
-
3254 m_ctime = m_atime = m_mtime = time_point::now();
-
3255#endif
-
3256 }
+
3216
+
+ +
3221 {
+
3222 public:
+
3223 memory_file(_In_ state_t state = state_t::ok) :
+
3224 basic(state),
+
3225 m_data(nullptr),
+
3226 m_offset(0),
+
3227 m_size(0),
+
3228 m_reserved(0),
+
3229 m_manage(true)
+
3230 {
+
3231#if SET_FILE_OP_TIMES
+
3232 m_ctime = m_atime = m_mtime = time_point::now();
+
3233#endif
+
3234 }
+
3235
+
+
3242 memory_file(_In_ size_t size, _In_ state_t state = state_t::ok) :
+
3243 basic(state),
+
3244 m_data(reinterpret_cast<uint8_t*>(malloc(size))),
+
3245 m_offset(0),
+
3246 m_size(0),
+ +
3248 m_manage(true)
+
3249 {
+
3250 if (!m_data) {
+
3251 m_state = state_t::fail;
+
3252 throw std::bad_alloc();
+
3253 }
+
3254#if SET_FILE_OP_TIMES
+
3255 m_ctime = m_atime = m_mtime = time_point::now();
+
3256#endif
+
3257 }
-
3257
-
-
3267 memory_file(_Inout_ void* data, _In_ size_t size, _In_ size_t reserved, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
-
3268 basic(state),
-
3269 m_data(reinterpret_cast<uint8_t*>(data)),
-
3270 m_offset(0),
-
3271 m_size(size),
-
3272 m_reserved(reserved),
-
3273 m_manage(manage)
-
3274 {
-
3275 _Assume_(data || !size);
-
3276 _Assume_(reserved >= size);
-
3277#if SET_FILE_OP_TIMES
-
3278 m_ctime = m_atime = m_mtime = time_point::now();
-
3279#endif
-
3280 }
+
3258
+
+
3268 memory_file(_Inout_ void* data, _In_ size_t size, _In_ size_t reserved, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
+
3269 basic(state),
+
3270 m_data(reinterpret_cast<uint8_t*>(data)),
+
3271 m_offset(0),
+
3272 m_size(size),
+
3273 m_reserved(reserved),
+
3274 m_manage(manage)
+
3275 {
+
3276 _Assume_(data || !size);
+
3277 _Assume_(reserved >= size);
+
3278#if SET_FILE_OP_TIMES
+
3279 m_ctime = m_atime = m_mtime = time_point::now();
+
3280#endif
+
3281 }
-
3281
-
-
3290 memory_file(_Inout_ void* data, _In_ size_t size, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
-
3291 memory_file(data, size, size, manage, state)
-
3292 {}
+
3282
+
+
3291 memory_file(_Inout_ void* data, _In_ size_t size, _In_ bool manage = false, _In_ state_t state = state_t::ok) :
+
3292 memory_file(data, size, size, manage, state)
+
3293 {}
-
3293
-
-
3300 memory_file(_In_z_ const schar_t* filename, _In_ int mode) : memory_file()
-
3301 {
-
3302 load(filename, mode);
-
3303 }
+
3294
+
+
3301 memory_file(_In_z_ const schar_t* filename, _In_ int mode) : memory_file()
+
3302 {
+
3303 load(filename, mode);
+
3304 }
-
3304
-
3311 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
3312 memory_file(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode) : memory_file(filename.c_str(), mode) {}
-
3313
-
-
3319 memory_file(_In_ const memory_file& other) :
-
3320 basic_file(other),
-
3321 m_data(reinterpret_cast<uint8_t*>(malloc(other.m_size))),
-
3322 m_offset(other.m_offset),
-
3323 m_size(other.m_size),
-
3324 m_reserved(other.m_size),
-
3325 m_manage(true)
-
3326#if SET_FILE_OP_TIMES
-
3327 , m_ctime(other.m_ctime)
-
3328 , m_atime(other.m_atime)
-
3329 , m_mtime(other.m_mtime)
-
3330#endif
-
3331 {
-
3332 if (!m_data) {
-
3333 m_state = state_t::fail;
-
3334 throw std::bad_alloc();
-
3335 }
-
3336 memcpy(m_data, other.m_data, other.m_size);
-
3337 }
+
3305
+
3312 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
3313 memory_file(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode) : memory_file(filename.c_str(), mode) {}
+
3314
+
+
3320 memory_file(_In_ const memory_file& other) :
+
3321 basic_file(other),
+
3322 m_data(reinterpret_cast<uint8_t*>(malloc(other.m_size))),
+
3323 m_offset(other.m_offset),
+
3324 m_size(other.m_size),
+
3325 m_reserved(other.m_size),
+
3326 m_manage(true)
+
3327#if SET_FILE_OP_TIMES
+
3328 , m_ctime(other.m_ctime)
+
3329 , m_atime(other.m_atime)
+
3330 , m_mtime(other.m_mtime)
+
3331#endif
+
3332 {
+
3333 if (!m_data) {
+
3334 m_state = state_t::fail;
+
3335 throw std::bad_alloc();
+
3336 }
+
3337 memcpy(m_data, other.m_data, other.m_size);
+
3338 }
-
3338
-
- -
3345 {
-
3346 if (this != std::addressof(other)) {
-
3347 *static_cast<basic_file*>(this) = other;
-
3348 if (m_manage && m_data)
-
3349 free(m_data);
-
3350 m_data = reinterpret_cast<uint8_t*>(malloc(other.m_size));
-
3351 if (!m_data) {
-
3352 m_state = state_t::fail;
-
3353 throw std::bad_alloc();
-
3354 }
-
3355 memcpy(m_data, other.m_data, other.m_size);
-
3356 m_offset = other.m_offset;
-
3357 m_size = other.m_size;
-
3358 m_reserved = other.m_size;
-
3359 m_manage = true;
-
3360#if SET_FILE_OP_TIMES
-
3361 m_ctime = other.m_ctime;
-
3362 m_atime = other.m_atime;
-
3363 m_mtime = other.m_mtime;
-
3364#endif
-
3365 }
-
3366 return *this;
-
3367 }
+
3339
+
+ +
3346 {
+
3347 if (this != std::addressof(other)) {
+
3348 *static_cast<basic_file*>(this) = other;
+
3349 if (m_manage && m_data)
+
3350 free(m_data);
+
3351 m_data = reinterpret_cast<uint8_t*>(malloc(other.m_size));
+
3352 if (!m_data) {
+
3353 m_state = state_t::fail;
+
3354 throw std::bad_alloc();
+
3355 }
+
3356 memcpy(m_data, other.m_data, other.m_size);
+
3357 m_offset = other.m_offset;
+
3358 m_size = other.m_size;
+
3359 m_reserved = other.m_size;
+
3360 m_manage = true;
+
3361#if SET_FILE_OP_TIMES
+
3362 m_ctime = other.m_ctime;
+
3363 m_atime = other.m_atime;
+
3364 m_mtime = other.m_mtime;
+
3365#endif
+
3366 }
+
3367 return *this;
+
3368 }
-
3368
-
-
3374 memory_file(_Inout_ memory_file&& other) noexcept :
-
3375 basic_file(std::move(other)),
-
3376 m_data(other.m_data),
-
3377 m_offset(other.m_offset),
-
3378 m_size(other.m_size),
-
3379 m_reserved(other.m_reserved),
-
3380 m_manage(other.m_manage)
-
3381#if SET_FILE_OP_TIMES
-
3382 , m_ctime(other.m_ctime)
-
3383 , m_atime(other.m_atime)
-
3384 , m_mtime(other.m_mtime)
-
3385#endif
-
3386 {
-
3387 other.m_state = state_t::ok;
-
3388 other.m_data = nullptr;
-
3389 other.m_offset = 0;
-
3390 other.m_size = 0;
-
3391 other.m_reserved = 0;
-
3392 other.m_manage = true;
-
3393#if SET_FILE_OP_TIMES
-
3394 other.m_ctime = other.m_atime = other.m_mtime = time_point::now();
-
3395#endif
-
3396 }
+
3369
+
+
3375 memory_file(_Inout_ memory_file&& other) noexcept :
+
3376 basic_file(std::move(other)),
+
3377 m_data(other.m_data),
+
3378 m_offset(other.m_offset),
+
3379 m_size(other.m_size),
+
3380 m_reserved(other.m_reserved),
+
3381 m_manage(other.m_manage)
+
3382#if SET_FILE_OP_TIMES
+
3383 , m_ctime(other.m_ctime)
+
3384 , m_atime(other.m_atime)
+
3385 , m_mtime(other.m_mtime)
+
3386#endif
+
3387 {
+
3388 other.m_state = state_t::ok;
+
3389 other.m_data = nullptr;
+
3390 other.m_offset = 0;
+
3391 other.m_size = 0;
+
3392 other.m_reserved = 0;
+
3393 other.m_manage = true;
+
3394#if SET_FILE_OP_TIMES
+
3395 other.m_ctime = other.m_atime = other.m_mtime = time_point::now();
+
3396#endif
+
3397 }
-
3397
-
-
3403 memory_file& operator=(_Inout_ memory_file&& other) noexcept
-
3404 {
-
3405 if (this != std::addressof(other)) {
-
3406 *static_cast<basic_file*>(this) = std::move(other);
-
3407 if (m_manage && m_data)
-
3408 free(m_data);
-
3409 m_data = other.m_data;
-
3410 other.m_data = nullptr;
-
3411 m_offset = other.m_offset;
-
3412 other.m_offset = 0;
-
3413 m_size = other.m_size;
-
3414 other.m_size = 0;
-
3415 m_reserved = other.m_reserved;
-
3416 other.m_reserved = 0;
-
3417 m_manage = other.m_manage;
-
3418 other.m_manage = true;
-
3419#if SET_FILE_OP_TIMES
-
3420 m_ctime = other.m_ctime;
-
3421 m_atime = other.m_atime;
-
3422 m_mtime = other.m_mtime;
-
3423 other.m_ctime = other.m_atime = other.m_mtime = time_point::now();
-
3424#endif
-
3425 }
-
3426 return *this;
-
3427 }
+
3398
+
+
3404 memory_file& operator=(_Inout_ memory_file&& other) noexcept
+
3405 {
+
3406 if (this != std::addressof(other)) {
+
3407 *static_cast<basic_file*>(this) = std::move(other);
+
3408 if (m_manage && m_data)
+
3409 free(m_data);
+
3410 m_data = other.m_data;
+
3411 other.m_data = nullptr;
+
3412 m_offset = other.m_offset;
+
3413 other.m_offset = 0;
+
3414 m_size = other.m_size;
+
3415 other.m_size = 0;
+
3416 m_reserved = other.m_reserved;
+
3417 other.m_reserved = 0;
+
3418 m_manage = other.m_manage;
+
3419 other.m_manage = true;
+
3420#if SET_FILE_OP_TIMES
+
3421 m_ctime = other.m_ctime;
+
3422 m_atime = other.m_atime;
+
3423 m_mtime = other.m_mtime;
+
3424 other.m_ctime = other.m_atime = other.m_mtime = time_point::now();
+
3425#endif
+
3426 }
+
3427 return *this;
+
3428 }
-
3428
-
3429 virtual ~memory_file()
-
3430 {
-
3431 if (m_manage && m_data)
-
3432 free(m_data);
-
3433 }
-
3434
-
-
3441 void reserve(_In_ size_t required, _In_ bool tight = false) noexcept
-
3442 {
-
3443 if (required <= m_reserved && (!tight || required >= m_reserved)) {
-
3444 m_state = state_t::ok;
-
3445 return;
-
3446 }
-
3447 if (!m_manage) {
-
3448 m_state = state_t::fail;
-
3449 return;
-
3450 }
-
3451 size_t reserved = tight ? required : ((required + required / 4 + (default_block_size - 1)) / default_block_size) * default_block_size;
-
3452 auto data = reinterpret_cast<uint8_t*>(realloc(m_data, reserved));
-
3453 if (!data && reserved) _Unlikely_ {
-
3454 m_state = state_t::fail;
-
3455 return;
-
3456 }
-
3457 m_data = data;
-
3458 if (reserved < m_size)
-
3459 m_size = reserved;
-
3460 m_reserved = reserved;
-
3461 m_state = state_t::ok;
-
3462 }
+
3429
+
3430 virtual ~memory_file()
+
3431 {
+
3432 if (m_manage && m_data)
+
3433 free(m_data);
+
3434 }
+
3435
+
+
3442 void reserve(_In_ size_t required, _In_ bool tight = false) noexcept
+
3443 {
+
3444 if (required <= m_reserved && (!tight || required >= m_reserved)) {
+
3445 m_state = state_t::ok;
+
3446 return;
+
3447 }
+
3448 if (!m_manage) {
+
3449 m_state = state_t::fail;
+
3450 return;
+
3451 }
+
3452 size_t reserved = tight ? required : ((required + required / 4 + (default_block_size - 1)) / default_block_size) * default_block_size;
+
3453 auto data = reinterpret_cast<uint8_t*>(realloc(m_data, reserved));
+
3454 if (!data && reserved) _Unlikely_ {
+
3455 m_state = state_t::fail;
+
3456 return;
+
3457 }
+
3458 m_data = data;
+
3459 if (reserved < m_size)
+
3460 m_size = reserved;
+
3461 m_reserved = reserved;
+
3462 m_state = state_t::ok;
+
3463 }
-
3463
-
-
3470 void load(_In_z_ const schar_t* filename, _In_ int mode)
-
3471 {
-
3472 file f(filename, (mode & ~hint_random_access) | mode_for_reading | hint_sequential_access);
-
3473 if (!f.ok()) {
-
3474 m_state = state_t::fail;
-
3475 return;
-
3476 }
-
3477 fsize_t size = f.size();
-
3478 if (size > SIZE_MAX) {
-
3479 m_state = state_t::fail;
-
3480 return;
-
3481 }
-
3482 reserve(static_cast<size_t>(size), true);
-
3483 if (!ok()) _Unlikely_ {
-
3484 return;
-
3485 }
-
3486 m_offset = m_size = 0;
-
3487 write_stream(f);
-
3488 if (ok())
-
3489 m_offset = 0;
-
3490#if SET_FILE_OP_TIMES
-
3491 m_ctime = f.ctime();
-
3492 m_atime = f.atime();
-
3493 m_mtime = f.mtime();
-
3494#endif
-
3495 }
+
3464
+
+
3471 void load(_In_z_ const schar_t* filename, _In_ int mode)
+
3472 {
+
3473 file f(filename, (mode & ~hint_random_access) | mode_for_reading | hint_sequential_access);
+
3474 if (!f.ok()) {
+
3475 m_state = state_t::fail;
+
3476 return;
+
3477 }
+
3478 fsize_t size = f.size();
+
3479 if (size > SIZE_MAX) {
+
3480 m_state = state_t::fail;
+
3481 return;
+
3482 }
+
3483 reserve(static_cast<size_t>(size), true);
+
3484 if (!ok()) _Unlikely_ {
+
3485 return;
+
3486 }
+
3487 m_offset = m_size = 0;
+
3488 write_stream(f);
+
3489 if (ok())
+
3490 m_offset = 0;
+
3491#if SET_FILE_OP_TIMES
+
3492 m_ctime = f.ctime();
+
3493 m_atime = f.atime();
+
3494 m_mtime = f.mtime();
+
3495#endif
+
3496 }
-
3496
-
3503 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
-
3504 void load(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode)
-
3505 {
-
3506 load(filename.c_str(), mode);
-
3507 }
+
3497
+
3504 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
+
3505 void load(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode)
+
3506 {
+
3507 load(filename.c_str(), mode);
+
3508 }
-
3508
-
-
3515 void save(_In_z_ const schar_t* filename, _In_ int mode)
-
3516 {
-
3517 file f(filename, (mode & ~hint_random_access) | mode_for_writing | hint_sequential_access);
-
3518 if (!f.ok()) {
-
3519 m_state = state_t::fail;
-
3520 return;
-
3521 }
-
3522 f.write(m_data, m_size);
-
3523 if (!f.ok()) {
-
3524 m_state = state_t::fail;
-
3525 return;
-
3526 }
-
3527 f.truncate();
-
3528#if SET_FILE_OP_TIMES
-
3529 f.set_ctime(m_ctime);
-
3530 f.set_atime(m_atime);
-
3531 f.set_mtime(m_mtime);
-
3532#endif
-
3533 }
+
3509
+
+
3516 void save(_In_z_ const schar_t* filename, _In_ int mode)
+
3517 {
+
3518 file f(filename, (mode & ~hint_random_access) | mode_for_writing | hint_sequential_access);
+
3519 if (!f.ok()) {
+
3520 m_state = state_t::fail;
+
3521 return;
+
3522 }
+
3523 f.write(m_data, m_size);
+
3524 if (!f.ok()) {
+
3525 m_state = state_t::fail;
+
3526 return;
+
3527 }
+
3528 f.truncate();
+
3529#if SET_FILE_OP_TIMES
+
3530 f.set_ctime(m_ctime);
+
3531 f.set_atime(m_atime);
+
3532 f.set_mtime(m_mtime);
+
3533#endif
+
3534 }
-
3534
-
3541 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
-
-
3542 void save(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode)
-
3543 {
-
3544 save(filename.c_str(), mode);
-
3545 }
+
3535
+
3542 template <class TR = std::char_traits<schar_t>, class AX = std::allocator<schar_t>>
+
+
3543 void save(_In_ const std::basic_string<TR, AX>& filename, _In_ int mode)
+
3544 {
+
3545 save(filename.c_str(), mode);
+
3546 }
-
3546
-
3550 const void* data() const { return m_data; }
-
3551
-
-
3552 virtual _Success_(return != 0 || length == 0) size_t read(
-
3553 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
3554 {
-
3555 _Assume_(data || !length);
-
3556#if SET_FILE_OP_TIMES
-
3557 m_atime = time_point::now();
-
3558#endif
-
3559 size_t available = m_size - m_offset;
-
3560 if (length <= available) {
-
3561 memcpy(data, m_data + m_offset, length);
-
3562 m_offset += length;
-
3563 m_state = state_t::ok;
-
3564 return length;
-
3565 }
-
3566 if (length && !available) {
-
3567 m_state = state_t::eof;
-
3568 return 0;
-
3569 }
-
3570 memcpy(data, m_data + m_offset, available);
-
3571 m_offset += available;
-
3572 m_state = state_t::ok;
-
3573 return available;
-
3574 }
+
3547
+
3551 const void* data() const { return m_data; }
+
3552
+
+
3553 virtual _Success_(return != 0 || length == 0) size_t read(
+
3554 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
3555 {
+
3556 _Assume_(data || !length);
+
3557#if SET_FILE_OP_TIMES
+
3558 m_atime = time_point::now();
+
3559#endif
+
3560 size_t available = m_size - m_offset;
+
3561 if (length <= available) {
+
3562 memcpy(data, m_data + m_offset, length);
+
3563 m_offset += length;
+
3564 m_state = state_t::ok;
+
3565 return length;
+
3566 }
+
3567 if (length && !available) {
+
3568 m_state = state_t::eof;
+
3569 return 0;
+
3570 }
+
3571 memcpy(data, m_data + m_offset, available);
+
3572 m_offset += available;
+
3573 m_state = state_t::ok;
+
3574 return available;
+
3575 }
-
3575
-
3590 template <class T>
-
- -
3592 {
-
3593#if SET_FILE_OP_TIMES
-
3594 m_atime = time_point::now();
-
3595#endif
-
3596 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
-
3597 data = 0;
-
3598 return *this;
-
3599 }
-
3600 size_t end_offset = m_offset + sizeof(T);
-
3601 if (end_offset <= m_size) {
-
3602 data = LE2HE(*reinterpret_cast<T*>(m_data + m_offset));
-
3603 m_offset = end_offset;
-
3604#if !CHECK_STREAM_STATE
-
3605 m_state = state_t::ok;
-
3606#endif
-
3607 }
-
3608 else {
-
3609 data = 0;
-
3610 m_offset = m_size;
-
3611 m_state = state_t::eof;
-
3612 }
-
3613 return *this;
-
3614 }
+
3576
+
3591 template <class T>
+
+ +
3593 {
+
3594#if SET_FILE_OP_TIMES
+
3595 m_atime = time_point::now();
+
3596#endif
+
3597 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
+
3598 data = 0;
+
3599 return *this;
+
3600 }
+
3601 size_t end_offset = m_offset + sizeof(T);
+
3602 if (end_offset <= m_size) {
+
3603 data = LE2HE(*reinterpret_cast<T*>(m_data + m_offset));
+
3604 m_offset = end_offset;
+
3605#if !CHECK_STREAM_STATE
+
3606 m_state = state_t::ok;
+
3607#endif
+
3608 }
+
3609 else {
+
3610 data = 0;
+
3611 m_offset = m_size;
+
3612 m_state = state_t::eof;
+
3613 }
+
3614 return *this;
+
3615 }
-
3615
-
3630 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
-
-
3631 memory_file& read_str(_Inout_ std::basic_string<T, TR, AX>&data)
-
3632 {
-
3633#if SET_FILE_OP_TIMES
-
3634 m_atime = time_point::now();
-
3635#endif
-
3636 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
-
3637 data.clear();
-
3638 return *this;
-
3639 }
-
3640 size_t end_offset = m_offset + sizeof(uint32_t);
-
3641 if (end_offset <= m_size) {
-
3642 uint32_t num_chars = LE2HE(*reinterpret_cast<uint32_t*>(m_data + m_offset));
-
3643 m_offset = end_offset;
-
3644 end_offset = stdex::add(m_offset, stdex::mul(num_chars, sizeof(T)));
-
3645 T* start = reinterpret_cast<T*>(m_data + m_offset);
-
3646 if (end_offset <= m_size) {
-
3647 data.assign(start, start + num_chars);
-
3648 m_offset = end_offset;
-
3649#if !CHECK_STREAM_STATE
-
3650 m_state = state_t::ok;
-
3651#endif
-
3652 return *this;
-
3653 }
-
3654 if (end_offset <= m_size)
-
3655 data.assign(start, reinterpret_cast<T*>(m_data + m_size));
-
3656 }
-
3657 m_offset = m_size;
-
3658 m_state = state_t::eof;
-
3659 return *this;
-
3660 }
+
3616
+
3631 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
+
+
3632 memory_file& read_str(_Inout_ std::basic_string<T, TR, AX>&data)
+
3633 {
+
3634#if SET_FILE_OP_TIMES
+
3635 m_atime = time_point::now();
+
3636#endif
+
3637 if (CHECK_STREAM_STATE && !ok()) _Unlikely_ {
+
3638 data.clear();
+
3639 return *this;
+
3640 }
+
3641 size_t end_offset = m_offset + sizeof(uint32_t);
+
3642 if (end_offset <= m_size) {
+
3643 uint32_t num_chars = LE2HE(*reinterpret_cast<uint32_t*>(m_data + m_offset));
+
3644 m_offset = end_offset;
+
3645 end_offset = stdex::add(m_offset, stdex::mul(num_chars, sizeof(T)));
+
3646 T* start = reinterpret_cast<T*>(m_data + m_offset);
+
3647 if (end_offset <= m_size) {
+
3648 data.assign(start, start + num_chars);
+
3649 m_offset = end_offset;
+
3650#if !CHECK_STREAM_STATE
+
3651 m_state = state_t::ok;
+
3652#endif
+
3653 return *this;
+
3654 }
+
3655 if (end_offset <= m_size)
+
3656 data.assign(start, reinterpret_cast<T*>(m_data + m_size));
+
3657 }
+
3658 m_offset = m_size;
+
3659 m_state = state_t::eof;
+
3660 return *this;
+
3661 }
-
3661
-
-
3662 virtual _Success_(return != 0) size_t write(
-
3663 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
3664 {
-
3665 _Assume_(data || !length);
-
3666#if SET_FILE_OP_TIMES
-
3667 m_atime = m_mtime = time_point::now();
-
3668#endif
-
3669 size_t end_offset = m_offset + length;
-
3670 if (end_offset > m_reserved) {
-
3671 reserve(end_offset);
-
3672 if (!ok()) _Unlikely_
-
3673 return 0;
-
3674 }
-
3675 memcpy(m_data + m_offset, data, length);
-
3676 m_offset = end_offset;
-
3677 if (m_offset > m_size)
-
3678 m_size = m_offset;
-
3679 m_state = state_t::ok;
-
3680 return length;
-
3681 }
+
3662
+
+
3663 virtual _Success_(return != 0) size_t write(
+
3664 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
3665 {
+
3666 _Assume_(data || !length);
+
3667#if SET_FILE_OP_TIMES
+
3668 m_atime = m_mtime = time_point::now();
+
3669#endif
+
3670 size_t end_offset = m_offset + length;
+
3671 if (end_offset > m_reserved) {
+
3672 reserve(end_offset);
+
3673 if (!ok()) _Unlikely_
+
3674 return 0;
+
3675 }
+
3676 memcpy(m_data + m_offset, data, length);
+
3677 m_offset = end_offset;
+
3678 if (m_offset > m_size)
+
3679 m_size = m_offset;
+
3680 m_state = state_t::ok;
+
3681 return length;
+
3682 }
-
3682
-
-
3686 void write_byte(_In_ uint8_t byte, _In_ size_t amount = 1)
-
3687 {
-
3688#if SET_FILE_OP_TIMES
-
3689 m_atime = m_mtime = time_point::now();
-
3690#endif
-
3691 size_t end_offset = m_offset + amount;
-
3692 if (end_offset > m_reserved) {
-
3693 reserve(end_offset);
-
3694 if (!ok()) _Unlikely_
-
3695 return;
-
3696 }
-
3697 memset(m_data + m_offset, byte, amount);
-
3698 m_offset = end_offset;
-
3699 if (m_offset > m_size)
-
3700 m_size = m_offset;
-
3701 m_state = state_t::ok;
-
3702 }
+
3683
+
+
3687 void write_byte(_In_ uint8_t byte, _In_ size_t amount = 1)
+
3688 {
+
3689#if SET_FILE_OP_TIMES
+
3690 m_atime = m_mtime = time_point::now();
+
3691#endif
+
3692 size_t end_offset = m_offset + amount;
+
3693 if (end_offset > m_reserved) {
+
3694 reserve(end_offset);
+
3695 if (!ok()) _Unlikely_
+
3696 return;
+
3697 }
+
3698 memset(m_data + m_offset, byte, amount);
+
3699 m_offset = end_offset;
+
3700 if (m_offset > m_size)
+
3701 m_size = m_offset;
+
3702 m_state = state_t::ok;
+
3703 }
-
3703
-
3718 template <class T>
-
- -
3720 {
-
3721#if SET_FILE_OP_TIMES
-
3722 m_atime = m_mtime = time_point::now();
-
3723#endif
-
3724 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
-
3725 return *this;
-
3726 size_t end_offset = m_offset + sizeof(T);
-
3727 if (end_offset > m_reserved) {
-
3728 reserve(end_offset);
-
3729 if (!ok()) _Unlikely_
-
3730 return *this;
-
3731 }
-
3732 (*reinterpret_cast<T*>(m_data + m_offset)) = HE2LE(data);
-
3733 m_offset = end_offset;
-
3734 if (m_offset > m_size)
-
3735 m_size = m_offset;
-
3736#if !CHECK_STREAM_STATE
-
3737 m_state = state_t::ok;
-
3738#endif
-
3739 return *this;
-
3740 }
+
3704
+
3719 template <class T>
+
+ +
3721 {
+
3722#if SET_FILE_OP_TIMES
+
3723 m_atime = m_mtime = time_point::now();
+
3724#endif
+
3725 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
+
3726 return *this;
+
3727 size_t end_offset = m_offset + sizeof(T);
+
3728 if (end_offset > m_reserved) {
+
3729 reserve(end_offset);
+
3730 if (!ok()) _Unlikely_
+
3731 return *this;
+
3732 }
+
3733 (*reinterpret_cast<T*>(m_data + m_offset)) = HE2LE(data);
+
3734 m_offset = end_offset;
+
3735 if (m_offset > m_size)
+
3736 m_size = m_offset;
+
3737#if !CHECK_STREAM_STATE
+
3738 m_state = state_t::ok;
+
3739#endif
+
3740 return *this;
+
3741 }
-
3741
-
3756 template <class T>
-
-
3757 memory_file& write_str(_In_z_ const T * data)
-
3758 {
-
3759#if SET_FILE_OP_TIMES
-
3760 m_atime = m_mtime = time_point::now();
-
3761#endif
-
3762 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
-
3763 return *this;
-
3764 size_t num_chars = stdex::strlen(data);
-
3765 if (num_chars > UINT32_MAX)
-
3766 throw std::invalid_argument("string too long");
-
3767 size_t size_chars = num_chars * sizeof(T);
-
3768 size_t size = sizeof(uint32_t) + size_chars;
-
3769 size_t end_offset = m_offset + size;
-
3770 if (end_offset > m_reserved) {
-
3771 reserve(end_offset);
-
3772 if (!ok()) _Unlikely_
-
3773 return *this;
-
3774 }
-
3775 auto p = m_data + m_offset;
-
3776 *reinterpret_cast<uint32_t*>(p) = HE2LE((uint32_t)num_chars);
-
3777 memcpy(p + sizeof(uint32_t), data, size_chars);
-
3778 m_offset = end_offset;
-
3779 if (m_offset > m_size)
-
3780 m_size = m_offset;
-
3781#if !CHECK_STREAM_STATE
-
3782 m_state = state_t::ok;
-
3783#endif
-
3784 return *this;
-
3785 }
+
3742
+
3757 template <class T>
+
+
3758 memory_file& write_str(_In_z_ const T * data)
+
3759 {
+
3760#if SET_FILE_OP_TIMES
+
3761 m_atime = m_mtime = time_point::now();
+
3762#endif
+
3763 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
+
3764 return *this;
+
3765 size_t num_chars = stdex::strlen(data);
+
3766 if (num_chars > UINT32_MAX)
+
3767 throw std::invalid_argument("string too long");
+
3768 size_t size_chars = num_chars * sizeof(T);
+
3769 size_t size = sizeof(uint32_t) + size_chars;
+
3770 size_t end_offset = m_offset + size;
+
3771 if (end_offset > m_reserved) {
+
3772 reserve(end_offset);
+
3773 if (!ok()) _Unlikely_
+
3774 return *this;
+
3775 }
+
3776 auto p = m_data + m_offset;
+
3777 *reinterpret_cast<uint32_t*>(p) = HE2LE((uint32_t)num_chars);
+
3778 memcpy(p + sizeof(uint32_t), data, size_chars);
+
3779 m_offset = end_offset;
+
3780 if (m_offset > m_size)
+
3781 m_size = m_offset;
+
3782#if !CHECK_STREAM_STATE
+
3783 m_state = state_t::ok;
+
3784#endif
+
3785 return *this;
+
3786 }
-
3786
-
3801 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
-
-
3802 memory_file& write_str(_In_ const std::basic_string<T, TR, AX>& data)
-
3803 {
-
3804#if SET_FILE_OP_TIMES
-
3805 m_atime = m_mtime = time_point::now();
-
3806#endif
-
3807 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
-
3808 return *this;
-
3809 size_t num_chars = data.size();
-
3810 if (num_chars > UINT32_MAX)
-
3811 throw std::invalid_argument("string too long");
-
3812 size_t size_chars = num_chars * sizeof(T);
-
3813 size_t size = sizeof(uint32_t) + size_chars;
-
3814 size_t end_offset = m_offset + size;
-
3815 if (end_offset > m_reserved) {
-
3816 reserve(end_offset);
-
3817 if (!ok()) _Unlikely_
-
3818 return *this;
-
3819 }
-
3820 auto p = m_data + m_offset;
-
3821 *reinterpret_cast<uint32_t*>(p) = HE2LE((uint32_t)num_chars);
-
3822 memcpy(p + sizeof(uint32_t), data.data(), size_chars);
-
3823 m_offset = end_offset;
-
3824 if (m_offset > m_size)
-
3825 m_size = m_offset;
-
3826#if !CHECK_STREAM_STATE
-
3827 m_state = state_t::ok;
-
3828#endif
-
3829 return *this;
-
3830 }
+
3787
+
3802 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
+
+
3803 memory_file& write_str(_In_ const std::basic_string<T, TR, AX>& data)
+
3804 {
+
3805#if SET_FILE_OP_TIMES
+
3806 m_atime = m_mtime = time_point::now();
+
3807#endif
+
3808 if (CHECK_STREAM_STATE && !ok()) _Unlikely_
+
3809 return *this;
+
3810 size_t num_chars = data.size();
+
3811 if (num_chars > UINT32_MAX)
+
3812 throw std::invalid_argument("string too long");
+
3813 size_t size_chars = num_chars * sizeof(T);
+
3814 size_t size = sizeof(uint32_t) + size_chars;
+
3815 size_t end_offset = m_offset + size;
+
3816 if (end_offset > m_reserved) {
+
3817 reserve(end_offset);
+
3818 if (!ok()) _Unlikely_
+
3819 return *this;
+
3820 }
+
3821 auto p = m_data + m_offset;
+
3822 *reinterpret_cast<uint32_t*>(p) = HE2LE((uint32_t)num_chars);
+
3823 memcpy(p + sizeof(uint32_t), data.data(), size_chars);
+
3824 m_offset = end_offset;
+
3825 if (m_offset > m_size)
+
3826 m_size = m_offset;
+
3827#if !CHECK_STREAM_STATE
+
3828 m_state = state_t::ok;
+
3829#endif
+
3830 return *this;
+
3831 }
-
3831
-
-
3837 size_t write_stream(_Inout_ basic & stream, _In_ size_t amount = SIZE_MAX)
-
3838 {
-
3839#if SET_FILE_OP_TIMES
-
3840 m_atime = m_mtime = time_point::now();
-
3841#endif
-
3842 size_t num_read, dst_offset = m_offset, dst_size = m_offset;
-
3843 size_t num_copied = 0, to_write = amount;
-
3844 m_state = state_t::ok;
-
3845 if (amount != SIZE_MAX) {
-
3846 dst_size = stdex::add(dst_size, amount);
-
3847 reserve(dst_size);
-
3848 if (!ok()) _Unlikely_
-
3849 return 0;
-
3850 while (to_write) {
-
3851 num_read = stream.read(m_data + dst_offset, to_write);
-
3852 dst_size = dst_offset += num_read;
-
3853 num_copied += num_read;
-
3854 to_write -= num_read;
-
3855 if (!stream.ok()) {
-
3856 if (stream.state() != state_t::eof)
-
3857 m_state = state_t::fail;
-
3858 break;
-
3859 }
-
3860 };
-
3861 }
-
3862 else {
-
3863 size_t block_size;
-
3864 while (to_write) {
-
3865 block_size = std::min(to_write, default_block_size);
-
3866 dst_size = stdex::add(dst_size, block_size);
-
3867 reserve(dst_size);
-
3868 if (!ok()) _Unlikely_
-
3869 break;
-
3870 num_read = stream.read(m_data + dst_offset, block_size);
-
3871 dst_size = dst_offset += num_read;
-
3872 num_copied += num_read;
-
3873 to_write -= num_read;
-
3874 if (!stream.ok()) {
-
3875 if (stream.state() != state_t::eof)
-
3876 m_state = state_t::fail;
-
3877 break;
-
3878 }
-
3879 };
-
3880 }
-
3881 m_offset = dst_offset;
-
3882 if (m_offset > m_size)
-
3883 m_size = m_offset;
-
3884 return num_copied;
-
3885 }
+
3832
+
+
3838 size_t write_stream(_Inout_ basic & stream, _In_ size_t amount = SIZE_MAX)
+
3839 {
+
3840#if SET_FILE_OP_TIMES
+
3841 m_atime = m_mtime = time_point::now();
+
3842#endif
+
3843 size_t num_read, dst_offset = m_offset, dst_size = m_offset;
+
3844 size_t num_copied = 0, to_write = amount;
+
3845 m_state = state_t::ok;
+
3846 if (amount != SIZE_MAX) {
+
3847 dst_size = stdex::add(dst_size, amount);
+
3848 reserve(dst_size);
+
3849 if (!ok()) _Unlikely_
+
3850 return 0;
+
3851 while (to_write) {
+
3852 num_read = stream.read(m_data + dst_offset, to_write);
+
3853 /*dst_size =*/ dst_offset += num_read;
+
3854 num_copied += num_read;
+
3855 to_write -= num_read;
+
3856 if (!stream.ok()) {
+
3857 if (stream.state() != state_t::eof)
+
3858 m_state = state_t::fail;
+
3859 break;
+
3860 }
+
3861 };
+
3862 }
+
3863 else {
+
3864 size_t block_size;
+
3865 while (to_write) {
+
3866 block_size = std::min(to_write, default_block_size);
+
3867 dst_size = stdex::add(dst_size, block_size);
+
3868 reserve(dst_size);
+
3869 if (!ok()) _Unlikely_
+
3870 break;
+
3871 num_read = stream.read(m_data + dst_offset, block_size);
+
3872 dst_size = dst_offset += num_read;
+
3873 num_copied += num_read;
+
3874 to_write -= num_read;
+
3875 if (!stream.ok()) {
+
3876 if (stream.state() != state_t::eof)
+
3877 m_state = state_t::fail;
+
3878 break;
+
3879 }
+
3880 };
+
3881 }
+
3882 m_offset = dst_offset;
+
3883 if (m_offset > m_size)
+
3884 m_size = m_offset;
+
3885 return num_copied;
+
3886 }
-
3886
-
-
3887 virtual void close()
-
3888 {
-
3889 if (m_manage && m_data)
-
3890 free(m_data);
-
3891 m_data = nullptr;
-
3892 m_manage = true;
-
3893 m_offset = 0;
-
3894 m_size = m_reserved = 0;
-
3895#if SET_FILE_OP_TIMES
-
3896 m_ctime = m_atime = m_mtime = time_point::min();
-
3897#endif
-
3898 m_state = state_t::ok;
-
3899 }
+
3887
+
+
3888 virtual void close()
+
3889 {
+
3890 if (m_manage && m_data)
+
3891 free(m_data);
+
3892 m_data = nullptr;
+
3893 m_manage = true;
+
3894 m_offset = 0;
+
3895 m_size = m_reserved = 0;
+
3896#if SET_FILE_OP_TIMES
+
3897 m_ctime = m_atime = m_mtime = time_point::min();
+
3898#endif
+
3899 m_state = state_t::ok;
+
3900 }
-
3900
-
-
3901 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
3902 {
-
3903 switch (how) {
-
3904 case seek_t::beg: break;
-
3905 case seek_t::cur: offset = static_cast<foff_t>(m_offset) + offset; break;
-
3906 case seek_t::end: offset = static_cast<foff_t>(m_size) + offset; break;
-
3907 default: throw std::invalid_argument("unknown seek origin");
-
3908 }
-
3909 if (offset < 0) _Unlikely_
-
3910 throw std::invalid_argument("negative file offset");
-
3911 if (static_cast<fpos_t>(offset) > SIZE_MAX) _Unlikely_
-
3912 throw std::invalid_argument("file offset too big");
-
3913 m_state = state_t::ok;
-
3914 return m_offset = static_cast<size_t>(offset);
-
3915 }
+
3901
+
+
3902 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
3903 {
+
3904 switch (how) {
+
3905 case seek_t::beg: break;
+
3906 case seek_t::cur: offset = static_cast<foff_t>(m_offset) + offset; break;
+
3907 case seek_t::end: offset = static_cast<foff_t>(m_size) + offset; break;
+
3908 default: throw std::invalid_argument("unknown seek origin");
+
3909 }
+
3910 if (offset < 0) _Unlikely_
+
3911 throw std::invalid_argument("negative file offset");
+
3912 if (static_cast<fpos_t>(offset) > SIZE_MAX) _Unlikely_
+
3913 throw std::invalid_argument("file offset too big");
+
3914 m_state = state_t::ok;
+
3915 return m_offset = static_cast<size_t>(offset);
+
3916 }
-
3916
-
-
3917 virtual fpos_t tell() const
-
3918 {
-
3919 return m_offset;
-
3920 }
+
3917
+
+
3918 virtual fpos_t tell() const
+
3919 {
+
3920 return m_offset;
+
3921 }
-
3921
-
-
3922 virtual fsize_t size() const
-
3923 {
-
3924 return m_size;
-
3925 }
+
3922
+
+
3923 virtual fsize_t size() const
+
3924 {
+
3925 return m_size;
+
3926 }
-
3926
-
-
3927 virtual void truncate()
-
3928 {
-
3929#if SET_FILE_OP_TIMES
-
3930 m_atime = m_mtime = time_point::now();
-
3931#endif
-
3932 m_size = m_offset;
- -
3934 }
+
3927
+
+
3928 virtual void truncate()
+
3929 {
+
3930#if SET_FILE_OP_TIMES
+
3931 m_atime = m_mtime = time_point::now();
+
3932#endif
+
3933 m_size = m_offset;
+ +
3935 }
-
3935
-
3936#if SET_FILE_OP_TIMES
-
3937 virtual time_point ctime() const
-
3938 {
-
3939 return m_ctime;
-
3940 }
-
3941
-
3942 virtual time_point atime() const
-
3943 {
-
3944 return m_atime;
-
3945 }
-
3946
-
3947 virtual time_point mtime() const
-
3948 {
-
3949 return m_mtime;
-
3950 }
-
3951
-
3952 virtual void set_ctime(time_point date)
-
3953 {
-
3954 m_ctime = date;
-
3955 }
-
3956
-
3957 virtual void set_atime(time_point date)
-
3958 {
-
3959 m_atime = date;
-
3960 }
-
3961
-
3962 virtual void set_mtime(time_point date)
-
3963 {
-
3964 m_mtime = date;
-
3965 }
-
3966#endif
-
3967
-
3968 protected:
-
3976 template <class T>
-
-
3977 void set(_In_ fpos_t offset, _In_ const T data)
-
3978 {
-
3979#if SET_FILE_OP_TIMES
-
3980 m_atime = m_mtime = time_point::now();
-
3981#endif
-
3982 _Assume_(offset + sizeof(T) < m_size);
-
3983 (*reinterpret_cast<T*>(m_data + offset)) = HE2LE(data);
-
3984 }
+
3936
+
3937#if SET_FILE_OP_TIMES
+
3938 virtual time_point ctime() const
+
3939 {
+
3940 return m_ctime;
+
3941 }
+
3942
+
3943 virtual time_point atime() const
+
3944 {
+
3945 return m_atime;
+
3946 }
+
3947
+
3948 virtual time_point mtime() const
+
3949 {
+
3950 return m_mtime;
+
3951 }
+
3952
+
3953 virtual void set_ctime(time_point date)
+
3954 {
+
3955 m_ctime = date;
+
3956 }
+
3957
+
3958 virtual void set_atime(time_point date)
+
3959 {
+
3960 m_atime = date;
+
3961 }
+
3962
+
3963 virtual void set_mtime(time_point date)
+
3964 {
+
3965 m_mtime = date;
+
3966 }
+
3967#endif
+
3968
+
3969 protected:
+
3977 template <class T>
+
+
3978 void set(_In_ fpos_t offset, _In_ const T data)
+
3979 {
+
3980#if SET_FILE_OP_TIMES
+
3981 m_atime = m_mtime = time_point::now();
+
3982#endif
+
3983 _Assume_(offset + sizeof(T) < m_size);
+
3984 (*reinterpret_cast<T*>(m_data + offset)) = HE2LE(data);
+
3985 }
-
3985
-
3986 public:
-
3987 void set(_In_ fpos_t offset, _In_ const int8_t data) { set<int8_t>(offset, data); }
-
3988 void set(_In_ fpos_t offset, _In_ const int16_t data) { set<int16_t>(offset, data); }
-
3989 void set(_In_ fpos_t offset, _In_ const int32_t data) { set<int32_t>(offset, data); }
-
3990 void set(_In_ fpos_t offset, _In_ const int64_t data) { set<int64_t>(offset, data); }
-
3991 void set(_In_ fpos_t offset, _In_ const uint8_t data) { set<uint8_t>(offset, data); }
-
3992 void set(_In_ fpos_t offset, _In_ const uint16_t data) { set<uint16_t>(offset, data); }
-
3993 void set(_In_ fpos_t offset, _In_ const uint32_t data) { set<uint32_t>(offset, data); }
-
3994 void set(_In_ fpos_t offset, _In_ const uint64_t data) { set<uint64_t>(offset, data); }
-
3995 void set(_In_ fpos_t offset, _In_ const float data) { set<float>(offset, data); }
-
3996 void set(_In_ fpos_t offset, _In_ const double data) { set<double>(offset, data); }
-
3997 void set(_In_ fpos_t offset, _In_ const char data) { set<char>(offset, data); }
-
3998#ifdef _NATIVE_WCHAR_T_DEFINED
-
3999 void set(_In_ fpos_t offset, _In_ const wchar_t data) { set<wchar_t>(offset, data); }
-
4000#endif
-
4001
-
4009 protected:
-
4010 template <class T>
-
-
4011 void get(_In_ fpos_t offset, _Out_ T & data)
-
4012 {
-
4013 _Assume_(offset + sizeof(T) < m_size);
-
4014 data = LE2HE(*(T*)(m_data + offset));
-
4015#if SET_FILE_OP_TIMES
-
4016 m_atime = time_point::now();
-
4017#endif
-
4018 }
+
3986
+
3987 public:
+
3988 void set(_In_ fpos_t offset, _In_ const int8_t data) { set<int8_t>(offset, data); }
+
3989 void set(_In_ fpos_t offset, _In_ const int16_t data) { set<int16_t>(offset, data); }
+
3990 void set(_In_ fpos_t offset, _In_ const int32_t data) { set<int32_t>(offset, data); }
+
3991 void set(_In_ fpos_t offset, _In_ const int64_t data) { set<int64_t>(offset, data); }
+
3992 void set(_In_ fpos_t offset, _In_ const uint8_t data) { set<uint8_t>(offset, data); }
+
3993 void set(_In_ fpos_t offset, _In_ const uint16_t data) { set<uint16_t>(offset, data); }
+
3994 void set(_In_ fpos_t offset, _In_ const uint32_t data) { set<uint32_t>(offset, data); }
+
3995 void set(_In_ fpos_t offset, _In_ const uint64_t data) { set<uint64_t>(offset, data); }
+
3996 void set(_In_ fpos_t offset, _In_ const float data) { set<float>(offset, data); }
+
3997 void set(_In_ fpos_t offset, _In_ const double data) { set<double>(offset, data); }
+
3998 void set(_In_ fpos_t offset, _In_ const char data) { set<char>(offset, data); }
+
3999#ifdef _NATIVE_WCHAR_T_DEFINED
+
4000 void set(_In_ fpos_t offset, _In_ const wchar_t data) { set<wchar_t>(offset, data); }
+
4001#endif
+
4002
+
4010 protected:
+
4011 template <class T>
+
+
4012 void get(_In_ fpos_t offset, _Out_ T & data)
+
4013 {
+
4014 _Assume_(offset + sizeof(T) < m_size);
+
4015 data = LE2HE(*(T*)(m_data + offset));
+
4016#if SET_FILE_OP_TIMES
+
4017 m_atime = time_point::now();
+
4018#endif
+
4019 }
-
4019
-
4020 public:
-
4021 void get(_In_ fpos_t offset, _Out_ int8_t & data) { get<int8_t>(offset, data); }
-
4022 void get(_In_ fpos_t offset, _Out_ int16_t & data) { get<int16_t>(offset, data); }
-
4023 void get(_In_ fpos_t offset, _Out_ int32_t & data) { get<int32_t>(offset, data); }
-
4024 void get(_In_ fpos_t offset, _Out_ int64_t & data) { get<int64_t>(offset, data); }
-
4025 void get(_In_ fpos_t offset, _Out_ uint8_t & data) { get<uint8_t>(offset, data); }
-
4026 void get(_In_ fpos_t offset, _Out_ uint16_t & data) { get<uint16_t>(offset, data); }
-
4027 void get(_In_ fpos_t offset, _Out_ uint32_t & data) { get<uint32_t>(offset, data); }
-
4028 void get(_In_ fpos_t offset, _Out_ uint64_t & data) { get<uint64_t>(offset, data); }
-
4029 void get(_In_ fpos_t offset, _Out_ float& data) { get<float>(offset, data); }
-
4030 void get(_In_ fpos_t offset, _Out_ double& data) { get<double>(offset, data); }
-
4031 void get(_In_ fpos_t offset, _Out_ char& data) { get<char>(offset, data); }
-
4032#ifdef _NATIVE_WCHAR_T_DEFINED
-
4033 void get(_In_ fpos_t offset, _Out_ wchar_t& data) { get<wchar_t>(offset, data); }
-
4034#endif
-
4035
-
4036 memory_file& operator <<(_In_ const int8_t data) { return write_data(data); }
-
4037 memory_file& operator >>(_Out_ int8_t & data) { return read_data(data); }
-
4038 memory_file& operator <<(_In_ const int16_t data) { return write_data(data); }
-
4039 memory_file& operator >>(_Out_ int16_t & data) { return read_data(data); }
-
4040 memory_file& operator <<(_In_ const int32_t data) { return write_data(data); }
-
4041 memory_file& operator >>(_Out_ int32_t & data) { return read_data(data); }
-
4042 memory_file& operator <<(_In_ const int64_t data) { return write_data(data); }
-
4043 memory_file& operator >>(_Out_ int64_t & data) { return read_data(data); }
-
4044 memory_file& operator <<(_In_ const uint8_t data) { return write_data(data); }
-
4045 memory_file& operator >>(_Out_ uint8_t & data) { return read_data(data); }
-
4046 memory_file& operator <<(_In_ const uint16_t data) { return write_data(data); }
-
4047 memory_file& operator >>(_Out_ uint16_t & data) { return read_data(data); }
-
4048 memory_file& operator <<(_In_ const uint32_t data) { return write_data(data); }
-
4049 memory_file& operator >>(_Out_ uint32_t & data) { return read_data(data); }
-
4050 memory_file& operator <<(_In_ const uint64_t data) { return write_data(data); }
-
4051 memory_file& operator >>(_Out_ uint64_t & data) { return read_data(data); }
-
4052 memory_file& operator <<(_In_ const float data) { return write_data(data); }
-
4053 memory_file& operator >>(_Out_ float& data) { return read_data(data); }
-
4054 memory_file& operator <<(_In_ const double data) { return write_data(data); }
-
4055 memory_file& operator >>(_Out_ double& data) { return read_data(data); }
-
4056 memory_file& operator <<(_In_ const char data) { return write_data(data); }
-
4057 memory_file& operator >>(_Out_ char& data) { return read_data(data); }
-
4058#ifdef _NATIVE_WCHAR_T_DEFINED
-
4059 memory_file& operator <<(_In_ const wchar_t data) { return write_data(data); }
-
4060 memory_file& operator >>(_Out_ wchar_t& data) { return read_data(data); }
-
4061#endif
-
4062 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
-
4063 memory_file& operator >>(_Out_ std::basic_string<T, TR, AX>&data) { return read_str(data); }
-
4064 template <class T>
-
4065 memory_file& operator <<(_In_ const T * data) { return write_str(data); }
-
4066 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
-
4067 memory_file& operator <<(_In_ const std::basic_string<T, TR, AX>& data) { return write_str(data); }
-
4068
-
4069 protected:
-
4070 uint8_t* m_data;
- -
4072 size_t m_offset;
-
4073 size_t m_size;
-
4074 size_t m_reserved;
-
4075#if SET_FILE_OP_TIMES
-
4076 time_point
-
4077 m_ctime,
-
4078 m_atime,
-
4079 m_mtime;
-
4080#endif
-
4081 };
+
4020
+
4021 public:
+
4022 void get(_In_ fpos_t offset, _Out_ int8_t & data) { get<int8_t>(offset, data); }
+
4023 void get(_In_ fpos_t offset, _Out_ int16_t & data) { get<int16_t>(offset, data); }
+
4024 void get(_In_ fpos_t offset, _Out_ int32_t & data) { get<int32_t>(offset, data); }
+
4025 void get(_In_ fpos_t offset, _Out_ int64_t & data) { get<int64_t>(offset, data); }
+
4026 void get(_In_ fpos_t offset, _Out_ uint8_t & data) { get<uint8_t>(offset, data); }
+
4027 void get(_In_ fpos_t offset, _Out_ uint16_t & data) { get<uint16_t>(offset, data); }
+
4028 void get(_In_ fpos_t offset, _Out_ uint32_t & data) { get<uint32_t>(offset, data); }
+
4029 void get(_In_ fpos_t offset, _Out_ uint64_t & data) { get<uint64_t>(offset, data); }
+
4030 void get(_In_ fpos_t offset, _Out_ float& data) { get<float>(offset, data); }
+
4031 void get(_In_ fpos_t offset, _Out_ double& data) { get<double>(offset, data); }
+
4032 void get(_In_ fpos_t offset, _Out_ char& data) { get<char>(offset, data); }
+
4033#ifdef _NATIVE_WCHAR_T_DEFINED
+
4034 void get(_In_ fpos_t offset, _Out_ wchar_t& data) { get<wchar_t>(offset, data); }
+
4035#endif
+
4036
+
4037 memory_file& operator <<(_In_ const int8_t data) { return write_data(data); }
+
4038 memory_file& operator >>(_Out_ int8_t & data) { return read_data(data); }
+
4039 memory_file& operator <<(_In_ const int16_t data) { return write_data(data); }
+
4040 memory_file& operator >>(_Out_ int16_t & data) { return read_data(data); }
+
4041 memory_file& operator <<(_In_ const int32_t data) { return write_data(data); }
+
4042 memory_file& operator >>(_Out_ int32_t & data) { return read_data(data); }
+
4043 memory_file& operator <<(_In_ const int64_t data) { return write_data(data); }
+
4044 memory_file& operator >>(_Out_ int64_t & data) { return read_data(data); }
+
4045 memory_file& operator <<(_In_ const uint8_t data) { return write_data(data); }
+
4046 memory_file& operator >>(_Out_ uint8_t & data) { return read_data(data); }
+
4047 memory_file& operator <<(_In_ const uint16_t data) { return write_data(data); }
+
4048 memory_file& operator >>(_Out_ uint16_t & data) { return read_data(data); }
+
4049 memory_file& operator <<(_In_ const uint32_t data) { return write_data(data); }
+
4050 memory_file& operator >>(_Out_ uint32_t & data) { return read_data(data); }
+
4051 memory_file& operator <<(_In_ const uint64_t data) { return write_data(data); }
+
4052 memory_file& operator >>(_Out_ uint64_t & data) { return read_data(data); }
+
4053 memory_file& operator <<(_In_ const float data) { return write_data(data); }
+
4054 memory_file& operator >>(_Out_ float& data) { return read_data(data); }
+
4055 memory_file& operator <<(_In_ const double data) { return write_data(data); }
+
4056 memory_file& operator >>(_Out_ double& data) { return read_data(data); }
+
4057 memory_file& operator <<(_In_ const char data) { return write_data(data); }
+
4058 memory_file& operator >>(_Out_ char& data) { return read_data(data); }
+
4059#ifdef _NATIVE_WCHAR_T_DEFINED
+
4060 memory_file& operator <<(_In_ const wchar_t data) { return write_data(data); }
+
4061 memory_file& operator >>(_Out_ wchar_t& data) { return read_data(data); }
+
4062#endif
+
4063 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
+
4064 memory_file& operator >>(_Out_ std::basic_string<T, TR, AX>&data) { return read_str(data); }
+
4065 template <class T>
+
4066 memory_file& operator <<(_In_ const T * data) { return write_str(data); }
+
4067 template<class T, class TR = std::char_traits<T>, class AX = std::allocator<T>>
+
4068 memory_file& operator <<(_In_ const std::basic_string<T, TR, AX>& data) { return write_str(data); }
+
4069
+
4070 protected:
+
4071 uint8_t* m_data;
+ +
4073 size_t m_offset;
+
4074 size_t m_size;
+
4075 size_t m_reserved;
+
4076#if SET_FILE_OP_TIMES
+
4077 time_point
+
4078 m_ctime,
+
4079 m_atime,
+
4080 m_mtime;
+
4081#endif
+
4082 };
-
4082
-
-
4086 class fifo : public basic {
-
4087 public:
-
4088 fifo() :
-
4089 m_offset(0),
-
4090 m_size(0),
-
4091 m_head(nullptr),
-
4092 m_tail(nullptr)
-
4093 {}
-
4094
-
4095 virtual ~fifo()
-
4096 {
-
4097 while (m_head) {
-
4098 auto p = m_head;
-
4099 m_head = p->next;
-
4100 delete p;
-
4101 }
-
4102 }
-
4103
-
4104#pragma warning(suppress: 6101) // See [2] below
-
-
4105 virtual _Success_(return != 0 || length == 0) size_t read(
-
4106 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
4107 {
-
4108 _Assume_(data || !length);
-
4109 for (size_t to_read = length;;) {
-
4110 if (!m_head) _Unlikely_ {
-
4111 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
-
4112 return length - to_read; // [2] Code analysis misses `length - to_read` bytes were written to data in previous loop iterations.
-
4113 }
-
4114 size_t remaining = m_head->size - m_offset;
-
4115 if (remaining > to_read) {
-
4116 memcpy(data, m_head->data + m_offset, to_read);
-
4117 m_offset += to_read;
-
4118 m_size -= to_read;
-
4119 m_state = state_t::ok;
-
4120 return length;
-
4121 }
-
4122 memcpy(data, m_head->data + m_offset, remaining);
-
4123 m_offset = 0;
-
4124 m_size -= remaining;
-
4125 reinterpret_cast<uint8_t*&>(data) += remaining;
-
4126 to_read -= remaining;
-
4127 auto p = m_head;
-
4128 m_head = p->next;
-
4129 delete p;
-
4130 }
-
4131 }
+
4083
+
+
4087 class fifo : public basic {
+
4088 public:
+
4089 fifo() :
+
4090 m_offset(0),
+
4091 m_size(0),
+
4092 m_head(nullptr),
+
4093 m_tail(nullptr)
+
4094 {}
+
4095
+
4096 virtual ~fifo()
+
4097 {
+
4098 while (m_head) {
+
4099 auto p = m_head;
+
4100 m_head = p->next;
+
4101 delete p;
+
4102 }
+
4103 }
+
4104
+
4105#pragma warning(suppress: 6101) // See [2] below
+
+
4106 virtual _Success_(return != 0 || length == 0) size_t read(
+
4107 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
4108 {
+
4109 _Assume_(data || !length);
+
4110 for (size_t to_read = length;;) {
+
4111 if (!m_head) _Unlikely_ {
+
4112 m_state = to_read < length || !length ? state_t::ok : state_t::eof;
+
4113 return length - to_read; // [2] Code analysis misses `length - to_read` bytes were written to data in previous loop iterations.
+
4114 }
+
4115 size_t remaining = m_head->size - m_offset;
+
4116 if (remaining > to_read) {
+
4117 memcpy(data, m_head->data + m_offset, to_read);
+
4118 m_offset += to_read;
+
4119 m_size -= to_read;
+
4120 m_state = state_t::ok;
+
4121 return length;
+
4122 }
+
4123 memcpy(data, m_head->data + m_offset, remaining);
+
4124 m_offset = 0;
+
4125 m_size -= remaining;
+
4126 reinterpret_cast<uint8_t*&>(data) += remaining;
+
4127 to_read -= remaining;
+
4128 auto p = m_head;
+
4129 m_head = p->next;
+
4130 delete p;
+
4131 }
+
4132 }
-
4132
-
-
4133 virtual _Success_(return != 0) size_t write(
-
4134 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
4135 {
-
4136 _Assume_(data || !length);
-
4137 try {
-
4138 std::unique_ptr<node_t> n(reinterpret_cast<node_t*>(new uint8_t[sizeof(node_t) + length]));
-
4139 n->next = nullptr;
-
4140 n->size = length;
-
4141 memcpy(n->data, data, length);
-
4142 m_size += length;
-
4143 if (m_head)
-
4144 m_tail = m_tail->next = n.release();
-
4145 else
-
4146 m_head = m_tail = n.release();
-
4147 m_state = state_t::ok;
-
4148 return length;
-
4149 }
-
4150 catch (const std::bad_alloc&) {
-
4151 m_state = state_t::fail;
-
4152 return 0;
-
4153 }
-
4154 }
+
4133
+
+
4134 virtual _Success_(return != 0) size_t write(
+
4135 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
4136 {
+
4137 _Assume_(data || !length);
+
4138 try {
+
4139 std::unique_ptr<node_t> n(reinterpret_cast<node_t*>(new uint8_t[sizeof(node_t) + length]));
+
4140 n->next = nullptr;
+
4141 n->size = length;
+
4142 memcpy(n->data, data, length);
+
4143 m_size += length;
+
4144 if (m_head)
+
4145 m_tail = m_tail->next = n.release();
+
4146 else
+
4147 m_head = m_tail = n.release();
+
4148 m_state = state_t::ok;
+
4149 return length;
+
4150 }
+
4151 catch (const std::bad_alloc&) {
+
4152 m_state = state_t::fail;
+
4153 return 0;
+
4154 }
+
4155 }
-
4155
-
-
4156 virtual void close()
-
4157 {
-
4158 m_size = m_offset = 0;
-
4159 while (m_head) {
-
4160 auto p = m_head;
-
4161 m_head = p->next;
-
4162 delete p;
-
4163 }
-
4164 m_state = state_t::ok;
-
4165 }
+
4156
+
+
4157 virtual void close()
+
4158 {
+
4159 m_size = m_offset = 0;
+
4160 while (m_head) {
+
4161 auto p = m_head;
+
4162 m_head = p->next;
+
4163 delete p;
+
4164 }
+
4165 m_state = state_t::ok;
+
4166 }
-
4166
-
4170 size_t size() const { return m_size; };
-
4171
-
4172 protected:
-
4173 size_t m_offset, m_size;
-
-
4174 struct node_t {
-
4175 node_t* next;
-
4176 size_t size;
-
4177#pragma warning(suppress:4200)
-
4178 uint8_t data[0];
-
4179 } *m_head, * m_tail;
+
4167
+
4171 size_t size() const { return m_size; };
+
4172
+
4173 protected:
+
4174 size_t m_offset, m_size;
+
+
4175 struct node_t {
+
4176 node_t* next;
+
4177 size_t size;
+
4178#pragma warning(suppress:4200)
+
4179 uint8_t data[0];
+
4180 } *m_head, * m_tail;
-
4180 };
+
4181 };
-
4181
-
-
4185 class diag_file : public basic_file {
-
4186 public:
-
4187 diag_file(_In_count_(num_files) basic_file* const* files, _In_ size_t num_files) :
-
4188 basic(num_files ? files[0]->state() : state_t::fail),
-
4189 m_files(files, files + num_files)
-
4190 {}
-
4191
-
-
4192 virtual _Success_(return != 0 || length == 0) size_t read(
-
4193 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
-
4194 {
-
4195 _Assume_(data || !length);
-
4196 if (m_files.empty()) {
-
4197 m_state = state_t::fail;
-
4198 return 0;
-
4199 }
-
4200 size_t result = m_files[0]->read(data, length);
-
4201 _Assume_(result <= length);
-
4202 m_state = m_files[0]->state();
-
4203 if (length > m_tmp.size())
-
4204 m_tmp.resize(length);
-
4205 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4206 if (m_files[i]->read(m_tmp.data(), length) != result ||
-
4207 memcmp(m_tmp.data(), data, result))
-
4208 throw std::runtime_error("read mismatch");
-
4209 if (m_files[i]->state() != m_state)
-
4210 throw std::runtime_error("state mismatch");
-
4211 }
-
4212 return result;
-
4213 }
+
4182
+
+
4186 class diag_file : public basic_file {
+
4187 public:
+
4188 diag_file(_In_count_(num_files) basic_file* const* files, _In_ size_t num_files) :
+
4189 basic(num_files ? files[0]->state() : state_t::fail),
+
4190 m_files(files, files + num_files)
+
4191 {}
+
4192
+
+
4193 virtual _Success_(return != 0 || length == 0) size_t read(
+
4194 _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
+
4195 {
+
4196 _Assume_(data || !length);
+
4197 if (m_files.empty()) {
+
4198 m_state = state_t::fail;
+
4199 return 0;
+
4200 }
+
4201 size_t result = m_files[0]->read(data, length);
+
4202 _Assume_(result <= length);
+
4203 m_state = m_files[0]->state();
+
4204 if (length > m_tmp.size())
+
4205 m_tmp.resize(length);
+
4206 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4207 if (m_files[i]->read(m_tmp.data(), length) != result ||
+
4208 memcmp(m_tmp.data(), data, result))
+
4209 throw std::runtime_error("read mismatch");
+
4210 if (m_files[i]->state() != m_state)
+
4211 throw std::runtime_error("state mismatch");
+
4212 }
+
4213 return result;
+
4214 }
-
4214
-
-
4215 virtual _Success_(return != 0) size_t write(
-
4216 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
-
4217 {
-
4218 if (m_files.empty()) {
-
4219 m_state = state_t::fail;
-
4220 return 0;
-
4221 }
-
4222 size_t result = m_files[0]->write(data, length);
-
4223 m_state = m_files[0]->state();
-
4224 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4225 if (m_files[i]->write(data, length) != result)
-
4226 throw std::runtime_error("write mismatch");
-
4227 if (m_files[i]->state() != m_state)
-
4228 throw std::runtime_error("state mismatch");
-
4229 }
-
4230 return result;
-
4231 }
+
4215
+
+
4216 virtual _Success_(return != 0) size_t write(
+
4217 _In_reads_bytes_opt_(length) const void* data, _In_ size_t length)
+
4218 {
+
4219 if (m_files.empty()) {
+
4220 m_state = state_t::fail;
+
4221 return 0;
+
4222 }
+
4223 size_t result = m_files[0]->write(data, length);
+
4224 m_state = m_files[0]->state();
+
4225 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4226 if (m_files[i]->write(data, length) != result)
+
4227 throw std::runtime_error("write mismatch");
+
4228 if (m_files[i]->state() != m_state)
+
4229 throw std::runtime_error("state mismatch");
+
4230 }
+
4231 return result;
+
4232 }
-
4232
-
-
4233 virtual void flush()
-
4234 {
-
4235 if (m_files.empty()) {
-
4236 m_state = state_t::ok;
-
4237 return;
-
4238 }
-
4239 m_files[0]->flush();
-
4240 m_state = m_files[0]->state();
-
4241 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4242 m_files[i]->flush();
-
4243 if (m_files[i]->state() != m_state)
-
4244 throw std::runtime_error("state mismatch");
-
4245 }
-
4246 }
+
4233
+
+
4234 virtual void flush()
+
4235 {
+
4236 if (m_files.empty()) {
+
4237 m_state = state_t::ok;
+
4238 return;
+
4239 }
+
4240 m_files[0]->flush();
+
4241 m_state = m_files[0]->state();
+
4242 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4243 m_files[i]->flush();
+
4244 if (m_files[i]->state() != m_state)
+
4245 throw std::runtime_error("state mismatch");
+
4246 }
+
4247 }
-
4247
-
-
4248 virtual void close()
-
4249 {
-
4250 if (m_files.empty()) {
-
4251 m_state = state_t::ok;
-
4252 return;
-
4253 }
-
4254 m_files[0]->close();
-
4255 m_state = m_files[0]->state();
-
4256 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4257 m_files[i]->close();
-
4258 if (m_files[i]->state() != m_state)
-
4259 throw std::runtime_error("state mismatch");
-
4260 }
-
4261 m_tmp.clear();
-
4262 m_tmp.shrink_to_fit();
-
4263 }
+
4248
+
+
4249 virtual void close()
+
4250 {
+
4251 if (m_files.empty()) {
+
4252 m_state = state_t::ok;
+
4253 return;
+
4254 }
+
4255 m_files[0]->close();
+
4256 m_state = m_files[0]->state();
+
4257 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4258 m_files[i]->close();
+
4259 if (m_files[i]->state() != m_state)
+
4260 throw std::runtime_error("state mismatch");
+
4261 }
+
4262 m_tmp.clear();
+
4263 m_tmp.shrink_to_fit();
+
4264 }
-
4264
-
-
4265 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
-
4266 {
-
4267 if (m_files.empty()) {
-
4268 m_state = state_t::fail;
-
4269 return fpos_max;
-
4270 }
-
4271 fpos_t result = m_files[0]->seek(offset, how);
-
4272 m_state = m_files[0]->state();
-
4273 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4274 if (m_files[i]->seek(offset, how) != result)
-
4275 throw std::runtime_error("seek mismatch");
-
4276 if (m_files[i]->state() != m_state)
-
4277 throw std::runtime_error("state mismatch");
-
4278 }
-
4279 return result;
-
4280 }
+
4265
+
+
4266 virtual fpos_t seek(_In_ foff_t offset, _In_ seek_t how = seek_t::beg)
+
4267 {
+
4268 if (m_files.empty()) {
+
4269 m_state = state_t::fail;
+
4270 return fpos_max;
+
4271 }
+
4272 fpos_t result = m_files[0]->seek(offset, how);
+
4273 m_state = m_files[0]->state();
+
4274 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4275 if (m_files[i]->seek(offset, how) != result)
+
4276 throw std::runtime_error("seek mismatch");
+
4277 if (m_files[i]->state() != m_state)
+
4278 throw std::runtime_error("state mismatch");
+
4279 }
+
4280 return result;
+
4281 }
-
4281
-
-
4282 virtual fpos_t tell() const
-
4283 {
-
4284 if (m_files.empty())
-
4285 return fpos_max;
-
4286 fpos_t result = m_files[0]->tell();
-
4287 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4288 if (m_files[i]->tell() != result)
-
4289 throw std::runtime_error("tell mismatch");
-
4290 }
-
4291 return result;
-
4292 }
+
4282
+
+
4283 virtual fpos_t tell() const
+
4284 {
+
4285 if (m_files.empty())
+
4286 return fpos_max;
+
4287 fpos_t result = m_files[0]->tell();
+
4288 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4289 if (m_files[i]->tell() != result)
+
4290 throw std::runtime_error("tell mismatch");
+
4291 }
+
4292 return result;
+
4293 }
-
4293
-
-
4294 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
-
4295 {
-
4296 if (m_files.empty())
-
4297 m_state = state_t::fail;
-
4298 m_files[0]->lock(offset, length);
-
4299 m_state = m_files[0]->state();
-
4300 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4301 m_files[i]->lock(offset, length);
-
4302 if (m_files[i]->state() != m_state)
-
4303 throw std::runtime_error("state mismatch");
-
4304 }
-
4305 }
+
4294
+
+
4295 virtual void lock(_In_ fpos_t offset, _In_ fsize_t length)
+
4296 {
+
4297 if (m_files.empty())
+
4298 m_state = state_t::fail;
+
4299 m_files[0]->lock(offset, length);
+
4300 m_state = m_files[0]->state();
+
4301 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4302 m_files[i]->lock(offset, length);
+
4303 if (m_files[i]->state() != m_state)
+
4304 throw std::runtime_error("state mismatch");
+
4305 }
+
4306 }
-
4306
-
-
4307 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
-
4308 {
-
4309 if (m_files.empty())
-
4310 m_state = state_t::fail;
-
4311 m_files[0]->unlock(offset, length);
-
4312 m_state = m_files[0]->state();
-
4313 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4314 m_files[i]->unlock(offset, length);
-
4315 if (m_files[i]->state() != m_state)
-
4316 throw std::runtime_error("state mismatch");
-
4317 }
-
4318 }
+
4307
+
+
4308 virtual void unlock(_In_ fpos_t offset, _In_ fsize_t length)
+
4309 {
+
4310 if (m_files.empty())
+
4311 m_state = state_t::fail;
+
4312 m_files[0]->unlock(offset, length);
+
4313 m_state = m_files[0]->state();
+
4314 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4315 m_files[i]->unlock(offset, length);
+
4316 if (m_files[i]->state() != m_state)
+
4317 throw std::runtime_error("state mismatch");
+
4318 }
+
4319 }
-
4319
-
-
4320 virtual fsize_t size() const
-
4321 {
-
4322 if (m_files.empty())
-
4323 return fsize_max;
-
4324 fsize_t result = m_files[0]->size();
-
4325 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4326 if (m_files[i]->size() != result)
-
4327 throw std::runtime_error("size mismatch");
-
4328 }
-
4329 return result;
-
4330 }
+
4320
+
+
4321 virtual fsize_t size() const
+
4322 {
+
4323 if (m_files.empty())
+
4324 return fsize_max;
+
4325 fsize_t result = m_files[0]->size();
+
4326 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4327 if (m_files[i]->size() != result)
+
4328 throw std::runtime_error("size mismatch");
+
4329 }
+
4330 return result;
+
4331 }
-
4331
-
-
4332 virtual void truncate()
-
4333 {
-
4334 if (m_files.empty())
-
4335 m_state = state_t::fail;
-
4336 m_files[0]->truncate();
-
4337 m_state = m_files[0]->state();
-
4338 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
-
4339 m_files[i]->truncate();
-
4340 if (m_files[i]->state() != m_state)
-
4341 throw std::runtime_error("state mismatch");
-
4342 }
-
4343 }
+
4332
+
+
4333 virtual void truncate()
+
4334 {
+
4335 if (m_files.empty())
+
4336 m_state = state_t::fail;
+
4337 m_files[0]->truncate();
+
4338 m_state = m_files[0]->state();
+
4339 for (size_t i = 1, n = m_files.size(); i < n; ++i) {
+
4340 m_files[i]->truncate();
+
4341 if (m_files[i]->state() != m_state)
+
4342 throw std::runtime_error("state mismatch");
+
4343 }
+
4344 }
-
4344
-
4345 protected:
-
4346 std::vector<basic_file*> m_files;
-
4347 std::vector<uint8_t> m_tmp;
-
4348 };
+
4345
+
4346 protected:
+
4347 std::vector<basic_file*> m_files;
+
4348 std::vector<uint8_t> m_tmp;
+
4349 };
-
4349 }
-
4350}
-
4351
-
4352#if defined(__GNUC__)
-
4353#pragma GCC diagnostic pop
-
4354#endif
-
Encoding converter context.
Definition unicode.hpp:137
-
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:69
+
4350 }
+
4351}
+
4352
+
4353#if defined(__GNUC__)
+
4354#pragma GCC diagnostic pop
+
4355#endif
+
Encoding converter context.
Definition unicode.hpp:138
+
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:74
Provides read-ahead stream capability.
Definition stream.hpp:1256
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:1270
Provides write-back stream capability.
Definition stream.hpp:1323
@@ -4252,32 +4253,32 @@ $(function() { codefold.init(0); });
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:2036
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:2109
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:2010
-
Cached file-system file.
Definition stream.hpp:3136
-
void open(const std::basic_string< TR, AX > &filename, int mode)
Opens file.
Definition stream.hpp:3202
-
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:3180
-
cached_file(const schar_t *filename, int mode, size_t cache_size=default_cache_size)
Opens file.
Definition stream.hpp:3152
-
cached_file(const std::basic_string< TR, AX > &filename, int mode, size_t cache_size=default_cache_size)
Opens file.
Definition stream.hpp:3167
+
Cached file-system file.
Definition stream.hpp:3137
+
void open(const std::basic_string< TR, AX > &filename, int mode)
Opens file.
Definition stream.hpp:3203
+
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:3181
+
cached_file(const schar_t *filename, int mode, size_t cache_size=default_cache_size)
Opens file.
Definition stream.hpp:3153
+
cached_file(const std::basic_string< TR, AX > &filename, int mode, size_t cache_size=default_cache_size)
Opens file.
Definition stream.hpp:3168
Modifies data on the fly when reading from/writing to a source stream. Could also be used to modify r...
Definition stream.hpp:1022
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1073
virtual void close()
Closes the stream.
Definition stream.hpp:1067
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:1051
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:1059
-
Compares multiple files to perform the same.
Definition stream.hpp:4185
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:4332
-
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:4215
-
virtual void close()
Closes the stream.
Definition stream.hpp:4248
-
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:4320
-
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:4294
-
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:4307
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:4265
-
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:4282
-
virtual void flush()
Persists volatile element data.
Definition stream.hpp:4233
-
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:4192
-
In-memory FIFO queue.
Definition stream.hpp:4086
-
virtual void close()
Closes the stream.
Definition stream.hpp:4156
-
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:4133
-
size_t size() const
Returns total size of pending data in the queue.
Definition stream.hpp:4170
-
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:4105
+
Compares multiple files to perform the same.
Definition stream.hpp:4186
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:4333
+
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:4216
+
virtual void close()
Closes the stream.
Definition stream.hpp:4249
+
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:4321
+
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:4295
+
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:4308
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:4266
+
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:4283
+
virtual void flush()
Persists volatile element data.
Definition stream.hpp:4234
+
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:4193
+
In-memory FIFO queue.
Definition stream.hpp:4087
+
virtual void close()
Closes the stream.
Definition stream.hpp:4157
+
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:4134
+
size_t size() const
Returns total size of pending data in the queue.
Definition stream.hpp:4171
+
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:4106
Limits file reading/writing to a predefined window.
Definition stream.hpp:1694
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:1787
virtual void flush()
Persists volatile element data.
Definition stream.hpp:1737
@@ -4292,17 +4293,17 @@ $(function() { codefold.init(0); });
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:1782
File-system file.
Definition stream.hpp:2718
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:2922
-
static bool readonly(const std::basic_string< TR, AX > &filename)
Checks if file/folder/symlink is read-only.
Definition stream.hpp:3125
+
static bool readonly(const std::basic_string< TR, AX > &filename)
Checks if file/folder/symlink is read-only.
Definition stream.hpp:3126
virtual time_point mtime() const
Returns file modification time.
Definition stream.hpp:3006
virtual void unlock(fpos_t offset, fsize_t length)
Unlocks file section for exclusive access.
Definition stream.hpp:2893
file(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2728
virtual void set_ctime(time_point date)
Sets file create time.
Definition stream.hpp:3020
-
static bool readonly(const stdex::schar_t *filename)
Checks if file/folder/symlink is read-only.
Definition stream.hpp:3106
+
static bool readonly(const stdex::schar_t *filename)
Checks if file/folder/symlink is read-only.
Definition stream.hpp:3107
virtual time_point atime() const
Returns file access time.
Definition stream.hpp:2992
-
static bool exists(const std::basic_string< TR, AX > &filename)
Checks if file/folder/symlink likely exists.
Definition stream.hpp:3094
+
static bool exists(const std::basic_string< TR, AX > &filename)
Checks if file/folder/symlink likely exists.
Definition stream.hpp:3095
void open(const schar_t *filename, int mode)
Opens file.
Definition stream.hpp:2748
-
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:3054
-
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:3034
+
virtual void set_mtime(time_point date)
Sets file modification time.
Definition stream.hpp:3055
+
virtual void set_atime(time_point date)
Sets file access time.
Definition stream.hpp:3035
virtual void lock(fpos_t offset, fsize_t length)
Locks file section for exclusive access.
Definition stream.hpp:2866
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:2942
void open(const std::basic_string< TR, AX > &filename, int mode)
Opens file.
Definition stream.hpp:2822
@@ -4310,49 +4311,49 @@ $(function() { codefold.init(0); });
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:2827
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:2848
file(const std::basic_string< TR, AX > &filename, int mode)
Opens file.
Definition stream.hpp:2740
-
static bool exists(const stdex::schar_t *filename)
Checks if file/folder/symlink likely exists.
Definition stream.hpp:3078
+
static bool exists(const stdex::schar_t *filename)
Checks if file/folder/symlink likely exists.
Definition stream.hpp:3079
Limits reading from/writing to stream to a predefined number of bytes.
Definition stream.hpp:1551
fsize_t read_limit
Number of bytes left that may be read from the stream.
Definition stream.hpp:1603
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:1559
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:1580
fsize_t write_limit
Number of bytes left, that can be written to the stream.
Definition stream.hpp:1604
-
In-memory file.
Definition stream.hpp:3220
-
void save(const std::basic_string< TR, AX > &filename, int mode)
Saves content to a file-system file.
Definition stream.hpp:3542
-
memory_file & operator=(memory_file &&other) noexcept
Moves content from another file.
Definition stream.hpp:3403
-
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3922
-
memory_file(const schar_t *filename, int mode)
Loads content from file-system file.
Definition stream.hpp:3300
-
memory_file & read_str(std::basic_string< T, TR, AX > &data)
Reads length-prefixed string from the stream.
Definition stream.hpp:3631
-
memory_file(const memory_file &other)
Copies content from another file.
Definition stream.hpp:3319
-
memory_file & write_str(const std::basic_string< T, TR, AX > &data)
Writes string to the stream length-prefixed.
Definition stream.hpp:3802
-
void load(const std::basic_string< TR, AX > &filename, int mode)
Loads content from a file-system file.
Definition stream.hpp:3504
-
size_t m_size
file size
Definition stream.hpp:4073
-
void get(fpos_t offset, T &data)
Reads data from specified file location This does not move file pointer. It checks for data size Assu...
Definition stream.hpp:4011
-
size_t write_stream(basic &stream, size_t amount=SIZE_MAX)
Writes content of another stream.
Definition stream.hpp:3837
-
uint8_t * m_data
file data
Definition stream.hpp:4070
-
memory_file & read_data(T &data)
Reads one primitive data type.
Definition stream.hpp:3591
-
virtual void close()
Closes the stream.
Definition stream.hpp:3887
-
memory_file(const std::basic_string< TR, AX > &filename, int mode)
Loads content from file-system file.
Definition stream.hpp:3312
-
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:3552
-
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:3917
-
size_t m_reserved
reserved file size
Definition stream.hpp:4074
-
memory_file(size_t size, state_t state=state_t::ok)
Creates an empty file of reserved size.
Definition stream.hpp:3241
-
void reserve(size_t required, bool tight=false) noexcept
Reallocates memory.
Definition stream.hpp:3441
-
memory_file(memory_file &&other) noexcept
Moves content from another file.
Definition stream.hpp:3374
-
void write_byte(uint8_t byte, size_t amount=1)
Writes a byte of data.
Definition stream.hpp:3686
-
memory_file & operator=(const memory_file &other)
Copies content from another file.
Definition stream.hpp:3344
-
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:3977
-
size_t m_offset
file pointer
Definition stream.hpp:4072
-
void save(const schar_t *filename, int mode)
Saves content to a file-system file.
Definition stream.hpp:3515
-
void load(const schar_t *filename, int mode)
Loads content from a file-system file.
Definition stream.hpp:3470
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3901
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3927
-
memory_file & write_data(const T data)
Writes one primitive data type.
Definition stream.hpp:3719
-
memory_file & write_str(const T *data)
Writes string to the stream length-prefixed.
Definition stream.hpp:3757
-
bool m_manage
may reallocate m_data?
Definition stream.hpp:4071
-
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:3290
-
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:3662
-
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:3267
-
const void * data() const
Returns pointer to data.
Definition stream.hpp:3550
+
In-memory file.
Definition stream.hpp:3221
+
void save(const std::basic_string< TR, AX > &filename, int mode)
Saves content to a file-system file.
Definition stream.hpp:3543
+
memory_file & operator=(memory_file &&other) noexcept
Moves content from another file.
Definition stream.hpp:3404
+
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3923
+
memory_file(const schar_t *filename, int mode)
Loads content from file-system file.
Definition stream.hpp:3301
+
memory_file & read_str(std::basic_string< T, TR, AX > &data)
Reads length-prefixed string from the stream.
Definition stream.hpp:3632
+
memory_file(const memory_file &other)
Copies content from another file.
Definition stream.hpp:3320
+
memory_file & write_str(const std::basic_string< T, TR, AX > &data)
Writes string to the stream length-prefixed.
Definition stream.hpp:3803
+
void load(const std::basic_string< TR, AX > &filename, int mode)
Loads content from a file-system file.
Definition stream.hpp:3505
+
size_t m_size
file size
Definition stream.hpp:4074
+
void get(fpos_t offset, T &data)
Reads data from specified file location This does not move file pointer. It checks for data size Assu...
Definition stream.hpp:4012
+
size_t write_stream(basic &stream, size_t amount=SIZE_MAX)
Writes content of another stream.
Definition stream.hpp:3838
+
uint8_t * m_data
file data
Definition stream.hpp:4071
+
memory_file & read_data(T &data)
Reads one primitive data type.
Definition stream.hpp:3592
+
virtual void close()
Closes the stream.
Definition stream.hpp:3888
+
memory_file(const std::basic_string< TR, AX > &filename, int mode)
Loads content from file-system file.
Definition stream.hpp:3313
+
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:3553
+
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:3918
+
size_t m_reserved
reserved file size
Definition stream.hpp:4075
+
memory_file(size_t size, state_t state=state_t::ok)
Creates an empty file of reserved size.
Definition stream.hpp:3242
+
void reserve(size_t required, bool tight=false) noexcept
Reallocates memory.
Definition stream.hpp:3442
+
memory_file(memory_file &&other) noexcept
Moves content from another file.
Definition stream.hpp:3375
+
void write_byte(uint8_t byte, size_t amount=1)
Writes a byte of data.
Definition stream.hpp:3687
+
memory_file & operator=(const memory_file &other)
Copies content from another file.
Definition stream.hpp:3345
+
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:3978
+
size_t m_offset
file pointer
Definition stream.hpp:4073
+
void save(const schar_t *filename, int mode)
Saves content to a file-system file.
Definition stream.hpp:3516
+
void load(const schar_t *filename, int mode)
Loads content from a file-system file.
Definition stream.hpp:3471
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3902
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3928
+
memory_file & write_data(const T data)
Writes one primitive data type.
Definition stream.hpp:3720
+
memory_file & write_str(const T *data)
Writes string to the stream length-prefixed.
Definition stream.hpp:3758
+
bool m_manage
may reallocate m_data?
Definition stream.hpp:4072
+
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:3291
+
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:3663
+
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:3268
+
const void * data() const
Returns pointer to data.
Definition stream.hpp:3551
Definition stream.hpp:1170
enum stdex::stream::replicator::worker::op_t op
Operation to perform.
size_t num_written
Number of bytes written.
Definition stream.hpp:1219
@@ -4383,11 +4384,11 @@ $(function() { codefold.init(0); });
T end
interval end
Definition interval.hpp:20
T start
interval start
Definition interval.hpp:19
Definition stream.hpp:1528
-
Definition stream.hpp:4174
+
Definition stream.hpp:4175
diff --git a/string_8hpp_source.html b/string_8hpp_source.html index 99a46e884..af6b962c1 100644 --- a/string_8hpp_source.html +++ b/string_8hpp_source.html @@ -145,8 +145,8 @@ $(function() { codefold.init(0); });
87 {
88 _Assume_(chr >= 0x10000);
89 chr -= 0x10000;
-
90 str[0] = 0xd800 + static_cast<utf32_t>((chr >> 10) & 0x3ff);
-
91 str[1] = 0xdc00 + static_cast<utf32_t>(chr & 0x3ff);
+
90 str[0] = 0xd800 + static_cast<utf16_t>((chr >> 10) & 0x3ff);
+
91 str[1] = 0xdc00 + static_cast<utf16_t>(chr & 0x3ff);
92 }
93
99 inline bool iscombining(_In_ utf32_t chr)
@@ -2005,7 +2005,7 @@ $(function() { codefold.init(0); });
diff --git a/structstdex_1_1chrono_1_1aosn__date-members.html b/structstdex_1_1chrono_1_1aosn__date-members.html index 921e30dbe..b2bbf5954 100644 --- a/structstdex_1_1chrono_1_1aosn__date-members.html +++ b/structstdex_1_1chrono_1_1aosn__date-members.html @@ -98,7 +98,7 @@ $(function() {
diff --git a/structstdex_1_1chrono_1_1aosn__date.html b/structstdex_1_1chrono_1_1aosn__date.html index 948200fcc..24a43b6bf 100644 --- a/structstdex_1_1chrono_1_1aosn__date.html +++ b/structstdex_1_1chrono_1_1aosn__date.html @@ -154,7 +154,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 5984abf20..c983e3283 100644 --- a/structstdex_1_1chrono_1_1aosn__timestamp-members.html +++ b/structstdex_1_1chrono_1_1aosn__timestamp-members.html @@ -112,7 +112,7 @@ $(function() {
diff --git a/structstdex_1_1chrono_1_1aosn__timestamp.html b/structstdex_1_1chrono_1_1aosn__timestamp.html index 9d0fb8c25..d2327da40 100644 --- a/structstdex_1_1chrono_1_1aosn__timestamp.html +++ b/structstdex_1_1chrono_1_1aosn__timestamp.html @@ -199,7 +199,7 @@ static constexpr rep one_w
diff --git a/structstdex_1_1free__locale__delete-members.html b/structstdex_1_1free__locale__delete-members.html index cff2dc577..28e3342f3 100644 --- a/structstdex_1_1free__locale__delete-members.html +++ b/structstdex_1_1free__locale__delete-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structstdex_1_1free__locale__delete.html b/structstdex_1_1free__locale__delete.html index 926b53bd5..587890ebc 100644 --- a/structstdex_1_1free__locale__delete.html +++ b/structstdex_1_1free__locale__delete.html @@ -103,7 +103,7 @@ void operator() (local
diff --git a/structstdex_1_1html_1_1element__traits-members.html b/structstdex_1_1html_1_1element__traits-members.html index 8eebfdaaa..c0670b801 100644 --- a/structstdex_1_1html_1_1element__traits-members.html +++ b/structstdex_1_1html_1_1element__traits-members.html @@ -104,7 +104,7 @@ $(function() {
diff --git a/structstdex_1_1html_1_1element__traits.html b/structstdex_1_1html_1_1element__traits.html index 826542015..28a550ad7 100644 --- a/structstdex_1_1html_1_1element__traits.html +++ b/structstdex_1_1html_1_1element__traits.html @@ -818,7 +818,7 @@ template<class T >
diff --git a/structstdex_1_1html_1_1entity-members.html b/structstdex_1_1html_1_1entity-members.html index 9b579770e..b83104c8e 100644 --- a/structstdex_1_1html_1_1entity-members.html +++ b/structstdex_1_1html_1_1entity-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structstdex_1_1html_1_1entity.html b/structstdex_1_1html_1_1entity.html index f5eff256d..6a80fc15f 100644 --- a/structstdex_1_1html_1_1entity.html +++ b/structstdex_1_1html_1_1entity.html @@ -108,7 +108,7 @@ struct stdex::html::entity< T, TR, AX >

HTML entity.

diff --git a/structstdex_1_1html_1_1inserted__token-members.html b/structstdex_1_1html_1_1inserted__token-members.html index 7eb8e550d..62a23b736 100644 --- a/structstdex_1_1html_1_1inserted__token-members.html +++ b/structstdex_1_1html_1_1inserted__token-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structstdex_1_1html_1_1inserted__token.html b/structstdex_1_1html_1_1inserted__token.html index 881af2bf2..e1aa66577 100644 --- a/structstdex_1_1html_1_1inserted__token.html +++ b/structstdex_1_1html_1_1inserted__token.html @@ -115,7 +115,7 @@ bool after_word diff --git a/structstdex_1_1interval-members.html b/structstdex_1_1interval-members.html index 9ab67adf8..84d54cb61 100644 --- a/structstdex_1_1interval-members.html +++ b/structstdex_1_1interval-members.html @@ -107,7 +107,7 @@ $(function() {
diff --git a/structstdex_1_1interval.html b/structstdex_1_1interval.html index 028b35d59..e7a8261dc 100644 --- a/structstdex_1_1interval.html +++ b/structstdex_1_1interval.html @@ -785,7 +785,7 @@ template<class T >
diff --git a/structstdex_1_1mapping-members.html b/structstdex_1_1mapping-members.html index df794836a..041d75ec4 100644 --- a/structstdex_1_1mapping-members.html +++ b/structstdex_1_1mapping-members.html @@ -93,7 +93,7 @@ $(function() {
diff --git a/structstdex_1_1mapping.html b/structstdex_1_1mapping.html index fe37ffc66..8a388d039 100644 --- a/structstdex_1_1mapping.html +++ b/structstdex_1_1mapping.html @@ -314,7 +314,7 @@ template<class T >
diff --git a/structstdex_1_1no__delete-members.html b/structstdex_1_1no__delete-members.html index 411d6d4a4..e1bf5a835 100644 --- a/structstdex_1_1no__delete-members.html +++ b/structstdex_1_1no__delete-members.html @@ -88,7 +88,7 @@ $(function() {
diff --git a/structstdex_1_1no__delete.html b/structstdex_1_1no__delete.html index ea066c160..d605dbb51 100644 --- a/structstdex_1_1no__delete.html +++ b/structstdex_1_1no__delete.html @@ -107,7 +107,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 0369fb13f..c7c577225 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 @@ -88,7 +88,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 a3644b616..7b3228d75 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 @@ -108,7 +108,7 @@ struct stdex::no_delete< T[]>

Noop array deleter.

diff --git a/structstdex_1_1parser_1_1html__attribute-members.html b/structstdex_1_1parser_1_1html__attribute-members.html index 75929ec1b..f06a6c7b5 100644 --- a/structstdex_1_1parser_1_1html__attribute-members.html +++ b/structstdex_1_1parser_1_1html__attribute-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structstdex_1_1parser_1_1html__attribute.html b/structstdex_1_1parser_1_1html__attribute.html index c4abd73ec..ef638194c 100644 --- a/structstdex_1_1parser_1_1html__attribute.html +++ b/structstdex_1_1parser_1_1html__attribute.html @@ -107,7 +107,7 @@ Public Attributes
diff --git a/structstdex_1_1parser_1_1http__factor__more-members.html b/structstdex_1_1parser_1_1http__factor__more-members.html index 2413fe3dd..43714f37f 100644 --- a/structstdex_1_1parser_1_1http__factor__more-members.html +++ b/structstdex_1_1parser_1_1http__factor__more-members.html @@ -86,7 +86,7 @@ $(function() {
diff --git a/structstdex_1_1parser_1_1http__factor__more.html b/structstdex_1_1parser_1_1http__factor__more.html index c87ed85cb..467dad871 100644 --- a/structstdex_1_1parser_1_1http__factor__more.html +++ b/structstdex_1_1parser_1_1http__factor__more.html @@ -95,7 +95,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 1cc666cdf..e4b8c77e0 100644 --- a/structstdex_1_1stream_1_1buffer_1_1buffer__t-members.html +++ b/structstdex_1_1stream_1_1buffer_1_1buffer__t-members.html @@ -91,7 +91,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 bcba3b54a..657b39e9b 100644 --- a/structstdex_1_1stream_1_1buffer_1_1buffer__t.html +++ b/structstdex_1_1stream_1_1buffer_1_1buffer__t.html @@ -111,7 +111,7 @@ size_t capacity 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 ed5963990..f22b1ab4a 100644 --- a/structstdex_1_1stream_1_1fifo_1_1node__t-members.html +++ b/structstdex_1_1stream_1_1fifo_1_1node__t-members.html @@ -88,7 +88,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 4b6cdb589..8cdf36a7c 100644 --- a/structstdex_1_1stream_1_1fifo_1_1node__t.html +++ b/structstdex_1_1stream_1_1fifo_1_1node__t.html @@ -101,7 +101,7 @@ uint8_t data [0]<
diff --git a/structstdex_1_1sys__info__t-members.html b/structstdex_1_1sys__info__t-members.html index 43a6b61cd..3b05fc13b 100644 --- a/structstdex_1_1sys__info__t-members.html +++ b/structstdex_1_1sys__info__t-members.html @@ -92,7 +92,7 @@ $(function() {
diff --git a/structstdex_1_1sys__info__t.html b/structstdex_1_1sys__info__t.html index 8c101bf8e..a2ec4a8ba 100644 --- a/structstdex_1_1sys__info__t.html +++ b/structstdex_1_1sys__info__t.html @@ -147,7 +147,7 @@ struct utsname m_utsn<
diff --git a/structstdex_1_1wav_1_1cue-members.html b/structstdex_1_1wav_1_1cue-members.html index 22938b692..75a1cf2e8 100644 --- a/structstdex_1_1wav_1_1cue-members.html +++ b/structstdex_1_1wav_1_1cue-members.html @@ -91,7 +91,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1cue.html b/structstdex_1_1wav_1_1cue.html index 9d4f4a8da..9f0d5628d 100644 --- a/structstdex_1_1wav_1_1cue.html +++ b/structstdex_1_1wav_1_1cue.html @@ -132,7 +132,7 @@ uint32_t block_offset
diff --git a/structstdex_1_1wav_1_1cue__ex-members.html b/structstdex_1_1wav_1_1cue__ex-members.html index 9cb613df9..a9fd621dd 100644 --- a/structstdex_1_1wav_1_1cue__ex-members.html +++ b/structstdex_1_1wav_1_1cue__ex-members.html @@ -100,7 +100,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1cue__ex.html b/structstdex_1_1wav_1_1cue__ex.html index 98415793e..6dbd1050e 100644 --- a/structstdex_1_1wav_1_1cue__ex.html +++ b/structstdex_1_1wav_1_1cue__ex.html @@ -169,7 +169,7 @@ uint32_t block_offset
diff --git a/structstdex_1_1wav_1_1data-members.html b/structstdex_1_1wav_1_1data-members.html index 4dd38cc23..f88d61997 100644 --- a/structstdex_1_1wav_1_1data-members.html +++ b/structstdex_1_1wav_1_1data-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1data.html b/structstdex_1_1wav_1_1data.html index 0ec58de72..c7223f08a 100644 --- a/structstdex_1_1wav_1_1data.html +++ b/structstdex_1_1wav_1_1data.html @@ -120,7 +120,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1format-members.html b/structstdex_1_1wav_1_1format-members.html index d88883cf2..263d0e8f9 100644 --- a/structstdex_1_1wav_1_1format-members.html +++ b/structstdex_1_1wav_1_1format-members.html @@ -96,7 +96,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1format.html b/structstdex_1_1wav_1_1format.html index 491db2658..c946640cf 100644 --- a/structstdex_1_1wav_1_1format.html +++ b/structstdex_1_1wav_1_1format.html @@ -211,7 +211,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1header-members.html b/structstdex_1_1wav_1_1header-members.html index 593d61b35..417f93754 100644 --- a/structstdex_1_1wav_1_1header-members.html +++ b/structstdex_1_1wav_1_1header-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1header.html b/structstdex_1_1wav_1_1header.html index cbf4708d3..b7456c776 100644 --- a/structstdex_1_1wav_1_1header.html +++ b/structstdex_1_1wav_1_1header.html @@ -130,7 +130,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1label-members.html b/structstdex_1_1wav_1_1label-members.html index ced6130e3..5f693cf8c 100644 --- a/structstdex_1_1wav_1_1label-members.html +++ b/structstdex_1_1wav_1_1label-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1label.html b/structstdex_1_1wav_1_1label.html index bbb4a3e08..59c335e1c 100644 --- a/structstdex_1_1wav_1_1label.html +++ b/structstdex_1_1wav_1_1label.html @@ -124,7 +124,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1list-members.html b/structstdex_1_1wav_1_1list-members.html index 145dd10c6..62834b7fa 100644 --- a/structstdex_1_1wav_1_1list-members.html +++ b/structstdex_1_1wav_1_1list-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1list.html b/structstdex_1_1wav_1_1list.html index 1f542bb95..2c49bc5ef 100644 --- a/structstdex_1_1wav_1_1list.html +++ b/structstdex_1_1wav_1_1list.html @@ -123,7 +123,7 @@ id_t type = 0 diff --git a/structstdex_1_1wav_1_1ltxt-members.html b/structstdex_1_1wav_1_1ltxt-members.html index af5688587..3ecc210b5 100644 --- a/structstdex_1_1wav_1_1ltxt-members.html +++ b/structstdex_1_1wav_1_1ltxt-members.html @@ -96,7 +96,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1ltxt.html b/structstdex_1_1wav_1_1ltxt.html index 38899351a..011253fe8 100644 --- a/structstdex_1_1wav_1_1ltxt.html +++ b/structstdex_1_1wav_1_1ltxt.html @@ -148,7 +148,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1note-members.html b/structstdex_1_1wav_1_1note-members.html index 1222efc98..706e70e59 100644 --- a/structstdex_1_1wav_1_1note-members.html +++ b/structstdex_1_1wav_1_1note-members.html @@ -90,7 +90,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1note.html b/structstdex_1_1wav_1_1note.html index 11182051c..d83e78f38 100644 --- a/structstdex_1_1wav_1_1note.html +++ b/structstdex_1_1wav_1_1note.html @@ -124,7 +124,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1silence-members.html b/structstdex_1_1wav_1_1silence-members.html index a72fe5e26..91a77852b 100644 --- a/structstdex_1_1wav_1_1silence-members.html +++ b/structstdex_1_1wav_1_1silence-members.html @@ -89,7 +89,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1silence.html b/structstdex_1_1wav_1_1silence.html index 2f7cca92e..391ca3ff2 100644 --- a/structstdex_1_1wav_1_1silence.html +++ b/structstdex_1_1wav_1_1silence.html @@ -120,7 +120,7 @@ Friends
diff --git a/structstdex_1_1wav_1_1wave-members.html b/structstdex_1_1wav_1_1wave-members.html index ed0fa63bd..5107b2585 100644 --- a/structstdex_1_1wav_1_1wave-members.html +++ b/structstdex_1_1wav_1_1wave-members.html @@ -87,7 +87,7 @@ $(function() {
diff --git a/structstdex_1_1wav_1_1wave.html b/structstdex_1_1wav_1_1wave.html index d2e857353..c06042020 100644 --- a/structstdex_1_1wav_1_1wave.html +++ b/structstdex_1_1wav_1_1wave.html @@ -123,7 +123,7 @@ id_t type = 0 diff --git a/sys__info_8hpp_source.html b/sys__info_8hpp_source.html index 6121beafe..5b509432a 100644 --- a/sys__info_8hpp_source.html +++ b/sys__info_8hpp_source.html @@ -102,210 +102,219 @@ $(function() { codefold.init(0); });
16#endif
17#include <memory>
18
-
19namespace stdex
-
20{
-
24 enum class platform_id : uint16_t {
-
25#ifdef _WIN32
-
26 unknown = IMAGE_FILE_MACHINE_UNKNOWN,
-
27 i386 = IMAGE_FILE_MACHINE_I386,
-
28 x86_64 = IMAGE_FILE_MACHINE_AMD64,
-
29 arm = IMAGE_FILE_MACHINE_ARMNT,
-
30 aarch64 = IMAGE_FILE_MACHINE_ARM64,
-
31#else
-
32 unknown = 0,
-
33 i386 = 0x014c,
-
34 x86_64 = 0x8664,
-
35 arm = 0x01c4,
-
36 aarch64 = 0xaa64,
-
37#endif
-
38 };
-
39
-
47 inline platform_id platform_from_name(_In_z_ const char* name)
-
48 {
-
49 struct platform_less {
-
50 bool operator()(_In_z_ const char* a, _In_z_ const char* b) const
-
51 {
-
52 return stricmp(a, b) < 0;
-
53 }
-
54 };
-
55 static const std::map<const char*, platform_id, platform_less> platforms = {
-
56 { "aarch64", platform_id::aarch64 },
-
57 { "arm", platform_id::arm },
-
58 { "i386", platform_id::i386 },
-
59 { "x86_64", platform_id::x86_64 },
-
60 };
-
61 if (auto el = platforms.find(name); el != platforms.end())
-
62 return el->second;
-
63 return platform_id::unknown;
-
64 }
-
65
-
-
69 inline const struct sys_info_t
-
70 {
-
74#if _M_IX86 || __i386__
-
75 static constexpr platform_id process_platform = platform_id::i386;
-
76#elif _M_X64 /* _M_ARM64EC is introducing as x64 */ || __x86_64__
-
77 static constexpr platform_id process_platform = platform_id::x86_64;
-
78#elif _M_ARM || __arm__
-
79 static constexpr platform_id process_platform = platform_id::arm;
-
80#elif _M_ARM64 || __aarch64__
-
81 static constexpr platform_id process_platform = platform_id::aarch64;
-
82#else
-
83 #error Unknown platform
-
84#endif
-
85
-
89 platform_id os_platform;
+
19#if defined(__GNUC__)
+
20#pragma GCC diagnostic push
+
21#pragma GCC diagnostic ignored "-Wexit-time-destructors"
+
22#endif
+
23
+
24namespace stdex
+
25{
+
29 enum class platform_id : uint16_t {
+
30#ifdef _WIN32
+
31 unknown = IMAGE_FILE_MACHINE_UNKNOWN,
+
32 i386 = IMAGE_FILE_MACHINE_I386,
+
33 x86_64 = IMAGE_FILE_MACHINE_AMD64,
+
34 arm = IMAGE_FILE_MACHINE_ARMNT,
+
35 aarch64 = IMAGE_FILE_MACHINE_ARM64,
+
36#else
+
37 unknown = 0,
+
38 i386 = 0x014c,
+
39 x86_64 = 0x8664,
+
40 arm = 0x01c4,
+
41 aarch64 = 0xaa64,
+
42#endif
+
43 };
+
44
+
52 inline platform_id platform_from_name(_In_z_ const char* name)
+
53 {
+
54 struct platform_less {
+
55 bool operator()(_In_z_ const char* a, _In_z_ const char* b) const
+
56 {
+
57 return stricmp(a, b) < 0;
+
58 }
+
59 };
+
60 static const std::map<const char*, platform_id, platform_less> platforms = {
+
61 { "aarch64", platform_id::aarch64 },
+
62 { "arm", platform_id::arm },
+
63 { "i386", platform_id::i386 },
+
64 { "x86_64", platform_id::x86_64 },
+
65 };
+
66 if (auto el = platforms.find(name); el != platforms.end())
+
67 return el->second;
+
68 return platform_id::unknown;
+
69 }
+
70
+
+
74 inline const struct sys_info_t
+
75 {
+
79#if _M_IX86 || __i386__
+
80 static constexpr platform_id process_platform = platform_id::i386;
+
81#elif _M_X64 /* _M_ARM64EC is introducing as x64 */ || __x86_64__
+
82 static constexpr platform_id process_platform = platform_id::x86_64;
+
83#elif _M_ARM || __arm__
+
84 static constexpr platform_id process_platform = platform_id::arm;
+
85#elif _M_ARM64 || __aarch64__
+
86 static constexpr platform_id process_platform = platform_id::aarch64;
+
87#else
+
88 #error Unknown platform
+
89#endif
90
-
91#ifdef _WIN32
-
95 bool wow64;
-
96#endif
-
97
- +
94 platform_id os_platform;
+
95
+
96#ifdef _WIN32
+
100 bool wow64;
+
101#endif
102
-
106 bool admin;
+
107
- +
111 bool admin;
112
-
113 sys_info_t() :
-
114 os_platform(platform_id::unknown),
-
115#ifdef _WIN32
-
116 wow64(false),
-
117#endif
- -
119 admin(false),
-
120 elevated(false)
-
121 {
-
122#ifdef _WIN32
-
123 HMODULE kernel32_handle;
-
124 kernel32_handle = LoadLibrary(_T("kernel32.dll"));
-
125 _Assume_(kernel32_handle);
-
126 BOOL(WINAPI * IsWow64Process2)(HANDLE hProcess, USHORT * pProcessMachine, USHORT * pNativeMachine);
-
127 *reinterpret_cast<FARPROC*>(&IsWow64Process2) = GetProcAddress(kernel32_handle, "IsWow64Process2");
-
128 HANDLE process = GetCurrentProcess();
-
129 USHORT process_machine;
-
130#ifndef _WIN64
-
131 BOOL Wow64Process;
-
132#endif
-
133 if (IsWow64Process2 && IsWow64Process2(process, &process_machine, reinterpret_cast<USHORT*>(&os_platform))) {
-
134 wow64 = process_machine != IMAGE_FILE_MACHINE_UNKNOWN;
-
135 }
-
136#ifdef _WIN64
-
137 else {
-
138 os_platform = process_platform;
-
139 wow64 = false;
+ +
117
+
118 sys_info_t() :
+
119 os_platform(platform_id::unknown),
+
120#ifdef _WIN32
+
121 wow64(false),
+
122#endif
+ +
124 admin(false),
+
125 elevated(false)
+
126 {
+
127#ifdef _WIN32
+
128 HMODULE kernel32_handle;
+
129 kernel32_handle = LoadLibrary(_T("kernel32.dll"));
+
130 _Assume_(kernel32_handle);
+
131 BOOL(WINAPI * IsWow64Process2)(HANDLE hProcess, USHORT * pProcessMachine, USHORT * pNativeMachine);
+
132 *reinterpret_cast<FARPROC*>(&IsWow64Process2) = GetProcAddress(kernel32_handle, "IsWow64Process2");
+
133 HANDLE process = GetCurrentProcess();
+
134 USHORT process_machine;
+
135#ifndef _WIN64
+
136 BOOL Wow64Process;
+
137#endif
+
138 if (IsWow64Process2 && IsWow64Process2(process, &process_machine, reinterpret_cast<USHORT*>(&os_platform))) {
+
139 wow64 = process_machine != IMAGE_FILE_MACHINE_UNKNOWN;
140 }
-
141#else
-
142 else if (IsWow64Process(process, &Wow64Process)) {
-
143 if (Wow64Process) {
-
144 os_platform = platform_id::x86_64;
-
145 wow64 = true;
-
146 }
-
147 else {
-
148 os_platform = process_platform;
-
149 wow64 = false;
-
150 }
-
151 }
-
152#endif
-
153 FreeLibrary(kernel32_handle);
-
154#else
-
155 memset(&m_utsn, 0, sizeof(m_utsn));
-
156 if (uname(&m_utsn) != -1)
-
157 os_platform = platform_from_name(m_utsn.machine);
-
158#endif
-
159
-
160#ifdef _WIN32
-
161 HWINSTA hWinSta = GetProcessWindowStation();
-
162 if (hWinSta) {
-
163 TCHAR sName[MAX_PATH];
-
164 if (GetUserObjectInformation(hWinSta, UOI_NAME, sName, sizeof(sName), NULL)) {
-
165 sName[_countof(sName) - 1] = 0;
-
166 // Only "WinSta0" is interactive (Source: KB171890)
-
167 interactive_process = _tcsicmp(sName, _T("WinSta0")) == 0;
-
168 }
-
169 }
-
170#else
-
171 // TODO: Research interactive process vs service/agent/daemon on this platform.
-
172#endif
-
173
-
174#if defined(_WIN32)
-
175 {
-
176 HANDLE token_h;
-
177 if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token_h)) {
-
178 sys_object token(token_h);
-
179
-
180 TOKEN_ELEVATION elevation;
-
181 DWORD size = sizeof(TOKEN_ELEVATION);
-
182 if (GetTokenInformation(token_h, TokenElevation, &elevation, sizeof(elevation), &size))
-
183 elevated = elevation.TokenIsElevated;
+
141#ifdef _WIN64
+
142 else {
+
143 os_platform = process_platform;
+
144 wow64 = false;
+
145 }
+
146#else
+
147 else if (IsWow64Process(process, &Wow64Process)) {
+
148 if (Wow64Process) {
+
149 os_platform = platform_id::x86_64;
+
150 wow64 = true;
+
151 }
+
152 else {
+
153 os_platform = process_platform;
+
154 wow64 = false;
+
155 }
+
156 }
+
157#endif
+
158 FreeLibrary(kernel32_handle);
+
159#else
+
160 memset(&m_utsn, 0, sizeof(m_utsn));
+
161 if (uname(&m_utsn) != -1)
+
162 os_platform = platform_from_name(m_utsn.machine);
+
163#endif
+
164
+
165#ifdef _WIN32
+
166 HWINSTA hWinSta = GetProcessWindowStation();
+
167 if (hWinSta) {
+
168 TCHAR sName[MAX_PATH];
+
169 if (GetUserObjectInformation(hWinSta, UOI_NAME, sName, sizeof(sName), NULL)) {
+
170 sName[_countof(sName) - 1] = 0;
+
171 // Only "WinSta0" is interactive (Source: KB171890)
+
172 interactive_process = _tcsicmp(sName, _T("WinSta0")) == 0;
+
173 }
+
174 }
+
175#else
+
176 // TODO: Research interactive process vs service/agent/daemon on this platform.
+
177#endif
+
178
+
179#if defined(_WIN32)
+
180 {
+
181 HANDLE token_h;
+
182 if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token_h)) {
+
183 sys_object token(token_h);
184
-
185 GetTokenInformation(token.get(), TokenGroups, NULL, 0, &size);
-
186 std::unique_ptr<TOKEN_GROUPS> groups((TOKEN_GROUPS*)new uint8_t[size]);
-
187 if (GetTokenInformation(token.get(), TokenGroups, (LPVOID)groups.get(), size, &size)) {
-
188 SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY;
-
189 PSID sid_admins_h = NULL;
-
190 if (AllocateAndInitializeSid(&authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &sid_admins_h)) {
-
191 struct SID_delete { void operator()(_In_ PSID p) const { FreeSid(p); } };
-
192 std::unique_ptr<void, SID_delete> sid_admins(sid_admins_h);
-
193 for (DWORD i = 0; i < groups->GroupCount; ++i)
-
194 if (EqualSid(sid_admins.get(), groups->Groups[i].Sid)) {
-
195 admin = true;
-
196 break;
-
197 }
-
198 }
-
199 }
-
200 }
-
201 }
-
202#elif defined(__APPLE__)
-
203 {
-
204 gid_t gids[NGROUPS_MAX];
-
205 for (int i = 0, n = getgroups(NGROUPS_MAX, gids); i < n; ++i) {
-
206 struct group* group = getgrgid(gids[i]);
-
207 if (!group) continue;
-
208 if (strcmp(group->gr_name, "admin") == 0) {
-
209 admin = true;
-
210 break;
-
211 }
-
212 }
-
213 }
-
214
-
215 elevated = geteuid() == 0;
-
216#else
-
217 // TODO: Set admin.
-
218 elevated = geteuid() == 0;
-
219#endif
-
220 }
-
221
-
-
225 static bool is_screen_reader()
-
226 {
-
227#ifdef _WIN32
-
228 BOOL b;
-
229 return SystemParametersInfo(SPI_GETSCREENREADER, 0, &b, 0) && b;
-
230#else
-
231 return false;
-
232#endif
-
233 }
+
185 TOKEN_ELEVATION elevation;
+
186 DWORD size = sizeof(TOKEN_ELEVATION);
+
187 if (GetTokenInformation(token_h, TokenElevation, &elevation, sizeof(elevation), &size))
+
188 elevated = elevation.TokenIsElevated;
+
189
+
190 GetTokenInformation(token.get(), TokenGroups, NULL, 0, &size);
+
191 std::unique_ptr<TOKEN_GROUPS> groups((TOKEN_GROUPS*)new uint8_t[size]);
+
192 if (GetTokenInformation(token.get(), TokenGroups, (LPVOID)groups.get(), size, &size)) {
+
193 SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY;
+
194 PSID sid_admins_h = NULL;
+
195 if (AllocateAndInitializeSid(&authority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &sid_admins_h)) {
+
196 struct SID_delete { void operator()(_In_ PSID p) const { FreeSid(p); } };
+
197 std::unique_ptr<void, SID_delete> sid_admins(sid_admins_h);
+
198 for (DWORD i = 0; i < groups->GroupCount; ++i)
+
199 if (EqualSid(sid_admins.get(), groups->Groups[i].Sid)) {
+
200 admin = true;
+
201 break;
+
202 }
+
203 }
+
204 }
+
205 }
+
206 }
+
207#elif defined(__APPLE__)
+
208 {
+
209 gid_t gids[NGROUPS_MAX];
+
210 for (int i = 0, n = getgroups(NGROUPS_MAX, gids); i < n; ++i) {
+
211 struct group* group = getgrgid(gids[i]);
+
212 if (!group) continue;
+
213 if (strcmp(group->gr_name, "admin") == 0) {
+
214 admin = true;
+
215 break;
+
216 }
+
217 }
+
218 }
+
219
+
220 elevated = geteuid() == 0;
+
221#else
+
222 // TODO: Set admin.
+
223 elevated = geteuid() == 0;
+
224#endif
+
225 }
+
226
+
+
230 static bool is_screen_reader()
+
231 {
+
232#ifdef _WIN32
+
233 BOOL b;
+
234 return SystemParametersInfo(SPI_GETSCREENREADER, 0, &b, 0) && b;
+
235#else
+
236 return false;
+
237#endif
+
238 }
-
234
-
235 protected:
-
236#ifndef _WIN32
-
237 struct utsname m_utsn;
-
238#endif
-
239 } sys_info;
+
239
+
240 protected:
+
241#ifndef _WIN32
+
242 struct utsname m_utsn;
+
243#endif
+
244 } sys_info;
-
240}
+
245}
+
246
+
247#if defined(__GNUC__)
+
248#pragma GCC diagnostic pop
+
249#endif
Operating system object (file, pipe, anything with an OS handle etc.)
Definition system.hpp:99
sys_handle get() const noexcept
Returns object handle.
Definition system.hpp:156
-
System information.
Definition sys_info.hpp:70
-
bool admin
Is member of local group Administrators (Windows) or member of group wheel/sudoers (others)?
Definition sys_info.hpp:106
-
bool elevated
Is elevated process (Windows) or running as root (others)?
Definition sys_info.hpp:111
-
platform_id os_platform
The platform this process was compiled for.
Definition sys_info.hpp:89
-
static bool is_screen_reader()
Is screen reader currently active?
Definition sys_info.hpp:225
-
bool interactive_process
Is interactive process?
Definition sys_info.hpp:101
+
System information.
Definition sys_info.hpp:75
+
bool admin
Is member of local group Administrators (Windows) or member of group wheel/sudoers (others)?
Definition sys_info.hpp:111
+
bool elevated
Is elevated process (Windows) or running as root (others)?
Definition sys_info.hpp:116
+
platform_id os_platform
The platform this process was compiled for.
Definition sys_info.hpp:94
+
static bool is_screen_reader()
Is screen reader currently active?
Definition sys_info.hpp:230
+
bool interactive_process
Is interactive process?
Definition sys_info.hpp:106
diff --git a/system_8hpp_source.html b/system_8hpp_source.html index 3d9fa94b6..04bbb0939 100644 --- a/system_8hpp_source.html +++ b/system_8hpp_source.html @@ -294,7 +294,7 @@ $(function() { codefold.init(0); });
diff --git a/unicode_8hpp_source.html b/unicode_8hpp_source.html index db4e74f6a..c02d88f68 100644 --- a/unicode_8hpp_source.html +++ b/unicode_8hpp_source.html @@ -107,717 +107,718 @@ $(function() { codefold.init(0); });
21#if defined(__GNUC__)
22#pragma GCC diagnostic push
23#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
24#endif
-
25
-
26namespace stdex
-
27{
-
28 enum class charset_id : uint16_t {
-
29#ifdef _WIN32
-
30 system = CP_ACP,
-
31 oem = CP_OEMCP,
-
32 utf7 = CP_UTF7,
-
33 utf8 = CP_UTF8,
-
34 utf16 = 1200 /*CP_WINUNICODE*/,
-
35 utf32 = 12000,
-
36 windows1250 = 1250,
-
37 windows1251 = 1251,
-
38 windows1252 = 1252,
-
39#else
-
40 system = 0,
-
41 utf7,
-
42 utf8,
-
43 utf16,
-
44 utf32,
-
45 windows1250,
-
46 windows1251,
-
47 windows1252,
-
48
-
49 _max
-
50#endif
-
51 };
-
52
-
53#ifdef _WIN32
-
54 constexpr charset_id wchar_t_charset = charset_id::utf16;
-
55#ifdef _UNICODE
-
56 constexpr charset_id system_charset = charset_id::utf16;
-
57#else
-
58 constexpr charset_id system_charset = charset_id::system;
-
59#endif
-
60#else
-
61 constexpr charset_id wchar_t_charset = charset_id::utf32;
-
62 constexpr charset_id system_charset = charset_id::system;
-
63#endif
-
64
-
72 inline charset_id charset_from_name(_In_z_ const char* name)
-
73 {
-
74 struct charset_less {
-
75 bool operator()(_In_z_ const char* a, _In_z_ const char* b) const
-
76 {
-
77 return stricmp(a, b) < 0;
-
78 }
-
79 };
-
80 static const std::map<const char*, charset_id, charset_less> charsets = {
-
81 { "UNICODE-1-1-UTF-7", charset_id::utf7 },
-
82 { "UTF-7", charset_id::utf7 },
-
83 { "CSUNICODE11UTF7", charset_id::utf7 },
-
84
-
85 { "UTF-8", charset_id::utf8 },
-
86 { "UTF8", charset_id::utf8 },
-
87
-
88 { "UTF-16", charset_id::utf16 },
-
89#if BYTE_ORDER == BIG_ENDIAN
-
90 { "UTF-16BE", charset_id::utf16 },
-
91#else
-
92 { "UTF-16LE", charset_id::utf16 },
-
93#endif
-
94
-
95 { "UTF-32", charset_id::utf32 },
-
96#if BYTE_ORDER == BIG_ENDIAN
-
97 { "UTF-32BE", charset_id::utf32 },
-
98#else
-
99 { "UTF-32LE", charset_id::utf32 },
-
100#endif
-
101
-
102 { "CP1250", charset_id::windows1250 },
-
103 { "MS-EE", charset_id::windows1250 },
-
104 { "WINDOWS-1250", charset_id::windows1250 },
-
105
-
106 { "CP1251", charset_id::windows1251 },
-
107 { "MS-CYRL", charset_id::windows1251 },
-
108 { "WINDOWS-1251", charset_id::windows1251 },
-
109
-
110 { "CP1252", charset_id::windows1252 },
-
111 { "MS-ANSI", charset_id::windows1252 },
-
112 { "WINDOWS-1252", charset_id::windows1252 },
-
113 };
-
114 if (auto el = charsets.find(name); el != charsets.end())
-
115 return el->second;
-
116 return charset_id::system;
-
117 }
-
118
-
126 template <class TR = std::char_traits<char>, class AX = std::allocator<char>>
-
127 charset_id charset_from_name(_In_ const std::basic_string<char, TR, AX>& name)
-
128 {
-
129 return charset_from_name(name.c_str());
-
130 }
-
131
-
135 template <typename T_from, typename T_to>
-
- -
137 {
-
138 protected:
-
139 charset_id m_from, m_to;
-
140
-
141 public:
-
142 charset_encoder(_In_ charset_id from, _In_ charset_id to) :
-
143 m_from(from),
-
144 m_to(to)
-
145 {
-
146#ifdef _WIN32
-
147 m_from_wincp = to_encoding(from);
-
148 m_to_wincp = to_encoding(to);
-
149#else
-
150 m_handle = iconv_open(to_encoding(to), to_encoding(from));
-
151 if (m_handle == (iconv_t)-1)
-
152 throw std::system_error(errno, std::system_category(), "iconv_open failed");
-
153#endif
-
154 }
-
155
-
156#ifndef _WIN32
- -
158 {
-
159 iconv_close(m_handle);
-
160 }
-
161#endif
-
162
-
163 charset_id from_encoding() const { return m_from; }
-
164 charset_id to_encoding() const { return m_to; }
-
165
-
173 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
174 void strcat(
-
175 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
-
176 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
-
177 {
-
178 _Assume_(src || !count_src);
-
179 count_src = strnlen<T_from>(src, count_src);
-
180 if (!count_src) _Unlikely_
-
181 return;
-
182
-
183#ifdef _WIN32
-
184 DWORD dwFlagsMBWC = static_cast<UINT>(m_from_wincp) < CP_UTF7 ? MB_PRECOMPOSED : 0;
-
185 constexpr DWORD dwFlagsWCMB = 0;
-
186 constexpr LPCCH lpDefaultChar = NULL;
-
187
-
188 _Assume_(src);
-
189 if (m_from_wincp == m_to_wincp) _Unlikely_{
-
190 dst.append(reinterpret_cast<const T_to*>(src), count_src);
-
191 return;
-
192 }
-
193
-
194#pragma warning(suppress: 4127)
-
195 if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(wchar_t)) {
-
196 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
-
197
-
198 // Try to convert to stack buffer first.
-
199 WCHAR szStackBuffer[1024 / sizeof(WCHAR)];
-
200#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpMultiByteStr parameter wrong?
-
201 int cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), szStackBuffer, _countof(szStackBuffer));
-
202 if (cch) {
-
203 // Append from stack.
-
204 dst.append(reinterpret_cast<const T_to*>(szStackBuffer), count_src != SIZE_MAX ? wcsnlen(szStackBuffer, cch) : static_cast<size_t>(cch) - 1);
-
205 return;
-
206 }
-
207 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
208 // Query the required output size. Allocate buffer. Then convert again.
-
209 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), NULL, 0);
-
210 size_t offset = dst.size();
-
211 dst.resize(offset + static_cast<size_t>(cch));
-
212 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), &dst[offset], cch);
-
213 dst.resize(offset + (count_src != SIZE_MAX ? wcsnlen(&dst[offset], cch) : static_cast<size_t>(cch) - 1));
-
214 return;
-
215 }
-
216 throw std::system_error(GetLastError(), std::system_category(), "MultiByteToWideChar failed");
-
217 }
-
218
-
219#pragma warning(suppress: 4127)
-
220 if constexpr (sizeof(T_from) == sizeof(wchar_t) && sizeof(T_to) == sizeof(char)) {
-
221 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
-
222
-
223 // Try to convert to stack buffer first.
-
224 CHAR szStackBuffer[1024 / sizeof(CHAR)];
-
225#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpWideCharStr parameter wrong?
-
226 int cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, reinterpret_cast<LPCWCH>(src), static_cast<int>(count_src), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, NULL);
-
227 if (cch) {
-
228 // Copy from stack. Be careful not to include zero terminator.
-
229 dst.append(reinterpret_cast<const T_to*>(szStackBuffer), count_src != SIZE_MAX ? strnlen(szStackBuffer, cch) : static_cast<size_t>(cch) - 1);
-
230 return;
-
231 }
-
232 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
233 // Query the required output size. Allocate buffer. Then convert again.
-
234 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, reinterpret_cast<LPCWCH>(src), static_cast<int>(count_src), NULL, 0, lpDefaultChar, NULL);
-
235 size_t offset = dst.size();
-
236 dst.resize(offset + static_cast<size_t>(cch));
-
237 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, reinterpret_cast<LPCWCH>(src), static_cast<int>(count_src), &dst[offset], cch, lpDefaultChar, NULL);
-
238 dst.resize(offset + (count_src != SIZE_MAX ? strnlen(&dst[offset], cch) : static_cast<size_t>(cch) - 1));
-
239 return;
-
240 }
-
241 throw std::system_error(GetLastError(), std::system_category(), "WideCharToMultiByte failed");
-
242 }
-
243
-
244#pragma warning(suppress: 4127)
-
245 if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(char)) {
-
246 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
-
247
-
248 // Try to convert to stack buffer first.
-
249 WCHAR szStackBufferMBWC[512 / sizeof(WCHAR)];
-
250#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpMultiByteStr parameter wrong?
-
251 int cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), szStackBufferMBWC, _countof(szStackBufferMBWC));
-
252 if (cch) {
-
253 // Append from stack.
-
254 size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szStackBufferMBWC, cch) : static_cast<size_t>(cch) - 1;
-
255 _Assume_(count_inter < INT_MAX);
-
256
-
257 // Try to convert to stack buffer first.
-
258 CHAR szStackBufferWCMB[512 / sizeof(CHAR)];
-
259#pragma warning(suppress: 6387) // Testing indicates szStackBufferMBWC may be NULL when count_inter is also 0. Is SAL of the lpWideCharStr parameter wrong?
-
260 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC, static_cast<int>(count_inter), szStackBufferWCMB, _countof(szStackBufferWCMB), lpDefaultChar, NULL);
-
261 if (cch) {
-
262 // Copy from stack. Be careful not to include zero terminator.
-
263 dst.append(reinterpret_cast<const T_to*>(szStackBufferWCMB), strnlen(szStackBufferWCMB, cch));
-
264 return;
-
265 }
-
266 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
267 // Query the required output size. Allocate buffer. Then convert again.
-
268 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC, static_cast<int>(count_inter), NULL, 0, lpDefaultChar, NULL);
-
269 size_t offset = dst.size();
-
270 dst.resize(offset + cch);
-
271 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC, static_cast<int>(count_inter), &dst[offset], cch, lpDefaultChar, NULL);
-
272 dst.resize(offset + strnlen(&dst[offset], cch));
-
273 return;
-
274 }
-
275 throw std::system_error(GetLastError(), std::system_category(), "WideCharToMultiByte failed");
-
276 }
-
277 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-
278 // Query the required output size. Allocate buffer. Then convert again.
-
279 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), NULL, 0);
-
280 std::unique_ptr<WCHAR[]> szBufferMBWC(new WCHAR[cch]);
-
281 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), szBufferMBWC.get(), cch);
-
282 size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szBufferMBWC.get(), cch) : static_cast<size_t>(cch) - 1;
-
283
-
284 // Query the required output size. Allocate buffer. Then convert again.
-
285 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szBufferMBWC.get(), static_cast<int>(count_inter), NULL, 0, lpDefaultChar, NULL);
-
286 size_t offset = dst.size();
-
287 dst.resize(offset + cch);
-
288 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szBufferMBWC.get(), static_cast<int>(count_inter), &dst[offset], cch, lpDefaultChar, NULL);
-
289 dst.resize(offset + strnlen(&dst[offset], cch));
-
290 return;
-
291 }
-
292 throw std::system_error(GetLastError(), std::system_category(), "MultiByteToWideChar failed");
-
293 }
-
294#else
-
295 dst.reserve(dst.size() + count_src);
-
296 T_to buf[1024 / sizeof(T_to)];
-
297 size_t src_size = stdex::mul(sizeof(T_from), count_src);
-
298 for (;;) {
-
299 T_to* output = &buf[0];
-
300 size_t output_size = sizeof(buf);
-
301 errno = 0;
-
302 iconv(m_handle, const_cast<char**>(reinterpret_cast<const char**>(&src)), &src_size, reinterpret_cast<char**>(&output), &output_size);
-
303 dst.append(buf, reinterpret_cast<T_to*>(reinterpret_cast<char*>(buf) + sizeof(buf) - output_size));
-
304 if (!errno)
-
305 break;
-
306 if (errno == E2BIG)
-
307 continue;
-
308 throw std::system_error(errno, std::system_category(), "iconv failed");
-
309 }
-
310#endif
-
311 }
+
24#pragma GCC diagnostic ignored "-Wexit-time-destructors"
+
25#endif
+
26
+
27namespace stdex
+
28{
+
29 enum class charset_id : uint16_t {
+
30#ifdef _WIN32
+
31 system = CP_ACP,
+
32 oem = CP_OEMCP,
+
33 utf7 = CP_UTF7,
+
34 utf8 = CP_UTF8,
+
35 utf16 = 1200 /*CP_WINUNICODE*/,
+
36 utf32 = 12000,
+
37 windows1250 = 1250,
+
38 windows1251 = 1251,
+
39 windows1252 = 1252,
+
40#else
+
41 system = 0,
+
42 utf7,
+
43 utf8,
+
44 utf16,
+
45 utf32,
+
46 windows1250,
+
47 windows1251,
+
48 windows1252,
+
49
+
50 _max
+
51#endif
+
52 };
+
53
+
54#ifdef _WIN32
+
55 constexpr charset_id wchar_t_charset = charset_id::utf16;
+
56#ifdef _UNICODE
+
57 constexpr charset_id system_charset = charset_id::utf16;
+
58#else
+
59 constexpr charset_id system_charset = charset_id::system;
+
60#endif
+
61#else
+
62 constexpr charset_id wchar_t_charset = charset_id::utf32;
+
63 constexpr charset_id system_charset = charset_id::system;
+
64#endif
+
65
+
73 inline charset_id charset_from_name(_In_z_ const char* name)
+
74 {
+
75 struct charset_less {
+
76 bool operator()(_In_z_ const char* a, _In_z_ const char* b) const
+
77 {
+
78 return stricmp(a, b) < 0;
+
79 }
+
80 };
+
81 static const std::map<const char*, charset_id, charset_less> charsets = {
+
82 { "UNICODE-1-1-UTF-7", charset_id::utf7 },
+
83 { "UTF-7", charset_id::utf7 },
+
84 { "CSUNICODE11UTF7", charset_id::utf7 },
+
85
+
86 { "UTF-8", charset_id::utf8 },
+
87 { "UTF8", charset_id::utf8 },
+
88
+
89 { "UTF-16", charset_id::utf16 },
+
90#if BYTE_ORDER == BIG_ENDIAN
+
91 { "UTF-16BE", charset_id::utf16 },
+
92#else
+
93 { "UTF-16LE", charset_id::utf16 },
+
94#endif
+
95
+
96 { "UTF-32", charset_id::utf32 },
+
97#if BYTE_ORDER == BIG_ENDIAN
+
98 { "UTF-32BE", charset_id::utf32 },
+
99#else
+
100 { "UTF-32LE", charset_id::utf32 },
+
101#endif
+
102
+
103 { "CP1250", charset_id::windows1250 },
+
104 { "MS-EE", charset_id::windows1250 },
+
105 { "WINDOWS-1250", charset_id::windows1250 },
+
106
+
107 { "CP1251", charset_id::windows1251 },
+
108 { "MS-CYRL", charset_id::windows1251 },
+
109 { "WINDOWS-1251", charset_id::windows1251 },
+
110
+
111 { "CP1252", charset_id::windows1252 },
+
112 { "MS-ANSI", charset_id::windows1252 },
+
113 { "WINDOWS-1252", charset_id::windows1252 },
+
114 };
+
115 if (auto el = charsets.find(name); el != charsets.end())
+
116 return el->second;
+
117 return charset_id::system;
+
118 }
+
119
+
127 template <class TR = std::char_traits<char>, class AX = std::allocator<char>>
+
128 charset_id charset_from_name(_In_ const std::basic_string<char, TR, AX>& name)
+
129 {
+
130 return charset_from_name(name.c_str());
+
131 }
+
132
+
136 template <typename T_from, typename T_to>
+
+ +
138 {
+
139 protected:
+
140 charset_id m_from, m_to;
+
141
+
142 public:
+
143 charset_encoder(_In_ charset_id from, _In_ charset_id to) :
+
144 m_from(from),
+
145 m_to(to)
+
146 {
+
147#ifdef _WIN32
+
148 m_from_wincp = to_encoding(from);
+
149 m_to_wincp = to_encoding(to);
+
150#else
+
151 m_handle = iconv_open(to_encoding(to), to_encoding(from));
+
152 if (m_handle == (iconv_t)-1)
+
153 throw std::system_error(errno, std::system_category(), "iconv_open failed");
+
154#endif
+
155 }
+
156
+
157#ifndef _WIN32
+ +
159 {
+
160 iconv_close(m_handle);
+
161 }
+
162#endif
+
163
+
164 charset_id from_encoding() const { return m_from; }
+
165 charset_id to_encoding() const { return m_to; }
+
166
+
174 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
175 void strcat(
+
176 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
+
177 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
+
178 {
+
179 _Assume_(src || !count_src);
+
180 count_src = strnlen<T_from>(src, count_src);
+
181 if (!count_src) _Unlikely_
+
182 return;
+
183
+
184#ifdef _WIN32
+
185 DWORD dwFlagsMBWC = static_cast<UINT>(m_from_wincp) < CP_UTF7 ? MB_PRECOMPOSED : 0;
+
186 constexpr DWORD dwFlagsWCMB = 0;
+
187 constexpr LPCCH lpDefaultChar = NULL;
+
188
+
189 _Assume_(src);
+
190 if (m_from_wincp == m_to_wincp) _Unlikely_{
+
191 dst.append(reinterpret_cast<const T_to*>(src), count_src);
+
192 return;
+
193 }
+
194
+
195#pragma warning(suppress: 4127)
+
196 if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(wchar_t)) {
+
197 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
+
198
+
199 // Try to convert to stack buffer first.
+
200 WCHAR szStackBuffer[1024 / sizeof(WCHAR)];
+
201#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpMultiByteStr parameter wrong?
+
202 int cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), szStackBuffer, _countof(szStackBuffer));
+
203 if (cch) {
+
204 // Append from stack.
+
205 dst.append(reinterpret_cast<const T_to*>(szStackBuffer), count_src != SIZE_MAX ? wcsnlen(szStackBuffer, cch) : static_cast<size_t>(cch) - 1);
+
206 return;
+
207 }
+
208 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
209 // Query the required output size. Allocate buffer. Then convert again.
+
210 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), NULL, 0);
+
211 size_t offset = dst.size();
+
212 dst.resize(offset + static_cast<size_t>(cch));
+
213 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), &dst[offset], cch);
+
214 dst.resize(offset + (count_src != SIZE_MAX ? wcsnlen(&dst[offset], cch) : static_cast<size_t>(cch) - 1));
+
215 return;
+
216 }
+
217 throw std::system_error(GetLastError(), std::system_category(), "MultiByteToWideChar failed");
+
218 }
+
219
+
220#pragma warning(suppress: 4127)
+
221 if constexpr (sizeof(T_from) == sizeof(wchar_t) && sizeof(T_to) == sizeof(char)) {
+
222 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
+
223
+
224 // Try to convert to stack buffer first.
+
225 CHAR szStackBuffer[1024 / sizeof(CHAR)];
+
226#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpWideCharStr parameter wrong?
+
227 int cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, reinterpret_cast<LPCWCH>(src), static_cast<int>(count_src), szStackBuffer, _countof(szStackBuffer), lpDefaultChar, NULL);
+
228 if (cch) {
+
229 // Copy from stack. Be careful not to include zero terminator.
+
230 dst.append(reinterpret_cast<const T_to*>(szStackBuffer), count_src != SIZE_MAX ? strnlen(szStackBuffer, cch) : static_cast<size_t>(cch) - 1);
+
231 return;
+
232 }
+
233 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
234 // Query the required output size. Allocate buffer. Then convert again.
+
235 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, reinterpret_cast<LPCWCH>(src), static_cast<int>(count_src), NULL, 0, lpDefaultChar, NULL);
+
236 size_t offset = dst.size();
+
237 dst.resize(offset + static_cast<size_t>(cch));
+
238 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, reinterpret_cast<LPCWCH>(src), static_cast<int>(count_src), &dst[offset], cch, lpDefaultChar, NULL);
+
239 dst.resize(offset + (count_src != SIZE_MAX ? strnlen(&dst[offset], cch) : static_cast<size_t>(cch) - 1));
+
240 return;
+
241 }
+
242 throw std::system_error(GetLastError(), std::system_category(), "WideCharToMultiByte failed");
+
243 }
+
244
+
245#pragma warning(suppress: 4127)
+
246 if constexpr (sizeof(T_from) == sizeof(char) && sizeof(T_to) == sizeof(char)) {
+
247 _Assume_(count_src < INT_MAX || count_src == SIZE_MAX);
+
248
+
249 // Try to convert to stack buffer first.
+
250 WCHAR szStackBufferMBWC[512 / sizeof(WCHAR)];
+
251#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpMultiByteStr parameter wrong?
+
252 int cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), szStackBufferMBWC, _countof(szStackBufferMBWC));
+
253 if (cch) {
+
254 // Append from stack.
+
255 size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szStackBufferMBWC, cch) : static_cast<size_t>(cch) - 1;
+
256 _Assume_(count_inter < INT_MAX);
+
257
+
258 // Try to convert to stack buffer first.
+
259 CHAR szStackBufferWCMB[512 / sizeof(CHAR)];
+
260#pragma warning(suppress: 6387) // Testing indicates szStackBufferMBWC may be NULL when count_inter is also 0. Is SAL of the lpWideCharStr parameter wrong?
+
261 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC, static_cast<int>(count_inter), szStackBufferWCMB, _countof(szStackBufferWCMB), lpDefaultChar, NULL);
+
262 if (cch) {
+
263 // Copy from stack. Be careful not to include zero terminator.
+
264 dst.append(reinterpret_cast<const T_to*>(szStackBufferWCMB), strnlen(szStackBufferWCMB, cch));
+
265 return;
+
266 }
+
267 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
268 // Query the required output size. Allocate buffer. Then convert again.
+
269 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC, static_cast<int>(count_inter), NULL, 0, lpDefaultChar, NULL);
+
270 size_t offset = dst.size();
+
271 dst.resize(offset + cch);
+
272 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szStackBufferMBWC, static_cast<int>(count_inter), &dst[offset], cch, lpDefaultChar, NULL);
+
273 dst.resize(offset + strnlen(&dst[offset], cch));
+
274 return;
+
275 }
+
276 throw std::system_error(GetLastError(), std::system_category(), "WideCharToMultiByte failed");
+
277 }
+
278 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+
279 // Query the required output size. Allocate buffer. Then convert again.
+
280 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), NULL, 0);
+
281 std::unique_ptr<WCHAR[]> szBufferMBWC(new WCHAR[cch]);
+
282 cch = MultiByteToWideChar(static_cast<UINT>(m_from_wincp), dwFlagsMBWC, reinterpret_cast<LPCCH>(src), static_cast<int>(count_src), szBufferMBWC.get(), cch);
+
283 size_t count_inter = count_src != SIZE_MAX ? wcsnlen(szBufferMBWC.get(), cch) : static_cast<size_t>(cch) - 1;
+
284
+
285 // Query the required output size. Allocate buffer. Then convert again.
+
286 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szBufferMBWC.get(), static_cast<int>(count_inter), NULL, 0, lpDefaultChar, NULL);
+
287 size_t offset = dst.size();
+
288 dst.resize(offset + cch);
+
289 cch = WideCharToMultiByte(static_cast<UINT>(m_to_wincp), dwFlagsWCMB, szBufferMBWC.get(), static_cast<int>(count_inter), &dst[offset], cch, lpDefaultChar, NULL);
+
290 dst.resize(offset + strnlen(&dst[offset], cch));
+
291 return;
+
292 }
+
293 throw std::system_error(GetLastError(), std::system_category(), "MultiByteToWideChar failed");
+
294 }
+
295#else
+
296 dst.reserve(dst.size() + count_src);
+
297 T_to buf[1024 / sizeof(T_to)];
+
298 size_t src_size = stdex::mul(sizeof(T_from), count_src);
+
299 for (;;) {
+
300 T_to* output = &buf[0];
+
301 size_t output_size = sizeof(buf);
+
302 errno = 0;
+
303 iconv(m_handle, const_cast<char**>(reinterpret_cast<const char**>(&src)), &src_size, reinterpret_cast<char**>(&output), &output_size);
+
304 dst.append(buf, reinterpret_cast<T_to*>(reinterpret_cast<char*>(buf) + sizeof(buf) - output_size));
+
305 if (!errno)
+
306 break;
+
307 if (errno == E2BIG)
+
308 continue;
+
309 throw std::system_error(errno, std::system_category(), "iconv failed");
+
310 }
+
311#endif
+
312 }
-
312
-
319 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
320 void strcat(
-
321 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
-
322 _In_z_ const T_from* src)
-
323 {
-
324 strcat(dst, src, SIZE_MAX);
-
325 }
+
313
+
320 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
321 void strcat(
+
322 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
+
323 _In_z_ const T_from* src)
+
324 {
+
325 strcat(dst, src, SIZE_MAX);
+
326 }
-
326
-
333 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
334 void strcat(
-
335 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
-
336 _In_ const std::basic_string_view<T_from, std::char_traits<T_from>> src)
-
337 {
-
338 strcat(dst, src.data(), src.size());
-
339 }
+
327
+
334 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
335 void strcat(
+
336 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
+
337 _In_ const std::basic_string_view<T_from, std::char_traits<T_from>> src)
+
338 {
+
339 strcat(dst, src.data(), src.size());
+
340 }
-
340
-
348 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
349 void strcpy(
-
350 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
-
351 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
-
352 {
-
353 dst.clear();
-
354 strcat(dst, src, count_src);
-
355 }
+
341
+
349 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
350 void strcpy(
+
351 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
+
352 _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
+
353 {
+
354 dst.clear();
+
355 strcat(dst, src, count_src);
+
356 }
-
356
-
363 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
364 void strcpy(
-
365 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
-
366 _In_z_ const T_from* src)
-
367 {
-
368 strcpy(dst, src, SIZE_MAX);
-
369 }
+
357
+
364 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
365 void strcpy(
+
366 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
+
367 _In_z_ const T_from* src)
+
368 {
+
369 strcpy(dst, src, SIZE_MAX);
+
370 }
-
370
-
377 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
378 void strcpy(
-
379 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
-
380 _In_ const std::basic_string_view<T_from, std::char_traits<T_from>> src)
-
381 {
-
382 strcpy(dst, src.data(), src.size());
-
383 }
+
371
+
378 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
379 void strcpy(
+
380 _Inout_ std::basic_string<T_to, TR_to, AX_to>& dst,
+
381 _In_ const std::basic_string_view<T_from, std::char_traits<T_from>> src)
+
382 {
+
383 strcpy(dst, src.data(), src.size());
+
384 }
-
384
-
391 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
392 std::basic_string<T_to, TR_to, AX_to> convert(_In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
-
393 {
-
394 std::basic_string<T_to, TR_to, AX_to> dst;
-
395 strcat(dst, src, count_src);
-
396 return dst;
-
397 }
+
385
+
392 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
393 std::basic_string<T_to, TR_to, AX_to> convert(_In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
+
394 {
+
395 std::basic_string<T_to, TR_to, AX_to> dst;
+
396 strcat(dst, src, count_src);
+
397 return dst;
+
398 }
-
398
-
404 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
405 std::basic_string<T_to, TR_to, AX_to> convert(_In_z_ const T_from* src)
-
406 {
-
407 return convert(src, SIZE_MAX);
-
408 }
+
399
+
405 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
406 std::basic_string<T_to, TR_to, AX_to> convert(_In_z_ const T_from* src)
+
407 {
+
408 return convert(src, SIZE_MAX);
+
409 }
-
409
-
415 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
-
-
416 std::basic_string<T_to, TR_to, AX_to> convert(_In_ const std::basic_string_view<T_from, std::char_traits<T_from>> src)
-
417 {
-
418 return convert(src.data(), src.size());
-
419 }
+
410
+
416 template <class TR_to = std::char_traits<T_to>, class AX_to = std::allocator<T_to>>
+
+
417 std::basic_string<T_to, TR_to, AX_to> convert(_In_ const std::basic_string_view<T_from, std::char_traits<T_from>> src)
+
418 {
+
419 return convert(src.data(), src.size());
+
420 }
-
420
-
421 void clear()
-
422 {
-
423#ifndef _WIN32
-
424 iconv(m_handle, NULL, NULL, NULL, NULL);
-
425#endif
-
426 }
-
427
-
428 static charset_id system_charset()
-
429 {
-
430#ifdef _WIN32
-
431 return static_cast<charset_id>(GetACP());
-
432#else
-
433 return charset_from_name(nl_langinfo(CODESET));
-
434#endif
-
435 }
-
436
-
437#ifdef _WIN32
-
438 protected:
-
439 static UINT to_encoding(_In_ charset_id charset)
-
440 {
-
441 return
-
442 charset == charset_id::system ? GetACP() :
-
443 charset == charset_id::oem ? GetOEMCP() :
-
444 static_cast<UINT>(charset);
-
445 }
-
446
-
447 protected:
-
448 UINT m_from_wincp, m_to_wincp;
-
449#else
-
450 protected:
-
451 static const char* to_encoding(_In_ charset_id charset)
-
452 {
-
453 static const char* const encodings[static_cast<std::underlying_type_t<charset_id>>(charset_id::_max)] = {
-
454 "", // system
-
455 "UTF-7", // utf7
-
456 "UTF-8", // utf8
-
457#if BYTE_ORDER == BIG_ENDIAN
-
458 "UTF-16BE", // utf16
-
459 "UTF-32BE", // utf32
-
460#else
-
461 "UTF-16LE", // utf16
-
462 "UTF-32LE", // utf32
-
463#endif
-
464 "CP1250", // windows1250
-
465 "CP1251", // windows1251
-
466 "CP1252", // windows1252
-
467 };
-
468 return
-
469 charset == charset_id::system ? nl_langinfo(CODESET) :
-
470 encodings[static_cast<std::underlying_type_t<charset_id>>(charset)];
-
471 }
-
472
-
473 protected:
-
474 iconv_t m_handle;
-
475#endif
-
476 };
+
421
+
422 void clear()
+
423 {
+
424#ifndef _WIN32
+
425 iconv(m_handle, NULL, NULL, NULL, NULL);
+
426#endif
+
427 }
+
428
+
429 static charset_id system_charset()
+
430 {
+
431#ifdef _WIN32
+
432 return static_cast<charset_id>(GetACP());
+
433#else
+
434 return charset_from_name(nl_langinfo(CODESET));
+
435#endif
+
436 }
+
437
+
438#ifdef _WIN32
+
439 protected:
+
440 static UINT to_encoding(_In_ charset_id charset)
+
441 {
+
442 return
+
443 charset == charset_id::system ? GetACP() :
+
444 charset == charset_id::oem ? GetOEMCP() :
+
445 static_cast<UINT>(charset);
+
446 }
+
447
+
448 protected:
+
449 UINT m_from_wincp, m_to_wincp;
+
450#else
+
451 protected:
+
452 static const char* to_encoding(_In_ charset_id charset)
+
453 {
+
454 static const char* const encodings[static_cast<std::underlying_type_t<charset_id>>(charset_id::_max)] = {
+
455 "", // system
+
456 "UTF-7", // utf7
+
457 "UTF-8", // utf8
+
458#if BYTE_ORDER == BIG_ENDIAN
+
459 "UTF-16BE", // utf16
+
460 "UTF-32BE", // utf32
+
461#else
+
462 "UTF-16LE", // utf16
+
463 "UTF-32LE", // utf32
+
464#endif
+
465 "CP1250", // windows1250
+
466 "CP1251", // windows1251
+
467 "CP1252", // windows1252
+
468 };
+
469 return
+
470 charset == charset_id::system ? nl_langinfo(CODESET) :
+
471 encodings[static_cast<std::underlying_type_t<charset_id>>(charset)];
+
472 }
+
473
+
474 protected:
+
475 iconv_t m_handle;
+
476#endif
+
477 };
-
477
-
488 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
489#ifndef _WIN32
-
490 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
491#endif
-
492 inline void strcat(
-
493 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
494 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
-
495 _In_ charset_id charset = charset_id::system)
-
496 {
-
497 charset_encoder<char, wchar_t>(charset, wchar_t_charset).strcat(dst, src, count_src);
-
498 }
-
499
-
500 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
501 _Deprecated_("Use stdex::strcat")
-
502 inline void str2wstr(
-
503 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
504 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
-
505 _In_ charset_id charset = charset_id::system)
-
506 {
-
507 strcat(dst, src, count_src, charset);
-
508 }
-
509
-
519 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
520#ifndef _WIN32
-
521 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
522#endif
-
523 inline void strcat(
-
524 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
525 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
-
526 _In_ charset_id charset = charset_id::system)
-
527 {
-
528 strcat(dst, src.data(), src.size(), charset);
-
529 }
-
530
-
531 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
532 _Deprecated_("Use stdex::strcat")
-
533 inline void str2wstr(
-
534 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
535 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
-
536 _In_ charset_id charset = charset_id::system)
-
537 {
-
538 strcat(dst, src, charset);
-
539 }
-
540
-
551 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
552#ifndef _WIN32
-
553 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
554#endif
-
555 inline void strcpy(
-
556 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
557 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
-
558 _In_ charset_id charset = charset_id::system)
-
559 {
-
560 dst.clear();
-
561 strcat(dst, src, count_src, charset);
-
562 }
-
563
-
573 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
-
574#ifndef _WIN32
-
575 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
576#endif
-
577 inline void strcpy(
-
578 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
-
579 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
-
580 _In_ charset_id charset = charset_id::system)
-
581 {
-
582 strcpy(dst, src.data(), src.size(), charset);
-
583 }
-
584
-
595#ifndef _WIN32
-
596 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
597#endif
-
598 inline std::wstring str2wstr(
-
599 _In_z_ const char* src,
-
600 _In_ charset_id charset = charset_id::system)
-
601 {
-
602 std::wstring dst;
-
603 strcat(dst, src, SIZE_MAX, charset);
-
604 return dst;
-
605 }
-
606
-
618#ifndef _WIN32
-
619 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
620#endif
-
621 inline std::wstring str2wstr(
-
622 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
-
623 _In_ charset_id charset = charset_id::system)
-
624 {
-
625 std::wstring dst;
-
626 strcat(dst, src, count_src, charset);
-
627 return dst;
-
628 }
-
629
-
640#ifndef _WIN32
-
641 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
642#endif
-
643 inline std::wstring str2wstr(
-
644 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
-
645 _In_ charset_id charset = charset_id::system)
-
646 {
-
647 return str2wstr(src.data(), src.size(), charset);
-
648 }
-
649
-
660 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
661#ifndef _WIN32
-
662 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
663#endif
-
664 inline void strcat(
-
665 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
666 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
667 _In_ charset_id charset = charset_id::system)
-
668 {
-
669 charset_encoder<wchar_t, char>(wchar_t_charset, charset).strcat(dst, src, count_src);
-
670 }
-
671
-
672 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
673 _Deprecated_("Use stdex::strcat")
-
674 inline void wstr2str(
-
675 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
676 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
677 _In_ charset_id charset = charset_id::system)
-
678 {
-
679 strcat(dst, src, count_src, charset);
-
680 }
-
681
-
691 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
692#ifndef _WIN32
-
693 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
694#endif
-
695 inline void strcat(
-
696 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
697 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
698 _In_ charset_id charset = charset_id::system)
-
699 {
-
700 strcat(dst, src.data(), src.size(), charset);
-
701 }
-
702
-
703 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
704 _Deprecated_("Use stdex::strcat")
-
705 inline void wstr2str(
-
706 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
707 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
708 _In_ charset_id charset = charset_id::system)
-
709 {
-
710 strcat(dst, src, charset);
-
711 }
-
712
-
723 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
724#ifndef _WIN32
-
725 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
726#endif
-
727 inline void strcpy(
-
728 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
729 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
730 _In_ charset_id charset = charset_id::system)
-
731 {
-
732 dst.clear();
-
733 strcat(dst, src, count_src, charset);
-
734 }
-
735
-
745 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
-
746#ifndef _WIN32
-
747 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
748#endif
-
749 inline void strcpy(
-
750 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
-
751 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
752 _In_ charset_id charset = charset_id::system)
-
753 {
-
754 strcpy(dst, src.data(), src.size(), charset);
-
755 }
-
756
-
767#ifndef _WIN32
-
768 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
769#endif
-
770 inline std::string wstr2str(
-
771 _In_z_ const wchar_t* src,
-
772 _In_ charset_id charset = charset_id::system)
-
773 {
-
774 std::string dst;
-
775 strcat(dst, src, SIZE_MAX, charset);
-
776 return dst;
-
777 }
-
778
-
790#ifndef _WIN32
-
791 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
792#endif
-
793 inline std::string wstr2str(
-
794 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
-
795 _In_ charset_id charset = charset_id::system)
-
796 {
-
797 std::string dst;
-
798 strcat(dst, src, count_src, charset);
-
799 return dst;
-
800 }
-
801
-
812#ifndef _WIN32
-
813 _Deprecated_("For better performance, consider a reusable charset_encoder")
-
814#endif
-
815 inline std::string wstr2str(
-
816 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
-
817 _In_ charset_id charset = charset_id::system)
-
818 {
-
819 return wstr2str(src.data(), src.size(), charset);
-
820 }
-
821
-
822#ifdef _WIN32
-
832 template <class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
-
833 size_t normalizecat(
-
834 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
-
835 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src)
-
836 {
-
837 count_src = strnlen(src, count_src);
-
838 size_t count_dst = dst.size();
-
839 dst.resize(count_dst + count_src);
-
840 _Assume_(count_src + 1 < INT_MAX);
-
841#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpSrcString parameter wrong?
-
842 int r = NormalizeString(NormalizationC, src, static_cast<int>(count_src), dst.data() + count_dst, static_cast<int>(count_src + 1));
-
843 if (r >= 0)
-
844 dst.resize(count_dst + r);
-
845 else
-
846#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the _Src parameter wrong?
-
847 memcpy(dst.data() + count_dst, src, count_src * sizeof(wchar_t));
-
848 return dst.size();
-
849 }
-
850
-
859 template <size_t N, class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
-
860 size_t normalizecat(
-
861 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
-
862 _In_ const wchar_t (&src)[N])
-
863 {
-
864 return normalizecat(dst, src, N);
-
865 }
-
866
-
875 template <class TR_dst = std::char_traits<wchar_t>, class AX_dst = std::allocator<wchar_t>>
-
876 size_t normalizecat(
-
877 _Inout_ std::basic_string<wchar_t, TR_dst, AX_dst>& dst,
-
878 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src)
-
879 {
-
880 return normalizecat(dst, src.data(), src.size());
-
881 }
-
882
-
892 template <class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
-
893 size_t normalize(
-
894 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
-
895 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src)
-
896 {
-
897 dst.clear();
-
898 return normalizecat(dst, src, count_src);
-
899 }
-
900
-
909 template <size_t N, class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
-
910 size_t normalize(
-
911 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
-
912 _In_ const wchar_t(&src)[N])
-
913 {
-
914 return normalize(dst, src, N);
-
915 }
-
916
-
925 template <class TR_dst = std::char_traits<wchar_t>, class AX_dst = std::allocator<wchar_t>>
-
926 size_t normalize(
-
927 _Inout_ std::basic_string<wchar_t, TR_dst, AX_dst>& dst,
-
928 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src)
-
929 {
-
930 return normalize(dst, src.data(), src.size());
-
931 }
-
932
-
941 inline std::wstring normalize(_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src)
-
942 {
-
943 std::wstring dst;
-
944 normalizecat(dst, src, count_src);
-
945 return dst;
-
946 }
-
947
-
955 template <size_t N>
-
956 std::wstring normalize(_In_ const wchar_t(&src)[N])
-
957 {
-
958 std::wstring dst;
-
959 normalizecat(dst, src, N);
-
960 return dst;
-
961 }
-
962
-
970 inline std::wstring normalize(_In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src)
-
971 {
-
972 std::wstring dst;
-
973 normalizecat(dst, src.data(), src.size());
-
974 return dst;
-
975 }
-
976#endif
-
977}
-
978
-
979#if defined(__GNUC__)
-
980#pragma GCC diagnostic pop
-
981#endif
-
Encoding converter context.
Definition unicode.hpp:137
-
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, _In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Convert string and append to string.
Definition unicode.hpp:174
-
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Convert string and append to string.
Definition unicode.hpp:334
-
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, const T_from *src)
Convert string.
Definition unicode.hpp:364
-
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, const T_from *src)
Convert string and append to string.
Definition unicode.hpp:320
-
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, _In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Convert string.
Definition unicode.hpp:349
-
std::basic_string< T_to, TR_to, AX_to > convert(const T_from *src)
Return converted string.
Definition unicode.hpp:405
-
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Convert string.
Definition unicode.hpp:378
-
std::basic_string< T_to, TR_to, AX_to > convert(const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Return converted string.
Definition unicode.hpp:416
-
std::basic_string< T_to, TR_to, AX_to > convert(_In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Return converted string.
Definition unicode.hpp:392
+
478
+
489 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
490#ifndef _WIN32
+
491 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
492#endif
+
493 inline void strcat(
+
494 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
495 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
+
496 _In_ charset_id charset = charset_id::system)
+
497 {
+
498 charset_encoder<char, wchar_t>(charset, wchar_t_charset).strcat(dst, src, count_src);
+
499 }
+
500
+
501 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
502 _Deprecated_("Use stdex::strcat")
+
503 inline void str2wstr(
+
504 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
505 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
+
506 _In_ charset_id charset = charset_id::system)
+
507 {
+
508 strcat(dst, src, count_src, charset);
+
509 }
+
510
+
520 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
521#ifndef _WIN32
+
522 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
523#endif
+
524 inline void strcat(
+
525 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
526 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
+
527 _In_ charset_id charset = charset_id::system)
+
528 {
+
529 strcat(dst, src.data(), src.size(), charset);
+
530 }
+
531
+
532 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
533 _Deprecated_("Use stdex::strcat")
+
534 inline void str2wstr(
+
535 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
536 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
+
537 _In_ charset_id charset = charset_id::system)
+
538 {
+
539 strcat(dst, src, charset);
+
540 }
+
541
+
552 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
553#ifndef _WIN32
+
554 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
555#endif
+
556 inline void strcpy(
+
557 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
558 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
+
559 _In_ charset_id charset = charset_id::system)
+
560 {
+
561 dst.clear();
+
562 strcat(dst, src, count_src, charset);
+
563 }
+
564
+
574 template <class TR_to = std::char_traits<wchar_t>, class AX_to = std::allocator<wchar_t>>
+
575#ifndef _WIN32
+
576 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
577#endif
+
578 inline void strcpy(
+
579 _Inout_ std::basic_string<wchar_t, TR_to, AX_to>& dst,
+
580 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
+
581 _In_ charset_id charset = charset_id::system)
+
582 {
+
583 strcpy(dst, src.data(), src.size(), charset);
+
584 }
+
585
+
596#ifndef _WIN32
+
597 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
598#endif
+
599 inline std::wstring str2wstr(
+
600 _In_z_ const char* src,
+
601 _In_ charset_id charset = charset_id::system)
+
602 {
+
603 std::wstring dst;
+
604 strcat(dst, src, SIZE_MAX, charset);
+
605 return dst;
+
606 }
+
607
+
619#ifndef _WIN32
+
620 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
621#endif
+
622 inline std::wstring str2wstr(
+
623 _In_reads_or_z_opt_(count_src) const char* src, _In_ size_t count_src,
+
624 _In_ charset_id charset = charset_id::system)
+
625 {
+
626 std::wstring dst;
+
627 strcat(dst, src, count_src, charset);
+
628 return dst;
+
629 }
+
630
+
641#ifndef _WIN32
+
642 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
643#endif
+
644 inline std::wstring str2wstr(
+
645 _In_ const std::basic_string_view<char, std::char_traits<char>> src,
+
646 _In_ charset_id charset = charset_id::system)
+
647 {
+
648 return str2wstr(src.data(), src.size(), charset);
+
649 }
+
650
+
661 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
662#ifndef _WIN32
+
663 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
664#endif
+
665 inline void strcat(
+
666 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
667 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
668 _In_ charset_id charset = charset_id::system)
+
669 {
+
670 charset_encoder<wchar_t, char>(wchar_t_charset, charset).strcat(dst, src, count_src);
+
671 }
+
672
+
673 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
674 _Deprecated_("Use stdex::strcat")
+
675 inline void wstr2str(
+
676 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
677 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
678 _In_ charset_id charset = charset_id::system)
+
679 {
+
680 strcat(dst, src, count_src, charset);
+
681 }
+
682
+
692 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
693#ifndef _WIN32
+
694 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
695#endif
+
696 inline void strcat(
+
697 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
698 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
699 _In_ charset_id charset = charset_id::system)
+
700 {
+
701 strcat(dst, src.data(), src.size(), charset);
+
702 }
+
703
+
704 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
705 _Deprecated_("Use stdex::strcat")
+
706 inline void wstr2str(
+
707 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
708 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
709 _In_ charset_id charset = charset_id::system)
+
710 {
+
711 strcat(dst, src, charset);
+
712 }
+
713
+
724 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
725#ifndef _WIN32
+
726 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
727#endif
+
728 inline void strcpy(
+
729 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
730 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
731 _In_ charset_id charset = charset_id::system)
+
732 {
+
733 dst.clear();
+
734 strcat(dst, src, count_src, charset);
+
735 }
+
736
+
746 template <class TR_to = std::char_traits<char>, class AX_to = std::allocator<char>>
+
747#ifndef _WIN32
+
748 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
749#endif
+
750 inline void strcpy(
+
751 _Inout_ std::basic_string<char, TR_to, AX_to>& dst,
+
752 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
753 _In_ charset_id charset = charset_id::system)
+
754 {
+
755 strcpy(dst, src.data(), src.size(), charset);
+
756 }
+
757
+
768#ifndef _WIN32
+
769 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
770#endif
+
771 inline std::string wstr2str(
+
772 _In_z_ const wchar_t* src,
+
773 _In_ charset_id charset = charset_id::system)
+
774 {
+
775 std::string dst;
+
776 strcat(dst, src, SIZE_MAX, charset);
+
777 return dst;
+
778 }
+
779
+
791#ifndef _WIN32
+
792 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
793#endif
+
794 inline std::string wstr2str(
+
795 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
+
796 _In_ charset_id charset = charset_id::system)
+
797 {
+
798 std::string dst;
+
799 strcat(dst, src, count_src, charset);
+
800 return dst;
+
801 }
+
802
+
813#ifndef _WIN32
+
814 _Deprecated_("For better performance, consider a reusable charset_encoder")
+
815#endif
+
816 inline std::string wstr2str(
+
817 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src,
+
818 _In_ charset_id charset = charset_id::system)
+
819 {
+
820 return wstr2str(src.data(), src.size(), charset);
+
821 }
+
822
+
823#ifdef _WIN32
+
833 template <class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
+
834 size_t normalizecat(
+
835 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
+
836 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src)
+
837 {
+
838 count_src = strnlen(src, count_src);
+
839 size_t count_dst = dst.size();
+
840 dst.resize(count_dst + count_src);
+
841 _Assume_(count_src + 1 < INT_MAX);
+
842#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the lpSrcString parameter wrong?
+
843 int r = NormalizeString(NormalizationC, src, static_cast<int>(count_src), dst.data() + count_dst, static_cast<int>(count_src + 1));
+
844 if (r >= 0)
+
845 dst.resize(count_dst + r);
+
846 else
+
847#pragma warning(suppress: 6387) // Testing indicates src may be NULL when count_src is also 0. Is SAL of the _Src parameter wrong?
+
848 memcpy(dst.data() + count_dst, src, count_src * sizeof(wchar_t));
+
849 return dst.size();
+
850 }
+
851
+
860 template <size_t N, class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
+
861 size_t normalizecat(
+
862 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
+
863 _In_ const wchar_t (&src)[N])
+
864 {
+
865 return normalizecat(dst, src, N);
+
866 }
+
867
+
876 template <class TR_dst = std::char_traits<wchar_t>, class AX_dst = std::allocator<wchar_t>>
+
877 size_t normalizecat(
+
878 _Inout_ std::basic_string<wchar_t, TR_dst, AX_dst>& dst,
+
879 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src)
+
880 {
+
881 return normalizecat(dst, src.data(), src.size());
+
882 }
+
883
+
893 template <class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
+
894 size_t normalize(
+
895 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
+
896 _In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src)
+
897 {
+
898 dst.clear();
+
899 return normalizecat(dst, src, count_src);
+
900 }
+
901
+
910 template <size_t N, class TR = std::char_traits<wchar_t>, class AX = std::allocator<wchar_t>>
+
911 size_t normalize(
+
912 _Inout_ std::basic_string<wchar_t, TR, AX>& dst,
+
913 _In_ const wchar_t(&src)[N])
+
914 {
+
915 return normalize(dst, src, N);
+
916 }
+
917
+
926 template <class TR_dst = std::char_traits<wchar_t>, class AX_dst = std::allocator<wchar_t>>
+
927 size_t normalize(
+
928 _Inout_ std::basic_string<wchar_t, TR_dst, AX_dst>& dst,
+
929 _In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src)
+
930 {
+
931 return normalize(dst, src.data(), src.size());
+
932 }
+
933
+
942 inline std::wstring normalize(_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src)
+
943 {
+
944 std::wstring dst;
+
945 normalizecat(dst, src, count_src);
+
946 return dst;
+
947 }
+
948
+
956 template <size_t N>
+
957 std::wstring normalize(_In_ const wchar_t(&src)[N])
+
958 {
+
959 std::wstring dst;
+
960 normalizecat(dst, src, N);
+
961 return dst;
+
962 }
+
963
+
971 inline std::wstring normalize(_In_ const std::basic_string_view<wchar_t, std::char_traits<wchar_t>> src)
+
972 {
+
973 std::wstring dst;
+
974 normalizecat(dst, src.data(), src.size());
+
975 return dst;
+
976 }
+
977#endif
+
978}
+
979
+
980#if defined(__GNUC__)
+
981#pragma GCC diagnostic pop
+
982#endif
+
Encoding converter context.
Definition unicode.hpp:138
+
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, _In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Convert string and append to string.
Definition unicode.hpp:175
+
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Convert string and append to string.
Definition unicode.hpp:335
+
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, const T_from *src)
Convert string.
Definition unicode.hpp:365
+
void strcat(std::basic_string< T_to, TR_to, AX_to > &dst, const T_from *src)
Convert string and append to string.
Definition unicode.hpp:321
+
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, _In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Convert string.
Definition unicode.hpp:350
+
std::basic_string< T_to, TR_to, AX_to > convert(const T_from *src)
Return converted string.
Definition unicode.hpp:406
+
void strcpy(std::basic_string< T_to, TR_to, AX_to > &dst, const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Convert string.
Definition unicode.hpp:379
+
std::basic_string< T_to, TR_to, AX_to > convert(const std::basic_string_view< T_from, std::char_traits< T_from > > src)
Return converted string.
Definition unicode.hpp:417
+
std::basic_string< T_to, TR_to, AX_to > convert(_In_reads_or_z_opt_(count_src) const T_from *src, size_t count_src)
Return converted string.
Definition unicode.hpp:393
diff --git a/unionstdex_1_1md2__t-members.html b/unionstdex_1_1md2__t-members.html index d540a38d9..973b98a15 100644 --- a/unionstdex_1_1md2__t-members.html +++ b/unionstdex_1_1md2__t-members.html @@ -91,7 +91,7 @@ $(function() {
diff --git a/unionstdex_1_1md2__t.html b/unionstdex_1_1md2__t.html index 409a77870..70d13d428 100644 --- a/unionstdex_1_1md2__t.html +++ b/unionstdex_1_1md2__t.html @@ -125,7 +125,7 @@ Friends
diff --git a/unionstdex_1_1sha256__t-members.html b/unionstdex_1_1sha256__t-members.html index 1760da4e7..3c61b91e5 100644 --- a/unionstdex_1_1sha256__t-members.html +++ b/unionstdex_1_1sha256__t-members.html @@ -91,7 +91,7 @@ $(function() {
diff --git a/unionstdex_1_1sha256__t.html b/unionstdex_1_1sha256__t.html index 07039a4d8..37ca902f8 100644 --- a/unionstdex_1_1sha256__t.html +++ b/unionstdex_1_1sha256__t.html @@ -125,7 +125,7 @@ Friends
diff --git a/unionstdex_1_1sha__t-members.html b/unionstdex_1_1sha__t-members.html index 81d15bb8c..eef1abba4 100644 --- a/unionstdex_1_1sha__t-members.html +++ b/unionstdex_1_1sha__t-members.html @@ -91,7 +91,7 @@ $(function() {
diff --git a/unionstdex_1_1sha__t.html b/unionstdex_1_1sha__t.html index 5606e9955..1e640c2e3 100644 --- a/unionstdex_1_1sha__t.html +++ b/unionstdex_1_1sha__t.html @@ -125,7 +125,7 @@ Friends
diff --git a/uuid_8hpp_source.html b/uuid_8hpp_source.html index 0bb461c17..82c7bbd11 100644 --- a/uuid_8hpp_source.html +++ b/uuid_8hpp_source.html @@ -147,7 +147,7 @@ $(function() { codefold.init(0); });
diff --git a/vector__queue_8hpp_source.html b/vector__queue_8hpp_source.html index be6fca83d..9af7032b6 100644 --- a/vector__queue_8hpp_source.html +++ b/vector__queue_8hpp_source.html @@ -454,7 +454,7 @@ $(function() { codefold.init(0); });
diff --git a/watchdog_8hpp_source.html b/watchdog_8hpp_source.html index fcfccb4bb..61f6576d9 100644 --- a/watchdog_8hpp_source.html +++ b/watchdog_8hpp_source.html @@ -188,7 +188,7 @@ $(function() { codefold.init(0); });
diff --git a/wav_8hpp_source.html b/wav_8hpp_source.html index 45847aa3f..4a28f47d7 100644 --- a/wav_8hpp_source.html +++ b/wav_8hpp_source.html @@ -720,12 +720,12 @@ $(function() { codefold.init(0); });
Basic seekable stream operations.
Definition stream.hpp:817
‍UTF-8 byte-order-mark
Definition stream.hpp:84
Limits file reading/writing to a predefined window.
Definition stream.hpp:1694
-
In-memory file.
Definition stream.hpp:3220
-
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3922
-
size_t write_stream(basic &stream, size_t amount=SIZE_MAX)
Writes content of another stream.
Definition stream.hpp:3837
-
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3901
-
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3927
-
const void * data() const
Returns pointer to data.
Definition stream.hpp:3550
+
In-memory file.
Definition stream.hpp:3221
+
virtual fsize_t size() const
Returns file size Should the file size cannot be determined, the method returns fsize_max and it does...
Definition stream.hpp:3923
+
size_t write_stream(basic &stream, size_t amount=SIZE_MAX)
Writes content of another stream.
Definition stream.hpp:3838
+
virtual fpos_t seek(foff_t offset, seek_t how=seek_t::beg)
Seeks to specified relative file position.
Definition stream.hpp:3902
+
virtual void truncate()
Sets file size - truncates the remainder of file content from the current file position to the end of...
Definition stream.hpp:3928
+
const void * data() const
Returns pointer to data.
Definition stream.hpp:3551
Extended cue.
Definition wav.hpp:397
uint32_t duration
How many samples from the cue point the region or section spans.
Definition wav.hpp:398
std::string note
Note text.
Definition wav.hpp:406
@@ -789,7 +789,7 @@ $(function() { codefold.init(0); });
diff --git a/windows_8h_source.html b/windows_8h_source.html index 3a521a76e..6635fbb22 100644 --- a/windows_8h_source.html +++ b/windows_8h_source.html @@ -111,7 +111,7 @@ $(function() { codefold.init(0); });
diff --git a/zlib_8hpp_source.html b/zlib_8hpp_source.html index 71efc766e..29755a4fa 100644 --- a/zlib_8hpp_source.html +++ b/zlib_8hpp_source.html @@ -275,7 +275,7 @@ $(function() { codefold.init(0); });