Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
72bab6d6b2
commit
2440e5baca
@ -2647,7 +2647,7 @@ namespace stdex
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
const document<_Elem, _Traits, _Alloc>& m_document; ///< Document being analyzed
|
const document<_Elem, _Traits, _Alloc>& m_document; ///< Document being analyzed
|
||||||
const stdex::sys_string m_url; ///< Absolute document URL
|
const stdex::sstring m_url; ///< Absolute document URL
|
||||||
const bool m_parse_frames; ///< Parse frames
|
const bool m_parse_frames; ///< Parse frames
|
||||||
stdex::progress<size_t>* m_progress; ///< Progress indicator
|
stdex::progress<size_t>* m_progress; ///< Progress indicator
|
||||||
const _Elem* m_source; ///< HTML source code
|
const _Elem* m_source; ///< HTML source code
|
||||||
|
@ -75,8 +75,6 @@ namespace stdex
|
|||||||
constexpr int sgml_sgml = sgml_amp | sgml_lt_gt;
|
constexpr int sgml_sgml = sgml_amp | sgml_lt_gt;
|
||||||
constexpr int sgml_ml_attrib = sgml_amp | sgml_quot_apos;
|
constexpr int sgml_ml_attrib = sgml_amp | sgml_quot_apos;
|
||||||
constexpr int sgml_c = sgml_amp | sgml_bsol | sgml_quot_apos;
|
constexpr int sgml_c = sgml_amp | sgml_bsol | sgml_quot_apos;
|
||||||
// constexpr int sgml_ajt_lemma = sgml_amp | sgml_quot | sgml_dollar | sgml_percnt;
|
|
||||||
// constexpr int sgml_ajt_form = sgml_ajt_lemma;
|
|
||||||
// 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;
|
// 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;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -455,7 +453,7 @@ namespace stdex
|
|||||||
inline void str2sgmlcat(
|
inline void str2sgmlcat(
|
||||||
_Inout_ std::string& dst,
|
_Inout_ std::string& dst,
|
||||||
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
_Assume_(src || !count_src);
|
_Assume_(src || !count_src);
|
||||||
|
|
||||||
@ -557,7 +555,7 @@ namespace stdex
|
|||||||
inline void str2sgmlcat(
|
inline void str2sgmlcat(
|
||||||
_Inout_ std::string& dst,
|
_Inout_ std::string& dst,
|
||||||
_In_ const std::wstring& src,
|
_In_ const std::wstring& src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
str2sgmlcat(dst, src.c_str(), src.size(), what);
|
str2sgmlcat(dst, src.c_str(), src.size(), what);
|
||||||
}
|
}
|
||||||
@ -576,7 +574,7 @@ namespace stdex
|
|||||||
inline size_t str2sgmlcat(
|
inline size_t str2sgmlcat(
|
||||||
_Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
|
_Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
|
||||||
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
_Assume_(dst || !count_dst);
|
_Assume_(dst || !count_dst);
|
||||||
_Assume_(src || !count_src);
|
_Assume_(src || !count_src);
|
||||||
@ -705,7 +703,7 @@ namespace stdex
|
|||||||
inline void str2sgmlcpy(
|
inline void str2sgmlcpy(
|
||||||
_Inout_ std::string& dst,
|
_Inout_ std::string& dst,
|
||||||
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
dst.clear();
|
dst.clear();
|
||||||
str2sgmlcat(dst, src, count_src, what);
|
str2sgmlcat(dst, src, count_src, what);
|
||||||
@ -721,7 +719,7 @@ namespace stdex
|
|||||||
inline void str2sgmlcpy(
|
inline void str2sgmlcpy(
|
||||||
_Inout_ std::string& dst,
|
_Inout_ std::string& dst,
|
||||||
_In_ const std::wstring& src,
|
_In_ const std::wstring& src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
str2sgmlcpy(dst, src.data(), src.size(), what);
|
str2sgmlcpy(dst, src.data(), src.size(), what);
|
||||||
}
|
}
|
||||||
@ -740,7 +738,7 @@ namespace stdex
|
|||||||
inline size_t str2sgmlcpy(
|
inline size_t str2sgmlcpy(
|
||||||
_Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
|
_Inout_cap_(count_dst) char* dst, _In_ size_t count_dst,
|
||||||
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
_Assume_(dst || !count_dst);
|
_Assume_(dst || !count_dst);
|
||||||
if (count_dst)
|
if (count_dst)
|
||||||
@ -759,7 +757,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
inline std::string str2sgml(
|
inline std::string str2sgml(
|
||||||
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
_In_reads_or_z_opt_(count_src) const wchar_t* src, _In_ size_t count_src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
std::string dst;
|
std::string dst;
|
||||||
str2sgmlcat(dst, src, count_src, what);
|
str2sgmlcat(dst, src, count_src, what);
|
||||||
@ -776,7 +774,7 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
inline std::string str2sgml(
|
inline std::string str2sgml(
|
||||||
_In_ const std::wstring& src,
|
_In_ const std::wstring& src,
|
||||||
_In_ size_t what = 0)
|
_In_ int what = 0)
|
||||||
{
|
{
|
||||||
return str2sgml(src.c_str(), src.size(), what);
|
return str2sgml(src.c_str(), src.size(), what);
|
||||||
}
|
}
|
||||||
|
@ -302,39 +302,27 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
/// \return Number of read characters
|
/// \return Number of read characters
|
||||||
///
|
///
|
||||||
template<class _Traits = std::char_traits<char>, class _Ax = std::allocator<char>>
|
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
|
||||||
inline size_t readln(_Inout_ std::basic_string<char, _Traits, _Ax>& str)
|
inline size_t readln(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& str)
|
||||||
{
|
{
|
||||||
str.clear();
|
str.clear();
|
||||||
return readln_and_attach(str);
|
return readln_and_attach(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
/// Reads stream to the end-of-line or end-of-file.
|
|
||||||
///
|
|
||||||
/// \return Number of read characters
|
|
||||||
///
|
|
||||||
template<class _Traits = std::char_traits<wchar_t>, class _Ax = std::allocator<wchar_t>>
|
|
||||||
inline size_t readln(_Inout_ std::basic_string<wchar_t, _Traits, _Ax>& wstr)
|
|
||||||
{
|
|
||||||
wstr.clear();
|
|
||||||
return readln_and_attach(wstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Reads stream to the end-of-line or end-of-file.
|
/// Reads stream to the end-of-line or end-of-file.
|
||||||
///
|
///
|
||||||
/// \return Number of read characters
|
/// \return Number of read characters
|
||||||
///
|
///
|
||||||
template<class T_from, class T_to, class _Traits = std::char_traits<T_to>, class _Ax = std::allocator<T_to>>
|
template<class T_from, class T_to, class _Traits = std::char_traits<T_to>, class _Ax = std::allocator<T_to>>
|
||||||
size_t readln(_Inout_ std::basic_string<T_to, _Traits, _Ax>& wstr, _In_ charset_encoder<T_from, T_to>& encoder)
|
size_t readln(_Inout_ std::basic_string<T_to, _Traits, _Ax>& str, _In_ charset_encoder<T_from, T_to>& encoder)
|
||||||
{
|
{
|
||||||
if (encoder.from_encoding() == encoder.to_encoding())
|
if (encoder.from_encoding() == encoder.to_encoding())
|
||||||
return readln(wstr);
|
return readln(str);
|
||||||
std::string str;
|
std::basic_string<T_from> tmp;
|
||||||
readln_and_attach(str);
|
readln_and_attach(tmp);
|
||||||
encoder.strcpy(wstr, str);
|
encoder.strcpy(str, tmp);
|
||||||
return wstr.size();
|
return str.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -364,14 +352,14 @@ namespace stdex
|
|||||||
/// \return Total number of chars in str
|
/// \return Total number of chars in str
|
||||||
///
|
///
|
||||||
template<class T_from, class T_to, class _Traits = std::char_traits<T_to>, class _Ax = std::allocator<T_to>>
|
template<class T_from, class T_to, class _Traits = std::char_traits<T_to>, class _Ax = std::allocator<T_to>>
|
||||||
size_t readln_and_attach(_Inout_ std::basic_string<T_to, _Traits, _Ax>& wstr, _In_ charset_encoder<T_from, T_to>& encoder)
|
size_t readln_and_attach(_Inout_ std::basic_string<T_to, _Traits, _Ax>& str, _In_ charset_encoder<T_from, T_to>& encoder)
|
||||||
{
|
{
|
||||||
if (encoder.from_encoding() == encoder.to_encoding())
|
if (encoder.from_encoding() == encoder.to_encoding())
|
||||||
return readln_and_attach(wstr);
|
return readln_and_attach(str);
|
||||||
std::string str;
|
std::basic_string<T_from> tmp;
|
||||||
readln_and_attach(str);
|
readln_and_attach(tmp);
|
||||||
encoder.strcat(wstr, str);
|
encoder.strcat(str, tmp);
|
||||||
return wstr.size();
|
return str.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -405,61 +393,61 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
/// Writes array of characters to the stream
|
/// Writes array of characters to the stream
|
||||||
///
|
///
|
||||||
/// \param[in] wstr String to write. Must be zero-terminated.
|
/// \param[in] str String to write. Must be zero-terminated.
|
||||||
/// \param[in] encoder Encoder for encoding string
|
/// \param[in] encoder Encoder for encoding string
|
||||||
///
|
///
|
||||||
/// \return Number of code units written
|
/// \return Number of code units written
|
||||||
///
|
///
|
||||||
template <class T_from, class T_to>
|
template <class T_from, class T_to>
|
||||||
size_t write_array(_In_z_ const T_from* wstr, _In_ charset_encoder<T_from, T_to>& encoder)
|
size_t write_array(_In_z_ const T_from* str, _In_ charset_encoder<T_from, T_to>& encoder)
|
||||||
{
|
{
|
||||||
if (!ok()) _Unlikely_
|
if (!ok()) _Unlikely_
|
||||||
return 0;
|
return 0;
|
||||||
size_t num_chars = stdex::strlen(wstr);
|
size_t num_chars = stdex::strlen(str);
|
||||||
if (encoder.from_encoding() == encoder.to_encoding())
|
if (encoder.from_encoding() == encoder.to_encoding())
|
||||||
return write_array(wstr, sizeof(T_from), num_chars);
|
return write_array(str, sizeof(T_from), num_chars);
|
||||||
std::basic_string<T_to> str(encoder.convert(wstr, num_chars));
|
std::basic_string<T_to> tmp(encoder.convert(str, num_chars));
|
||||||
return write_array(str.data(), sizeof(T_to), str.size());
|
return write_array(tmp.data(), sizeof(T_to), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Writes array of characters to the stream
|
/// Writes array of characters to the stream
|
||||||
///
|
///
|
||||||
/// \param[in] wstr String to write
|
/// \param[in] str String to write
|
||||||
/// \param[in] num_chars String code unit count limit
|
/// \param[in] num_chars String code unit count limit
|
||||||
/// \param[in] encoder Encoder for encoding string
|
/// \param[in] encoder Encoder for encoding string
|
||||||
///
|
///
|
||||||
/// \return Number of code units written
|
/// \return Number of code units written
|
||||||
///
|
///
|
||||||
template <class T_from, class T_to>
|
template <class T_from, class T_to>
|
||||||
size_t write_array(_In_reads_or_z_opt_(num_chars) const T_from* wstr, _In_ size_t num_chars, _In_ charset_encoder<T_from, T_to>& encoder)
|
size_t write_array(_In_reads_or_z_opt_(num_chars) const T_from* str, _In_ size_t num_chars, _In_ charset_encoder<T_from, T_to>& encoder)
|
||||||
{
|
{
|
||||||
if (!ok()) _Unlikely_
|
if (!ok()) _Unlikely_
|
||||||
return 0;
|
return 0;
|
||||||
num_chars = stdex::strnlen(wstr, num_chars);
|
num_chars = stdex::strnlen(str, num_chars);
|
||||||
if (encoder.from_encoding() == encoder.to_encoding())
|
if (encoder.from_encoding() == encoder.to_encoding())
|
||||||
return write_array(wstr, sizeof(T_from), num_chars);
|
return write_array(str, sizeof(T_from), num_chars);
|
||||||
std::basic_string<T_to> str(encoder.convert(wstr, num_chars));
|
std::basic_string<T_to> tmp(encoder.convert(str, num_chars));
|
||||||
return write_array(str.data(), sizeof(T_to), str.size());
|
return write_array(tmp.data(), sizeof(T_to), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Writes array of characters to the stream
|
/// Writes array of characters to the stream
|
||||||
///
|
///
|
||||||
/// \param[in] wstr String to write
|
/// \param[in] str String to write
|
||||||
/// \param[in] encoder Encoder for encoding string
|
/// \param[in] encoder Encoder for encoding string
|
||||||
///
|
///
|
||||||
/// \return Number of code units written
|
/// \return Number of code units written
|
||||||
///
|
///
|
||||||
template<class T_from, class T_to, class _Traits = std::char_traits<T_from>, class _Ax = std::allocator<T_from>>
|
template<class T_from, class T_to, class _Traits = std::char_traits<T_from>, class _Ax = std::allocator<T_from>>
|
||||||
size_t write_array(_In_ const std::basic_string<T_from, _Traits, _Ax>& wstr, _In_ charset_encoder<T_from, T_to>& encoder)
|
size_t write_array(_In_ const std::basic_string<T_from, _Traits, _Ax>& str, _In_ charset_encoder<T_from, T_to>& encoder)
|
||||||
{
|
{
|
||||||
if (!ok()) _Unlikely_
|
if (!ok()) _Unlikely_
|
||||||
return 0;
|
return 0;
|
||||||
if (encoder.from_encoding() == encoder.to_encoding())
|
if (encoder.from_encoding() == encoder.to_encoding())
|
||||||
return write_array(wstr.data(), sizeof(T_from), wstr.size());
|
return write_array(str.data(), sizeof(T_from), str.size());
|
||||||
std::basic_string<T_to> str(encoder.convert(wstr));
|
std::basic_string<T_to> tmp(encoder.convert(str));
|
||||||
return write_array(str.data(), sizeof(T_to), str.size());
|
return write_array(tmp.data(), sizeof(T_to), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -636,10 +624,10 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const char* format, _In_opt_ locale_t locale, _In_ va_list params)
|
size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const char* format, _In_opt_ locale_t locale, _In_ va_list params)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string tmp;
|
||||||
str.reserve(default_block_size);
|
tmp.reserve(default_block_size);
|
||||||
vappendf(str, format, locale, params);
|
vappendf(tmp, format, locale, params);
|
||||||
return write_array(str.data(), sizeof(char), str.size());
|
return write_array(tmp.data(), sizeof(char), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -649,10 +637,10 @@ namespace stdex
|
|||||||
///
|
///
|
||||||
size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const wchar_t* format, _In_opt_ locale_t locale, _In_ va_list params)
|
size_t write_vsprintf(_In_z_ _Printf_format_string_params_(2) const wchar_t* format, _In_opt_ locale_t locale, _In_ va_list params)
|
||||||
{
|
{
|
||||||
std::wstring str;
|
std::wstring tmp;
|
||||||
str.reserve(default_block_size);
|
tmp.reserve(default_block_size);
|
||||||
vappendf(str, format, locale, params);
|
vappendf(tmp, format, locale, params);
|
||||||
return write_array(str.data(), sizeof(wchar_t), str.size());
|
return write_array(tmp.data(), sizeof(wchar_t), tmp.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline basic& operator >>(_Out_ int8_t& data) { return read_data(data); }
|
inline basic& operator >>(_Out_ int8_t& data) { return read_data(data); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user