Trim excessive inline

Methods and templates are implicitly marked as inline already.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-12-11 11:33:27 +01:00
parent 7eba65813e
commit 2e65d0351c
16 changed files with 279 additions and 279 deletions

View File

@ -28,14 +28,14 @@ namespace Assert
} }
template <class T> template <class T>
inline void AreEqual(const T& a, const T& b) void AreEqual(const T& a, const T& b)
{ {
if (!(a == b)) if (!(a == b))
throw std::runtime_error("not equal"); throw std::runtime_error("not equal");
} }
template <class T, size_t N> template <class T, size_t N>
inline void AreEqual(const T (&a)[N], const T (&b)[N]) void AreEqual(const T (&a)[N], const T (&b)[N])
{ {
for (size_t i = 0; i < N; ++i) for (size_t i = 0; i < N; ++i)
if (!(a[i] == b[i])) if (!(a[i] == b[i]))
@ -55,7 +55,7 @@ namespace Assert
} }
template <class T> template <class T>
inline void AreNotEqual(const T& a, const T& b) void AreNotEqual(const T& a, const T& b)
{ {
if (a == b) if (a == b)
throw std::runtime_error("equal"); throw std::runtime_error("equal");
@ -74,7 +74,7 @@ namespace Assert
} }
template <class E, typename F> template <class E, typename F>
inline void ExpectException(F functor) void ExpectException(F functor)
{ {
try { functor(); } try { functor(); }
catch (const E&) { return; } catch (const E&) { return; }

View File

@ -45,17 +45,17 @@ namespace stdex
/// ///
/// Returns size of the hash value in bytes /// Returns size of the hash value in bytes
/// ///
static inline size_t size() { return sizeof(T); } static size_t size() { return sizeof(T); }
/// ///
/// Returns hash value /// Returns hash value
/// ///
inline const T& data() { return m_value; }; const T& data() { return m_value; };
/// ///
/// Returns hash value /// Returns hash value
/// ///
inline operator const T&() const { return m_value; }; operator const T&() const { return m_value; };
protected: protected:
T m_value; T m_value;
@ -259,7 +259,7 @@ namespace stdex
uint8_t data8[16]; uint8_t data8[16];
uint32_t data32[4]; uint32_t data32[4];
inline bool operator !=(_In_ const stdex::md2_t& other) const bool operator !=(_In_ const stdex::md2_t& other) const
{ {
return return
(data32[0] ^ other.data32[0]) | (data32[0] ^ other.data32[0]) |
@ -268,7 +268,7 @@ namespace stdex
(data32[3] ^ other.data32[3]); (data32[3] ^ other.data32[3]);
} }
inline bool operator ==(_In_ const stdex::md2_t& other) const bool operator ==(_In_ const stdex::md2_t& other) const
{ {
return !operator !=(other); return !operator !=(other);
} }
@ -459,7 +459,7 @@ namespace stdex
uint8_t data8[20]; uint8_t data8[20];
uint32_t data32[5]; uint32_t data32[5];
inline bool operator !=(_In_ const stdex::sha_t& other) const bool operator !=(_In_ const stdex::sha_t& other) const
{ {
return return
(data32[0] ^ other.data32[0]) | (data32[0] ^ other.data32[0]) |
@ -469,7 +469,7 @@ namespace stdex
(data32[4] ^ other.data32[4]); (data32[4] ^ other.data32[4]);
} }
inline bool operator ==(_In_ const stdex::sha_t& other) const bool operator ==(_In_ const stdex::sha_t& other) const
{ {
return !operator !=(other); return !operator !=(other);
} }
@ -608,7 +608,7 @@ namespace stdex
uint8_t data8[32]; uint8_t data8[32];
uint32_t data32[8]; uint32_t data32[8];
inline bool operator !=(_In_ const stdex::sha256_t& other) const bool operator !=(_In_ const stdex::sha256_t& other) const
{ {
return return
(data32[0] ^ other.data32[0]) | (data32[0] ^ other.data32[0]) |
@ -621,7 +621,7 @@ namespace stdex
(data32[7] ^ other.data32[7]); (data32[7] ^ other.data32[7]);
} }
inline bool operator ==(_In_ const stdex::sha256_t& other) const bool operator ==(_In_ const stdex::sha256_t& other) const
{ {
return !operator !=(other); return !operator !=(other);
} }

View File

@ -38,7 +38,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void escape( void escape(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars)
{ {
@ -65,7 +65,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline void escape( void escape(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const wchar_t* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const wchar_t* src, _In_ size_t num_chars)
{ {
@ -91,7 +91,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>> template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>>
inline void escape( void escape(
_Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst,
_In_ const _Elem (&src)[_Size]) _In_ const _Elem (&src)[_Size])
{ {
@ -105,7 +105,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>> template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>>
inline void escape( void escape(
_Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src)
{ {
@ -119,7 +119,7 @@ namespace stdex
/// \param[in] chr Source character /// \param[in] chr Source character
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void escape_min(_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _In_ char chr) void escape_min(_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _In_ char chr)
{ {
switch (chr) { switch (chr) {
case '&': dst += "&amp;"; break; case '&': dst += "&amp;"; break;
@ -137,7 +137,7 @@ namespace stdex
/// \param[in] chr Source character /// \param[in] chr Source character
/// ///
template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline void escape_min(_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _In_ wchar_t chr) void escape_min(_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _In_ wchar_t chr)
{ {
switch (chr) { switch (chr) {
case L'&': dst += L"&amp;"; break; case L'&': dst += L"&amp;"; break;
@ -156,7 +156,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void escape_min( void escape_min(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars)
{ {
@ -180,7 +180,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline void escape_min( void escape_min(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const wchar_t* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const wchar_t* src, _In_ size_t num_chars)
{ {
@ -203,7 +203,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>> template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>>
inline void escape_min( void escape_min(
_Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst,
_In_ const _Elem (&src)[_Size]) _In_ const _Elem (&src)[_Size])
{ {
@ -217,7 +217,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>> template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>>
inline void escape_min( void escape_min(
_Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src)
{ {
@ -232,7 +232,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void url_unescape( void url_unescape(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars)
{ {
@ -273,7 +273,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<size_t _Size, class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<size_t _Size, class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void url_unescape( void url_unescape(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_ const char (&src)[_Size]) _In_ const char (&src)[_Size])
{ {
@ -287,7 +287,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Traits_dst = std::char_traits<char>, class _Alloc_dst = std::allocator<char>, class _Traits_src = std::char_traits<char>, class _Alloc_src = std::allocator<char>> template<class _Traits_dst = std::char_traits<char>, class _Alloc_dst = std::allocator<char>, class _Traits_src = std::char_traits<char>, class _Alloc_src = std::allocator<char>>
inline void url_unescape( void url_unescape(
_Inout_ std::basic_string<char, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<char, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<char, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<char, _Traits_src, _Alloc_src>& src)
{ {
@ -302,7 +302,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void url_escape( void url_escape(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars)
{ {
@ -352,7 +352,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<size_t _Size, class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<size_t _Size, class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void url_escape( void url_escape(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_ const char (&src)[_Size]) _In_ const char (&src)[_Size])
{ {
@ -366,7 +366,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Traits_dst = std::char_traits<char>, class _Alloc_dst = std::allocator<char>, class _Traits_src = std::char_traits<char>, class _Alloc_src = std::allocator<char>> template<class _Traits_dst = std::char_traits<char>, class _Alloc_dst = std::allocator<char>, class _Traits_src = std::char_traits<char>, class _Alloc_src = std::allocator<char>>
inline void url_escape( void url_escape(
_Inout_ std::basic_string<char, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<char, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<char, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<char, _Traits_src, _Alloc_src>& src)
{ {
@ -381,7 +381,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>>
inline void css_unescape( void css_unescape(
_Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const _Elem* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const _Elem* src, _In_ size_t num_chars)
{ {
@ -450,7 +450,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>> template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>>
inline void css_unescape( void css_unescape(
_Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst,
_In_ const _Elem (&src)[_Size]) _In_ const _Elem (&src)[_Size])
{ {
@ -464,7 +464,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>> template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>>
inline void css_unescape( void css_unescape(
_Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src)
{ {
@ -479,7 +479,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline void css_escape( void css_escape(
_Inout_ std::basic_string<char, _Traits, _Alloc>& dst, _Inout_ std::basic_string<char, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const char* src, _In_ size_t num_chars)
{ {
@ -505,7 +505,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in string `src` /// \param[in] num_chars Code unit limit in string `src`
/// ///
template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline void css_escape( void css_escape(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst,
_In_reads_or_z_opt_(num_chars) const wchar_t* src, _In_ size_t num_chars) _In_reads_or_z_opt_(num_chars) const wchar_t* src, _In_ size_t num_chars)
{ {
@ -530,7 +530,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>> template<class _Elem, size_t _Size, class _Traits = std::char_traits<_Elem>, class _Alloc = std::allocator<_Elem>>
inline void css_escape( void css_escape(
_Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& dst,
_In_ const _Elem (&src)[_Size]) _In_ const _Elem (&src)[_Size])
{ {
@ -544,7 +544,7 @@ namespace stdex
/// \param[in] src Source string /// \param[in] src Source string
/// ///
template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>> template<class _Elem, class _Traits_dst = std::char_traits<_Elem>, class _Alloc_dst = std::allocator<_Elem>, class _Traits_src = std::char_traits<_Elem>, class _Alloc_src = std::allocator<_Elem>>
inline void css_escape( void css_escape(
_Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<_Elem, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<_Elem, _Traits_src, _Alloc_src>& src)
{ {
@ -686,7 +686,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline element_span_t span(_In_ element_t code) static element_span_t span(_In_ element_t code)
{ {
static element_span_t lookup[] = { static element_span_t lookup[] = {
element_span_t::needs_end, // a element_span_t::needs_end, // a
@ -805,7 +805,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_fontstyle(_In_ element_t code) static bool is_fontstyle(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::tt: case element_t::tt:
@ -827,7 +827,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_phrase(_In_ element_t code) static bool is_phrase(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::em: case element_t::em:
@ -851,7 +851,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_special(_In_ element_t code) static bool is_special(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::a: case element_t::a:
@ -884,7 +884,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_formctrl(_In_ element_t code) static bool is_formctrl(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::input: case element_t::input:
@ -902,7 +902,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_inline(_In_ element_t code) static bool is_inline(_In_ element_t code)
{ {
return return
code == element_t::PCDATA || code == element_t::PCDATA ||
@ -917,7 +917,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_heading(_In_ element_t code) static bool is_heading(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::h1: case element_t::h1:
@ -936,7 +936,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_list(_In_ element_t code) static bool is_list(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::ul: case element_t::ul:
@ -953,7 +953,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_preformatted(_In_ element_t code) static bool is_preformatted(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::pre: case element_t::pre:
@ -968,7 +968,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_block(_In_ element_t code) static bool is_block(_In_ element_t code)
{ {
if (is_heading(code) || if (is_heading(code) ||
is_list(code) || is_list(code) ||
@ -999,7 +999,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_flow(_In_ element_t code) static bool is_flow(_In_ element_t code)
{ {
return is_block(code) || is_inline(code); return is_block(code) || is_inline(code);
} }
@ -1009,7 +1009,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_head_content(_In_ element_t code) static bool is_head_content(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::title: case element_t::title:
@ -1026,7 +1026,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_head_misc(_In_ element_t code) static bool is_head_misc(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::script: case element_t::script:
@ -1044,7 +1044,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_pre_exclusion(_In_ element_t code) static bool is_pre_exclusion(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::img: case element_t::img:
@ -1069,7 +1069,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_html_content(_In_ element_t code) static bool is_html_content(_In_ element_t code)
{ {
switch (code) { switch (code) {
case element_t::head: case element_t::head:
@ -1085,7 +1085,7 @@ namespace stdex
/// ///
/// \param[in] code Element code /// \param[in] code Element code
/// ///
static inline bool is_group(_In_ element_t code) static bool is_group(_In_ element_t code)
{ {
if (is_block(code) || if (is_block(code) ||
is_html_content(code) || is_html_content(code) ||
@ -1115,7 +1115,7 @@ namespace stdex
/// ///
/// \returns `true` if `child` may nest in `parent`; `false` otherwise /// \returns `true` if `child` may nest in `parent`; `false` otherwise
/// ///
static inline bool may_contain(_In_ element_t parent, _In_ element_t child) static bool may_contain(_In_ element_t parent, _In_ element_t child)
{ {
if (child == element_t::unknown || child == element_t::comment) if (child == element_t::unknown || child == element_t::comment)
return true; return true;
@ -1215,7 +1215,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in `attr_name` /// \param[in] num_chars Code unit limit in `attr_name`
/// ///
template <class T> template <class T>
static inline bool is_uri(_In_ element_t code, _In_reads_or_z_opt_(num_chars) const T* attr_name, _In_ size_t num_chars) static bool is_uri(_In_ element_t code, _In_reads_or_z_opt_(num_chars) const T* attr_name, _In_ size_t num_chars)
{ {
_Assume_(attr_name || !num_chars); _Assume_(attr_name || !num_chars);
switch (code) { switch (code) {
@ -1270,7 +1270,7 @@ namespace stdex
/// \param[in] num_chars Code unit limit in `attr_name` /// \param[in] num_chars Code unit limit in `attr_name`
/// ///
template <class T> template <class T>
static inline bool is_localizable(element_t code, const T* attr_name, size_t num_chars) static bool is_localizable(element_t code, const T* attr_name, size_t num_chars)
{ {
_Assume_(attr_name || !num_chars); _Assume_(attr_name || !num_chars);
if (!stdex::strnicmp(attr_name, num_chars, "title", SIZE_MAX)) if (!stdex::strnicmp(attr_name, num_chars, "title", SIZE_MAX))
@ -1318,7 +1318,7 @@ namespace stdex
{ {
public: public:
template <class T> template <class T>
inline element(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_z_ const T* src, _In_opt_ sequence* parent = nullptr) : element(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_z_ const T* src, _In_opt_ sequence* parent = nullptr) :
sequence(tag.type, tag.interval.start, tag.interval.end, parent), sequence(tag.type, tag.interval.start, tag.interval.end, parent),
code(element_code(src + tag.name.start, tag.name.size())), code(element_code(src + tag.name.start, tag.name.size())),
name(std::move(tag.name)), name(std::move(tag.name)),
@ -1497,7 +1497,7 @@ namespace stdex
{ {
public: public:
template <class T> template <class T>
inline element_start(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_z_ const T* src, _In_opt_ sequence* parent = nullptr, _In_opt_ sequence* _end = nullptr) : element_start(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_z_ const T* src, _In_opt_ sequence* parent = nullptr, _In_opt_ sequence* _end = nullptr) :
element(std::move(tag), src, parent), element(std::move(tag), src, parent),
end(_end) end(_end)
{} {}
@ -1513,7 +1513,7 @@ namespace stdex
{ {
public: public:
template <class T> template <class T>
inline element_end(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_z_ const T* src, _In_opt_ sequence* parent = nullptr, _In_opt_ element_start* _start = nullptr) : element_end(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_z_ const T* src, _In_opt_ sequence* parent = nullptr, _In_opt_ element_start* _start = nullptr) :
sequence(tag.type, tag.interval.start, tag.interval.end, parent), sequence(tag.type, tag.interval.start, tag.interval.end, parent),
code(element::element_code(src + tag.name.start, tag.name.size())), code(element::element_code(src + tag.name.start, tag.name.size())),
name(std::move(tag.name)), name(std::move(tag.name)),
@ -1533,7 +1533,7 @@ namespace stdex
{ {
public: public:
template <class T> template <class T>
inline declaration(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_opt_ sequence* parent = nullptr) : declaration(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_opt_ sequence* parent = nullptr) :
sequence(tag.type, tag.interval.start, tag.interval.end, parent), sequence(tag.type, tag.interval.start, tag.interval.end, parent),
name(std::move(tag.name)), name(std::move(tag.name)),
attributes(std::move(tag.attributes)) attributes(std::move(tag.attributes))
@ -1551,7 +1551,7 @@ namespace stdex
{ {
public: public:
template <class T> template <class T>
inline comment(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_opt_ sequence* parent = nullptr) : comment(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_opt_ sequence* parent = nullptr) :
sequence(tag.type, tag.interval.start, tag.interval.end, parent), sequence(tag.type, tag.interval.start, tag.interval.end, parent),
content(std::move(tag.name)) content(std::move(tag.name))
{} {}
@ -1567,7 +1567,7 @@ namespace stdex
{ {
public: public:
template <class T> template <class T>
inline instruction(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_opt_ sequence* parent = nullptr) : instruction(_Inout_ stdex::parser::basic_html_tag<T>&& tag, _In_opt_ sequence* parent = nullptr) :
sequence(tag.type, tag.interval.start, tag.interval.end, parent), sequence(tag.type, tag.interval.start, tag.interval.end, parent),
content(std::move(tag.name)) content(std::move(tag.name))
{} {}
@ -1860,7 +1860,7 @@ namespace stdex
/// ///
/// Parses HTML document source code /// Parses HTML document source code
/// ///
inline void assign(_In_reads_or_z_opt_(num_chars) const _Elem* source, _In_ size_t num_chars) void assign(_In_reads_or_z_opt_(num_chars) const _Elem* source, _In_ size_t num_chars)
{ {
clear(); clear();
append(source, num_chars); append(source, num_chars);
@ -1870,7 +1870,7 @@ namespace stdex
/// ///
/// Returns document HTML source code /// Returns document HTML source code
/// ///
inline const std::basic_string<_Elem, _Traits, _Alloc>& source() const { return m_source; } const std::basic_string<_Elem, _Traits, _Alloc>& source() const { return m_source; }
friend class parser<_Elem, _Traits, _Alloc>; friend class parser<_Elem, _Traits, _Alloc>;
@ -1878,7 +1878,7 @@ namespace stdex
/// ///
/// Returns starting tag of currently active element or nullptr if no element is known to be started. /// Returns starting tag of currently active element or nullptr if no element is known to be started.
/// ///
inline element_start* active_element() const element_start* active_element() const
{ {
return m_element_stack.empty() ? nullptr : m_element_stack.back(); return m_element_stack.empty() ? nullptr : m_element_stack.back();
} }
@ -1973,7 +1973,7 @@ namespace stdex
class token class token
{ {
protected: protected:
inline token(_In_ token_t _type = token_t::root, _In_opt_ sequence* _sequence = nullptr, _In_ uintptr_t _data = 0) : token(_In_ token_t _type = token_t::root, _In_opt_ sequence* _sequence = nullptr, _In_ uintptr_t _data = 0) :
type(_type), type(_type),
sequence(_sequence), sequence(_sequence),
data(_data) data(_data)
@ -1993,7 +1993,7 @@ namespace stdex
/// \returns Number of code units appended /// \returns Number of code units appended
/// ///
template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template<class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline size_t append_tag(_Inout_ std::basic_string<char, _Traits, _Alloc>& str) const size_t append_tag(_Inout_ std::basic_string<char, _Traits, _Alloc>& str) const
{ {
size_t n = str.size(); size_t n = str.size();
// Use %X instead of %p to ommit leading zeros and save space. // Use %X instead of %p to ommit leading zeros and save space.
@ -2009,14 +2009,14 @@ namespace stdex
/// \returns Number of code units appended /// \returns Number of code units appended
/// ///
template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template<class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline size_t append_tag(_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& str) const size_t append_tag(_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& str) const
{ {
// Use %X instead of %p to ommit leading zeros and save space. // Use %X instead of %p to ommit leading zeros and save space.
return stdex::appendf(str, L"%c%zX%c", stdex::locale_C.get(), static_cast<wchar_t>(token_tag_start), reinterpret_cast<uintptr_t>(this), static_cast<wchar_t>(token_tag_end)); return stdex::appendf(str, L"%c%zX%c", stdex::locale_C.get(), static_cast<wchar_t>(token_tag_start), reinterpret_cast<uintptr_t>(this), static_cast<wchar_t>(token_tag_end));
} }
template<class T> template<class T>
static inline token* parse_tag(const T* str, size_t& offset) static token* parse_tag(const T* str, size_t& offset)
{ {
if (str[offset] != static_cast<T>(token_tag_start)) if (str[offset] != static_cast<T>(token_tag_start))
return nullptr; return nullptr;
@ -2064,7 +2064,7 @@ namespace stdex
class text_token : public token class text_token : public token
{ {
protected: protected:
inline text_token( text_token(
_In_ token_t type = token_t::complete, _In_ token_t type = token_t::complete,
_In_reads_or_z_opt_(num_chars) const _Elem* _text = nullptr, _In_ size_t num_chars = 0, _In_reads_or_z_opt_(num_chars) const _Elem* _text = nullptr, _In_ size_t num_chars = 0,
_In_ uint32_t _text_type = 0, _In_ uint32_t _text_type = 0,
@ -2089,7 +2089,7 @@ namespace stdex
class starting_token : public text_token<_Elem, _Traits, _Alloc> class starting_token : public text_token<_Elem, _Traits, _Alloc>
{ {
protected: protected:
inline starting_token( starting_token(
_In_reads_or_z_opt_(num_chars_text) const _Elem* _text = nullptr, _In_ size_t num_chars_text = 0, _In_reads_or_z_opt_(num_chars_text) const _Elem* _text = nullptr, _In_ size_t num_chars_text = 0,
_In_reads_or_z_opt_(num_chars_name) const _Elem* _name = nullptr, _In_ size_t num_chars_name = 0, _In_reads_or_z_opt_(num_chars_name) const _Elem* _name = nullptr, _In_ size_t num_chars_name = 0,
_In_ uint32_t text_type = 0, _In_ uint32_t text_type = 0,
@ -2124,7 +2124,7 @@ namespace stdex
class url_token : public token class url_token : public token
{ {
protected: protected:
inline url_token( url_token(
_In_reads_or_z_opt_(num_chars) const _Elem* _url = nullptr, _In_ size_t num_chars = 0, _In_reads_or_z_opt_(num_chars) const _Elem* _url = nullptr, _In_ size_t num_chars = 0,
token_url_t _encoding = token_url_t::plain, token_url_t _encoding = token_url_t::plain,
_In_opt_ stdex::html::sequence* sequence = nullptr, _In_ uintptr_t data = 0) : _In_opt_ stdex::html::sequence* sequence = nullptr, _In_ uintptr_t data = 0) :
@ -2156,7 +2156,7 @@ namespace stdex
class parser class parser
{ {
public: public:
inline parser( parser(
_In_ const document<_Elem, _Traits, _Alloc>& document, _In_ const document<_Elem, _Traits, _Alloc>& document,
_In_reads_or_z_opt_(num_chars) const stdex::schar_t* url = nullptr, _In_ size_t num_chars = 0, _In_reads_or_z_opt_(num_chars) const stdex::schar_t* url = nullptr, _In_ size_t num_chars = 0,
_In_ bool parse_frames = false, _In_ stdex::progress<size_t>* progress = nullptr) : _In_ bool parse_frames = false, _In_ stdex::progress<size_t>* progress = nullptr) :
@ -2374,7 +2374,7 @@ namespace stdex
/// ///
/// Returns collection of tokens /// Returns collection of tokens
/// ///
inline const token_vector& tokens() const { return m_tokens; } const token_vector& tokens() const { return m_tokens; }
protected: protected:
/// ///
@ -2385,7 +2385,7 @@ namespace stdex
/// \returns Pointer to the token for non-owning references /// \returns Pointer to the token for non-owning references
/// ///
template <class T> template <class T>
inline T* append_token(_Inout_ std::unique_ptr<T>&& token) T* append_token(_Inout_ std::unique_ptr<T>&& token)
{ {
if (!token) if (!token)
return nullptr; return nullptr;
@ -2403,7 +2403,7 @@ namespace stdex
/// \returns Number of code units appended to the source code /// \returns Number of code units appended to the source code
/// ///
template <class T> template <class T>
inline size_t append_token(_Inout_ std::unique_ptr<T>&& token, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& source) size_t append_token(_Inout_ std::unique_ptr<T>&& token, _Inout_ std::basic_string<_Elem, _Traits, _Alloc>& source)
{ {
if (!token) if (!token)
return 0; return 0;

View File

@ -25,7 +25,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_ID> template <class T_ID>
inline _Success_(return) bool read_id(_In_ std::istream& stream, _Out_ T_ID &id, _In_opt_ std::streamoff end = (std::streamoff)-1) _Success_(return) bool read_id(_In_ std::istream& stream, _Out_ T_ID &id, _In_opt_ std::streamoff end = (std::streamoff)-1)
{ {
if (end == (std::streamoff)-1 || stream.tellg() < end) { if (end == (std::streamoff)-1 || stream.tellg() < end) {
stream.read((char*)&id, sizeof(id)); stream.read((char*)&id, sizeof(id));
@ -46,7 +46,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_ID> template <class T_ID>
inline _Success_(return) bool read_id(_In_ stdex::stream::basic_file& stream, _Out_ T_ID &id, _In_opt_ stdex::stream::fpos_t end = stdex::stream::fpos_max) _Success_(return) bool read_id(_In_ stdex::stream::basic_file& stream, _Out_ T_ID &id, _In_opt_ stdex::stream::fpos_t end = stdex::stream::fpos_max)
{ {
if (end == stdex::stream::fpos_max || stream.tell() < end) { if (end == stdex::stream::fpos_max || stream.tell() < end) {
stream >> id; stream >> id;
@ -63,7 +63,7 @@ namespace stdex {
/// \return Number of bytes needed to add to the data to align it on `ALIGN` boundary /// \return Number of bytes needed to add to the data to align it on `ALIGN` boundary
/// ///
template <class T_SIZE, T_SIZE ALIGN> template <class T_SIZE, T_SIZE ALIGN>
inline T_SIZE padding(_In_ T_SIZE size) T_SIZE padding(_In_ T_SIZE size)
{ {
return (ALIGN - (size % ALIGN)) % ALIGN; return (ALIGN - (size % ALIGN)) % ALIGN;
} }
@ -78,7 +78,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_SIZE, T_SIZE ALIGN> template <class T_SIZE, T_SIZE ALIGN>
inline bool ignore(_In_ std::istream& stream) bool ignore(_In_ std::istream& stream)
{ {
// Read record size. // Read record size.
T_SIZE size; T_SIZE size;
@ -103,7 +103,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_SIZE, T_SIZE ALIGN> template <class T_SIZE, T_SIZE ALIGN>
inline bool ignore(_In_ stdex::stream::basic& stream) bool ignore(_In_ stdex::stream::basic& stream)
{ {
// Read record size. // Read record size.
T_SIZE size; T_SIZE size;
@ -130,7 +130,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_ID, class T_SIZE, T_SIZE ALIGN> template <class T_ID, class T_SIZE, T_SIZE ALIGN>
inline bool find(_In_ std::istream& stream, _In_ T_ID id, _In_opt_ std::streamoff end = (std::streamoff)-1) bool find(_In_ std::istream& stream, _In_ T_ID id, _In_opt_ std::streamoff end = (std::streamoff)-1)
{ {
T_ID _id; T_ID _id;
while (end == (std::streamoff)-1 || stream.tellg() < end) { while (end == (std::streamoff)-1 || stream.tellg() < end) {
@ -157,7 +157,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_ID, class T_SIZE, T_SIZE ALIGN> template <class T_ID, class T_SIZE, T_SIZE ALIGN>
inline bool find(_In_ stdex::stream::basic_file& stream, _In_ T_ID id, _In_opt_ stdex::stream::fpos_t end = stdex::stream::fpos_max) bool find(_In_ stdex::stream::basic_file& stream, _In_ T_ID id, _In_opt_ stdex::stream::fpos_t end = stdex::stream::fpos_max)
{ {
T_ID _id; T_ID _id;
while (end == stdex::stream::fpos_max || stream.tell() < end) { while (end == stdex::stream::fpos_max || stream.tell() < end) {
@ -181,7 +181,7 @@ namespace stdex {
/// \returns Position of the record header start in \p stream. Save for later \c close call. /// \returns Position of the record header start in \p stream. Save for later \c close call.
/// ///
template <class T_ID, class T_SIZE> template <class T_ID, class T_SIZE>
inline std::streamoff open(_In_ std::ostream& stream, _In_ T_ID id) std::streamoff open(_In_ std::ostream& stream, _In_ T_ID id)
{ {
std::streamoff start = stream.tellp(); std::streamoff start = stream.tellp();
@ -206,7 +206,7 @@ namespace stdex {
/// \returns Position of the record header start in \p stream. Save for later \c close call. /// \returns Position of the record header start in \p stream. Save for later \c close call.
/// ///
template <class T_ID, class T_SIZE> template <class T_ID, class T_SIZE>
inline stdex::stream::fpos_t open(_In_ stdex::stream::basic_file& stream, _In_ T_ID id) stdex::stream::fpos_t open(_In_ stdex::stream::basic_file& stream, _In_ T_ID id)
{ {
auto start = stream.tell(); auto start = stream.tell();
@ -228,7 +228,7 @@ namespace stdex {
/// \returns Position of the record end in \p stream /// \returns Position of the record end in \p stream
/// ///
template <class T_ID, class T_SIZE, T_SIZE ALIGN> template <class T_ID, class T_SIZE, T_SIZE ALIGN>
inline std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start) std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start)
{ {
std::streamoff end = stream.tellp(); std::streamoff end = stream.tellp();
T_SIZE T_SIZE
@ -260,7 +260,7 @@ namespace stdex {
/// \returns Position of the record end in \p stream /// \returns Position of the record end in \p stream
/// ///
template <class T_ID, class T_SIZE, T_SIZE ALIGN> template <class T_ID, class T_SIZE, T_SIZE ALIGN>
inline stdex::stream::fpos_t close(_In_ stdex::stream::basic_file& stream, _In_ stdex::stream::fpos_t start) stdex::stream::fpos_t close(_In_ stdex::stream::basic_file& stream, _In_ stdex::stream::fpos_t start)
{ {
auto end = stream.tell(); auto end = stream.tell();
T_SIZE T_SIZE

View File

@ -22,14 +22,14 @@ namespace stdex
/// ///
/// Constructs an invalid interval /// Constructs an invalid interval
/// ///
inline interval() noexcept : start(static_cast<T>(1)), end(static_cast<T>(0)) {} interval() noexcept : start(static_cast<T>(1)), end(static_cast<T>(0)) {}
/// ///
/// Constructs a zero-size interval /// Constructs a zero-size interval
/// ///
/// \param[in] x Interval start and end value /// \param[in] x Interval start and end value
/// ///
inline interval(_In_ T x) noexcept : start(x), end(x) {} interval(_In_ T x) noexcept : start(x), end(x) {}
/// ///
/// Constructs an interval /// Constructs an interval
@ -37,26 +37,26 @@ namespace stdex
/// \param[in] _start Interval start value /// \param[in] _start Interval start value
/// \param[in] _end Interval end value /// \param[in] _end Interval end value
/// ///
inline interval(_In_ T _start, _In_ T _end) noexcept : start(_start), end(_end) {} interval(_In_ T _start, _In_ T _end) noexcept : start(_start), end(_end) {}
/// ///
/// Returns interval size /// Returns interval size
/// ///
/// \returns Interval size or 0 if interval is invalid /// \returns Interval size or 0 if interval is invalid
/// ///
inline T size() const { return start <= end ? end - start : 0; } T size() const { return start <= end ? end - start : 0; }
/// ///
/// Is interval empty? /// Is interval empty?
/// ///
/// \returns true if interval is empty or false otherwise /// \returns true if interval is empty or false otherwise
/// ///
inline bool empty() const { return start >= end; } bool empty() const { return start >= end; }
/// ///
/// Invalidates interval /// Invalidates interval
/// ///
inline void invalidate() void invalidate()
{ {
start = static_cast<T>(1); start = static_cast<T>(1);
end = static_cast<T>(0); end = static_cast<T>(0);
@ -67,7 +67,7 @@ namespace stdex
/// ///
/// \returns true if interval is valid or false otherwise /// \returns true if interval is valid or false otherwise
/// ///
inline operator bool() const { return start <= end; } operator bool() const { return start <= end; }
/// ///
/// Is value in interval? /// Is value in interval?
@ -76,7 +76,7 @@ namespace stdex
/// ///
/// \returns true if x is in [start, end) or false otherwise /// \returns true if x is in [start, end) or false otherwise
/// ///
inline bool contains(_In_ T x) const { return start <= x && x < end; } bool contains(_In_ T x) const { return start <= x && x < end; }
/// ///
/// Adds two intervals by components /// Adds two intervals by components
@ -85,7 +85,7 @@ namespace stdex
/// ///
/// \returns Resulting interval /// \returns Resulting interval
/// ///
inline interval<T> operator+(_In_ const interval<T>& other) const interval<T> operator+(_In_ const interval<T>& other) const
{ {
return interval<T>(start + other.start, end + other.end); return interval<T>(start + other.start, end + other.end);
} }
@ -97,7 +97,7 @@ namespace stdex
/// ///
/// \returns Moved interval /// \returns Moved interval
/// ///
inline interval<T> operator+(_In_ const T x) const interval<T> operator+(_In_ const T x) const
{ {
return interval<T>(start + x, end + x); return interval<T>(start + x, end + x);
} }
@ -107,7 +107,7 @@ namespace stdex
/// ///
/// \returns Moved interval /// \returns Moved interval
/// ///
inline interval<T> operator++() interval<T> operator++()
{ {
++start; ++start;
++end; ++end;
@ -119,7 +119,7 @@ namespace stdex
/// ///
/// \returns Original interval /// \returns Original interval
/// ///
inline interval<T> operator++(int) // Postfix increment operator. interval<T> operator++(int) // Postfix increment operator.
{ {
interval<T> r = *this; interval<T> r = *this;
++start; ++start;
@ -134,7 +134,7 @@ namespace stdex
/// ///
/// \returns Resulting interval /// \returns Resulting interval
/// ///
inline interval<T> operator-(_In_ const interval<T>& other) const interval<T> operator-(_In_ const interval<T>& other) const
{ {
return interval<T>(start - other.start, end - other.end); return interval<T>(start - other.start, end - other.end);
} }
@ -146,7 +146,7 @@ namespace stdex
/// ///
/// \returns Moved interval /// \returns Moved interval
/// ///
inline interval<T> operator-(_In_ const T x) const interval<T> operator-(_In_ const T x) const
{ {
return interval<T>(start - x, end - x); return interval<T>(start - x, end - x);
} }
@ -156,7 +156,7 @@ namespace stdex
/// ///
/// \returns Moved interval /// \returns Moved interval
/// ///
inline interval<T> operator--() interval<T> operator--()
{ {
--start; --start;
--end; --end;
@ -168,7 +168,7 @@ namespace stdex
/// ///
/// \returns Original interval /// \returns Original interval
/// ///
inline interval<T> operator--(int) // Postfix decrement operator. interval<T> operator--(int) // Postfix decrement operator.
{ {
interval<T> r = *this; interval<T> r = *this;
--start; --start;
@ -183,7 +183,7 @@ namespace stdex
/// ///
/// \returns true if intervals are identical or false otherwise /// \returns true if intervals are identical or false otherwise
/// ///
inline bool operator==(_In_ const interval<T>& other) const bool operator==(_In_ const interval<T>& other) const
{ {
return start == other.start && end == other.end; return start == other.start && end == other.end;
} }
@ -195,7 +195,7 @@ namespace stdex
/// ///
/// \returns true if intervals are different or false otherwise /// \returns true if intervals are different or false otherwise
/// ///
inline bool operator!=(_In_ const interval<T>& other) const bool operator!=(_In_ const interval<T>& other) const
{ {
return !operator ==(other); return !operator ==(other);
} }

View File

@ -21,14 +21,14 @@ namespace stdex
/// ///
/// Constructs a zero to zero mapping /// Constructs a zero to zero mapping
/// ///
inline mapping() : from(0), to(0) {} mapping() : from(0), to(0) {}
/// ///
/// Constructs an id mapping /// Constructs an id mapping
/// ///
/// \param[in] x Mapping from and to value /// \param[in] x Mapping from and to value
/// ///
inline mapping(_In_ T x) : from(x), to(x) {} mapping(_In_ T x) : from(x), to(x) {}
/// ///
/// Constructs a mapping /// Constructs a mapping
@ -36,7 +36,7 @@ namespace stdex
/// \param[in] _from Mapping from value /// \param[in] _from Mapping from value
/// \param[in] _to Mapping to value /// \param[in] _to Mapping to value
/// ///
inline mapping(_In_ T _from, _In_ T _to) : from(_from), to(_to) {} mapping(_In_ T _from, _In_ T _to) : from(_from), to(_to) {}
/// ///
/// Are mappings identical? /// Are mappings identical?
@ -45,7 +45,7 @@ namespace stdex
/// ///
/// \returns true if mappings are identical or false otherwise /// \returns true if mappings are identical or false otherwise
/// ///
inline bool operator==(const mapping& other) const { return from == other.from && to == other.to; } bool operator==(const mapping& other) const { return from == other.from && to == other.to; }
/// ///
/// Are mappings different? /// Are mappings different?
@ -54,7 +54,7 @@ namespace stdex
/// ///
/// \returns true if mappings are different or false otherwise /// \returns true if mappings are different or false otherwise
/// ///
inline bool operator!=(const mapping& other) const { return !operator==(other); } bool operator!=(const mapping& other) const { return !operator==(other); }
}; };
template <class T, class _Alloc = std::allocator<mapping<T>>> template <class T, class _Alloc = std::allocator<mapping<T>>>

View File

@ -18,9 +18,9 @@ namespace stdex
constexpr no_delete() noexcept = default; constexpr no_delete() noexcept = default;
template <class T2, std::enable_if_t<std::is_convertible_v<T2*, T*>, int> = 0> template <class T2, std::enable_if_t<std::is_convertible_v<T2*, T*>, int> = 0>
inline no_delete(const no_delete<T2>&) noexcept {} no_delete(const no_delete<T2>&) noexcept {}
inline void operator()(T* p) const noexcept { _Unreferenced_(p); } void operator()(T* p) const noexcept { _Unreferenced_(p); }
}; };
/// ///
@ -31,10 +31,10 @@ namespace stdex
constexpr no_delete() noexcept = default; constexpr no_delete() noexcept = default;
template <class _Uty, std::enable_if_t<std::is_convertible_v<_Uty(*)[], T(*)[]>, int> = 0> template <class _Uty, std::enable_if_t<std::is_convertible_v<_Uty(*)[], T(*)[]>, int> = 0>
inline no_delete(const no_delete<_Uty[]>&) noexcept {} no_delete(const no_delete<_Uty[]>&) noexcept {}
template <class _Uty, std::enable_if_t<std::is_convertible_v<_Uty(*)[], T(*)[]>, int> = 0> template <class _Uty, std::enable_if_t<std::is_convertible_v<_Uty(*)[], T(*)[]>, int> = 0>
inline void operator()(_Uty* p) const noexcept { p; } void operator()(_Uty* p) const noexcept { p; }
}; };
/// ///
@ -46,7 +46,7 @@ namespace stdex
/// \param[in] p Pointer to assign to shared_ptr /// \param[in] p Pointer to assign to shared_ptr
/// ///
template <class T> template <class T>
inline std::shared_ptr<T> make_shared_no_delete(_In_ T* p) std::shared_ptr<T> make_shared_no_delete(_In_ T* p)
{ {
return std::shared_ptr<T>(p, no_delete<T>{}); return std::shared_ptr<T>(p, no_delete<T>{});
} }

View File

@ -95,7 +95,7 @@ namespace stdex
_In_ int flags = match_default) = 0; _In_ int flags = match_default) = 0;
template<class _Traits, class _Ax> template<class _Traits, class _Ax>
inline bool match( bool match(
const std::basic_string<T, _Traits, _Ax>& text, const std::basic_string<T, _Traits, _Ax>& text,
_In_ size_t start = 0, _In_ size_t start = 0,
_In_ size_t end = SIZE_MAX, _In_ size_t end = SIZE_MAX,
@ -1128,7 +1128,7 @@ namespace stdex
class basic_string_branch : public basic_branch<T> class basic_string_branch : public basic_branch<T>
{ {
public: public:
inline basic_string_branch( basic_string_branch(
_In_reads_(count) const T* str_z = nullptr, _In_reads_(count) const T* str_z = nullptr,
_In_ size_t count = 0, _In_ size_t count = 0,
_In_ const std::locale& locale = std::locale()) : _In_ const std::locale& locale = std::locale()) :
@ -1137,7 +1137,7 @@ namespace stdex
build(str_z, count); build(str_z, count);
} }
inline basic_string_branch(_In_z_ const T* str, ...) : basic_string_branch(_In_z_ const T* str, ...) :
basic_branch<T>(std::locale()) basic_branch<T>(std::locale())
{ {
va_list params; va_list params;
@ -1146,7 +1146,7 @@ namespace stdex
va_end(params); va_end(params);
} }
inline basic_string_branch(_In_ const std::locale& locale, _In_z_ const T* str, ...) : basic_string_branch(_In_ const std::locale& locale, _In_z_ const T* str, ...) :
basic_branch<T>(locale) basic_branch<T>(locale)
{ {
va_list params; va_list params;
@ -4233,7 +4233,7 @@ namespace stdex
} }
protected: protected:
static inline bool is_valid(size_t day, size_t month) static bool is_valid(size_t day, size_t month)
{ {
if (month == SIZE_MAX) { if (month == SIZE_MAX) {
// Default to January. This allows validating day only, as January has all 31 days. // Default to January. This allows validating day only, as January has all 31 days.

View File

@ -37,7 +37,7 @@ namespace stdex
std::map<numaid_t, numaentry_t> m_available; std::map<numaid_t, numaentry_t> m_available;
private: private:
static inline numaid_t numa_node() static numaid_t numa_node()
{ {
#ifdef _WIN32 #ifdef _WIN32
PROCESSOR_NUMBER Processor; PROCESSOR_NUMBER Processor;
@ -49,7 +49,7 @@ namespace stdex
#endif #endif
} }
inline numaentry_t& numa_entry(numaid_t numa = numa_node()) numaentry_t& numa_entry(numaid_t numa = numa_node())
{ {
const std::lock_guard<std::mutex> guard(m_mutex); const std::lock_guard<std::mutex> guard(m_mutex);
return m_available[numa]; return m_available[numa];

View File

@ -156,7 +156,7 @@ namespace stdex
/// ///
/// \param[in] host Host progress indicator /// \param[in] host Host progress indicator
/// ///
inline void attach(_In_opt_ progress<T>* host) void attach(_In_opt_ progress<T>* host)
{ {
m_host = host; m_host = host;
} }
@ -166,7 +166,7 @@ namespace stdex
/// ///
/// \returns Old host progress indicator /// \returns Old host progress indicator
/// ///
inline progress<T>* detach() progress<T>* detach()
{ {
progress<T>* k = m_host; progress<T>* k = m_host;
m_host = NULL; m_host = NULL;
@ -179,7 +179,7 @@ namespace stdex
/// \param[in] start Minimum value of the progress /// \param[in] start Minimum value of the progress
/// \param[in] end Maximum value of the progress /// \param[in] end Maximum value of the progress
/// ///
inline void set_global_range(_In_ T start, _In_ T end) void set_global_range(_In_ T start, _In_ T end)
{ {
m_global.start = start; m_global.start = start;
m_global.end = end; m_global.end = end;
@ -193,7 +193,7 @@ namespace stdex
/// \param[in] start Minimum value of the progress /// \param[in] start Minimum value of the progress
/// \param[in] end Maximum value of the progress /// \param[in] end Maximum value of the progress
/// ///
inline void set_section_range(_In_ T start, _In_ T end) void set_section_range(_In_ T start, _In_ T end)
{ {
m_section.start = start; m_section.start = start;
m_section.end = end; m_section.end = end;

View File

@ -123,18 +123,18 @@ namespace stdex
} }
protected: protected:
inline size_t wrap(_In_ size_t idx) const size_t wrap(_In_ size_t idx) const
{ {
// TODO: When CAPACITY is power of 2, use & ~(CAPACITY - 1) instead. // TODO: When CAPACITY is power of 2, use & ~(CAPACITY - 1) instead.
return idx % CAPACITY; return idx % CAPACITY;
} }
inline size_t space() const size_t space() const
{ {
return CAPACITY - m_size; return CAPACITY - m_size;
} }
inline bool empty() const bool empty() const
{ {
return !m_size; return !m_size;
} }

View File

@ -17,7 +17,7 @@ namespace stdex
{ {
/// \cond internal /// \cond internal
template <class T> template <class T>
inline const wchar_t* sgml2uni(_In_reads_or_z_(count) const T* entity, _In_ size_t count) const wchar_t* sgml2uni(_In_reads_or_z_(count) const T* entity, _In_ size_t count)
{ {
_Assume_(entity && count); _Assume_(entity && count);
_Assume_(count < 2 || entity[0] != '#'); // No numeric entities _Assume_(count < 2 || entity[0] != '#'); // No numeric entities
@ -44,7 +44,7 @@ namespace stdex
} }
template <class T> template <class T>
inline const T* sgmlend( const T* sgmlend(
_In_reads_or_z_opt_(count) const T* str, _In_ size_t count) _In_reads_or_z_opt_(count) const T* str, _In_ size_t count)
{ {
_Assume_(str || !count); _Assume_(str || !count);
@ -88,7 +88,7 @@ namespace stdex
/// \param[in,out] map The vector to append index mapping between source and destination string to. /// \param[in,out] map The vector to append index mapping between source and destination string to.
/// ///
template <class T> template <class T>
inline void sgml2strcat( void sgml2strcat(
_Inout_ std::wstring& dst, _Inout_ std::wstring& dst,
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src, _In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
_In_ int skip = 0, _In_ int skip = 0,
@ -180,7 +180,7 @@ namespace stdex
/// \param[in,out] map The vector to append index mapping between source and destination string to. /// \param[in,out] map The vector to append index mapping between source and destination string to.
/// ///
template <class T> template <class T>
inline void sgml2strcat( void sgml2strcat(
_Inout_ std::wstring& dst, _Inout_ std::wstring& dst,
_In_ const std::basic_string<T>& src, _In_ const std::basic_string<T>& src,
_In_ int skip = 0, _In_ int skip = 0,
@ -204,7 +204,7 @@ namespace stdex
/// \return Final length of SGML string in code points excluding zero-terminator /// \return Final length of SGML string in code points excluding zero-terminator
/// ///
template <class T> template <class T>
inline size_t sgml2strcat( size_t sgml2strcat(
_Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst, _Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst,
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src, _In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
_In_ int skip = 0, _In_ int skip = 0,
@ -308,7 +308,7 @@ namespace stdex
/// \param[in,out] map The vector to write index mapping between source and destination string to. /// \param[in,out] map The vector to write index mapping between source and destination string to.
/// ///
template <class T> template <class T>
inline void sgml2strcpy( void sgml2strcpy(
_Inout_ std::wstring& dst, _Inout_ std::wstring& dst,
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src, _In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
_In_ int skip = 0, _In_ int skip = 0,
@ -331,7 +331,7 @@ namespace stdex
/// \param[in,out] map The vector to write index mapping between source and destination string to. /// \param[in,out] map The vector to write index mapping between source and destination string to.
/// ///
template<class _Elem, class _Traits, class _Ax> template<class _Elem, class _Traits, class _Ax>
inline void sgml2strcpy( void sgml2strcpy(
_Inout_ std::wstring& dst, _Inout_ std::wstring& dst,
_In_ const std::basic_string<_Elem, _Traits, _Ax>& src, _In_ const std::basic_string<_Elem, _Traits, _Ax>& src,
_In_ int skip = 0, _In_ int skip = 0,
@ -355,7 +355,7 @@ namespace stdex
/// \return Final length of SGML string in code points excluding zero-terminator /// \return Final length of SGML string in code points excluding zero-terminator
/// ///
template <class T> template <class T>
inline size_t sgml2strcpy( size_t sgml2strcpy(
_Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst, _Inout_cap_(count_dst) wchar_t* dst, _In_ size_t count_dst,
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src, _In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
_In_ int skip = 0, _In_ int skip = 0,
@ -382,7 +382,7 @@ namespace stdex
/// \return Unicode string /// \return Unicode string
/// ///
template <class T> template <class T>
inline std::wstring sgml2str( std::wstring sgml2str(
_In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src, _In_reads_or_z_opt_(count_src) const T* src, _In_ size_t count_src,
_In_ int skip = 0, _In_ int skip = 0,
_In_ const mapping<size_t>& offset = mapping<size_t>(0, 0), _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),
@ -404,7 +404,7 @@ namespace stdex
/// \return Unicode string /// \return Unicode string
/// ///
template <class T> template <class T>
inline std::wstring sgml2str( std::wstring sgml2str(
_In_ const std::basic_string<T>& src, _In_ const std::basic_string<T>& src,
_In_ int skip = 0, _In_ int skip = 0,
_In_ const mapping<size_t>& offset = mapping<size_t>(0, 0), _In_ const mapping<size_t>& offset = mapping<size_t>(0, 0),

View File

@ -167,12 +167,12 @@ namespace stdex
/// ///
/// Returns stream state after last operation /// Returns stream state after last operation
/// ///
inline state_t state() const { return m_state; }; state_t state() const { return m_state; };
/// ///
/// Returns true if the stream state is clean i.e. previous operation was succesful /// Returns true if the stream state is clean i.e. previous operation was succesful
/// ///
inline bool ok() const { return m_state == state_t::ok; }; bool ok() const { return m_state == state_t::ok; };
/// ///
/// Reads and returns remainder of the stream /// Reads and returns remainder of the stream
@ -207,7 +207,7 @@ namespace stdex
/// ///
/// Reads one byte of data /// Reads one byte of data
/// ///
inline uint8_t read_byte() uint8_t read_byte()
{ {
uint8_t byte; uint8_t byte;
if (read_array(&byte, sizeof(byte), 1) == 1) if (read_array(&byte, sizeof(byte), 1) == 1)
@ -256,7 +256,7 @@ namespace stdex
/// \returns This stream /// \returns This stream
/// ///
template <class T> template <class T>
inline basic& read_data(_Out_ T& data) basic& read_data(_Out_ T& data)
{ {
if (!ok()) _Unlikely_ { if (!ok()) _Unlikely_ {
data = 0; data = 0;
@ -284,7 +284,7 @@ namespace stdex
/// \return This stream /// \return This stream
/// ///
template <class T> template <class T>
inline basic& write_data(_In_ const T data) basic& write_data(_In_ const T data)
{ {
if (!ok()) _Unlikely_ if (!ok()) _Unlikely_
return *this; return *this;
@ -303,7 +303,7 @@ namespace stdex
/// \return Number of read characters /// \return Number of read characters
/// ///
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline size_t readln(_Inout_ std::basic_string<_Elem, _Traits, _Ax>& str) 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);
@ -385,7 +385,7 @@ namespace stdex
/// ///
/// \return Number of elements written /// \return Number of elements written
/// ///
inline size_t write_array(_In_reads_bytes_opt_(size* count) const void* array, _In_ size_t size, _In_ size_t count) size_t write_array(_In_reads_bytes_opt_(size* count) const void* array, _In_ size_t size, _In_ size_t count)
{ {
return write(array, mul(size, count)) / size; return write(array, mul(size, count)) / size;
} }
@ -462,7 +462,7 @@ namespace stdex
/// \return This stream /// \return This stream
/// ///
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline basic& read_str(_Out_ std::basic_string<_Elem, _Traits, _Ax>& data) basic& read_str(_Out_ std::basic_string<_Elem, _Traits, _Ax>& data)
{ {
data.clear(); data.clear();
if (!ok()) _Unlikely_ if (!ok()) _Unlikely_
@ -494,7 +494,7 @@ namespace stdex
/// \return This stream /// \return This stream
/// ///
template <class T> template <class T>
inline basic& write_str(_In_z_ const T* data) basic& write_str(_In_z_ const T* data)
{ {
// Stream state will be checked in write_data. // Stream state will be checked in write_data.
size_t num_chars = stdex::strlen(data); size_t num_chars = stdex::strlen(data);
@ -519,7 +519,7 @@ namespace stdex
/// \return This stream /// \return This stream
/// ///
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline basic& write_str(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data) basic& write_str(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data)
{ {
// Stream state will be checked in write_data. // Stream state will be checked in write_data.
size_t num_chars = data.size(); size_t num_chars = data.size();
@ -643,38 +643,38 @@ namespace stdex
return write_array(tmp.data(), sizeof(wchar_t), tmp.size()); return write_array(tmp.data(), sizeof(wchar_t), tmp.size());
} }
inline basic& operator >>(_Out_ int8_t& data) { return read_data(data); } basic& operator >>(_Out_ int8_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const int8_t data) { return write_data(data); } basic& operator <<(_In_ const int8_t data) { return write_data(data); }
inline basic& operator >>(_Out_ int16_t& data) { return read_data(data); } basic& operator >>(_Out_ int16_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const int16_t data) { return write_data(data); } basic& operator <<(_In_ const int16_t data) { return write_data(data); }
inline basic& operator >>(_Out_ int32_t& data) { return read_data(data); } basic& operator >>(_Out_ int32_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const int32_t data) { return write_data(data); } basic& operator <<(_In_ const int32_t data) { return write_data(data); }
inline basic& operator >>(_Out_ int64_t& data) { return read_data(data); } basic& operator >>(_Out_ int64_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const int64_t data) { return write_data(data); } basic& operator <<(_In_ const int64_t data) { return write_data(data); }
inline basic& operator >>(_Out_ uint8_t& data) { return read_data(data); } basic& operator >>(_Out_ uint8_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const uint8_t data) { return write_data(data); } basic& operator <<(_In_ const uint8_t data) { return write_data(data); }
inline basic& operator >>(_Out_ uint16_t& data) { return read_data(data); } basic& operator >>(_Out_ uint16_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const uint16_t data) { return write_data(data); } basic& operator <<(_In_ const uint16_t data) { return write_data(data); }
inline basic& operator >>(_Out_ uint32_t& data) { return read_data(data); } basic& operator >>(_Out_ uint32_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const uint32_t data) { return write_data(data); } basic& operator <<(_In_ const uint32_t data) { return write_data(data); }
inline basic& operator >>(_Out_ uint64_t& data) { return read_data(data); } basic& operator >>(_Out_ uint64_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const uint64_t data) { return write_data(data); } basic& operator <<(_In_ const uint64_t data) { return write_data(data); }
inline basic& operator >>(_Out_ float& data) { return read_data(data); } basic& operator >>(_Out_ float& data) { return read_data(data); }
inline basic& operator <<(_In_ const float data) { return write_data(data); } basic& operator <<(_In_ const float data) { return write_data(data); }
inline basic& operator >>(_Out_ double& data) { return read_data(data); } basic& operator >>(_Out_ double& data) { return read_data(data); }
inline basic& operator <<(_In_ const double data) { return write_data(data); } basic& operator <<(_In_ const double data) { return write_data(data); }
inline basic& operator >>(_Out_ char& data) { return read_data(data); } basic& operator >>(_Out_ char& data) { return read_data(data); }
inline basic& operator <<(_In_ const char data) { return write_data(data); } basic& operator <<(_In_ const char data) { return write_data(data); }
#ifdef _NATIVE_WCHAR_T_DEFINED #ifdef _NATIVE_WCHAR_T_DEFINED
inline basic& operator >>(_Out_ wchar_t& data) { return read_data(data); } basic& operator >>(_Out_ wchar_t& data) { return read_data(data); }
inline basic& operator <<(_In_ const wchar_t data) { return write_data(data); } basic& operator <<(_In_ const wchar_t data) { return write_data(data); }
#endif #endif
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline basic& operator >>(_Out_ std::basic_string<_Elem, _Traits, _Ax>& data) { return read_str(data); } basic& operator >>(_Out_ std::basic_string<_Elem, _Traits, _Ax>& data) { return read_str(data); }
template <class T> template <class T>
inline basic& operator <<(_In_ const T* data) { return write_str(data); } basic& operator <<(_In_ const T* data) { return write_str(data); }
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline basic& operator <<(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data) { return write_str(data); } basic& operator <<(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data) { return write_str(data); }
template <class _Ty, class _Alloc = std::allocator<_Ty>> template <class _Ty, class _Alloc = std::allocator<_Ty>>
basic& operator <<(_In_ const std::vector<_Ty, _Alloc>& data) basic& operator <<(_In_ const std::vector<_Ty, _Alloc>& data)
@ -836,21 +836,21 @@ namespace stdex
/// ///
/// \return Absolute file position after seek /// \return Absolute file position after seek
/// ///
inline fpos_t seekbeg(_In_ fpos_t offset) { return seek(offset, seek_t::beg); } fpos_t seekbeg(_In_ fpos_t offset) { return seek(offset, seek_t::beg); }
/// ///
/// Seeks to relative from current file position /// Seeks to relative from current file position
/// ///
/// \return Absolute file position after seek /// \return Absolute file position after seek
/// ///
inline fpos_t seekcur(_In_ foff_t offset) { return seek(offset, seek_t::cur); } fpos_t seekcur(_In_ foff_t offset) { return seek(offset, seek_t::cur); }
/// ///
/// Seeks to relative from end file position /// Seeks to relative from end file position
/// ///
/// \return Absolute file position after seek /// \return Absolute file position after seek
/// ///
inline fpos_t seekend(_In_ foff_t offset) { return seek(offset, seek_t::end); } fpos_t seekend(_In_ foff_t offset) { return seek(offset, seek_t::end); }
virtual void skip(_In_ fsize_t amount) virtual void skip(_In_ fsize_t amount)
{ {
@ -2393,12 +2393,12 @@ namespace stdex
/// ///
/// Returns true if socket handle is valid /// Returns true if socket handle is valid
/// ///
inline operator bool() const noexcept { return m_h != invalid_socket; } operator bool() const noexcept { return m_h != invalid_socket; }
/// ///
/// Returns socket handle /// Returns socket handle
/// ///
inline socket_t get() const noexcept { return m_h; } socket_t get() const noexcept { return m_h; }
virtual _Success_(return != 0 || length == 0) size_t read( virtual _Success_(return != 0 || length == 0) size_t read(
_Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length) _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
@ -2707,7 +2707,7 @@ namespace stdex
/// \param[in] filename Filename /// \param[in] filename Filename
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// ///
inline file(_In_ const stdex::sstring& filename, _In_ int mode) : file(filename.c_str(), mode) {} file(_In_ const stdex::sstring& filename, _In_ int mode) : file(filename.c_str(), mode) {}
/// ///
/// Opens file /// Opens file
@ -2788,7 +2788,7 @@ namespace stdex
/// \param[in] filename Filename /// \param[in] filename Filename
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// ///
inline void open(_In_ const stdex::sstring& filename, _In_ int mode) void open(_In_ const stdex::sstring& filename, _In_ int mode)
{ {
open(filename.c_str(), mode); open(filename.c_str(), mode);
} }
@ -2893,10 +2893,10 @@ namespace stdex
if (orig >= 0) { if (orig >= 0) {
length = lseek64(m_h, 0, SEEK_END); length = lseek64(m_h, 0, SEEK_END);
lseek64(m_h, orig, SEEK_SET); lseek64(m_h, orig, SEEK_SET);
} }
return length; return length;
#endif #endif
} }
virtual void truncate() virtual void truncate()
{ {
@ -2916,7 +2916,7 @@ namespace stdex
} }
#ifdef _WIN32 #ifdef _WIN32
static inline time_point ft2tp(_In_ const FILETIME& ft) static time_point ft2tp(_In_ const FILETIME& ft)
{ {
#if _HAS_CXX20 #if _HAS_CXX20
uint64_t t = (static_cast<int64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; uint64_t t = (static_cast<int64_t>(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
@ -2926,7 +2926,7 @@ namespace stdex
return time_point(time_point::duration(t)); return time_point(time_point::duration(t));
} }
static inline void tp2ft(_In_ time_point tp, _Out_ FILETIME& ft) static void tp2ft(_In_ time_point tp, _Out_ FILETIME& ft)
{ {
#if _HAS_CXX20 #if _HAS_CXX20
uint64_t t = tp.time_since_epoch().count(); uint64_t t = tp.time_since_epoch().count();
@ -3049,7 +3049,7 @@ namespace stdex
/// ///
/// \param[in] filename Filename /// \param[in] filename Filename
/// ///
static inline bool exists(_In_ const stdex::sstring& filename) static bool exists(_In_ const stdex::sstring& filename)
{ {
return exists(filename.c_str()); return exists(filename.c_str());
} }
@ -3079,7 +3079,7 @@ namespace stdex
/// ///
/// \param[in] filename Filename /// \param[in] filename Filename
/// ///
static inline bool readonly(_In_ const stdex::sstring& filename) static bool readonly(_In_ const stdex::sstring& filename)
{ {
return readonly(filename.c_str()); return readonly(filename.c_str());
} }
@ -3120,7 +3120,7 @@ namespace stdex
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// \param[in] cache_size Size of the cache block /// \param[in] cache_size Size of the cache block
/// ///
inline cached_file(_In_ const stdex::sstring& filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) : cached_file(filename.c_str(), mode, cache_size) {} cached_file(_In_ const stdex::sstring& filename, _In_ int mode, _In_ size_t cache_size = default_cache_size) : cached_file(filename.c_str(), mode, cache_size) {}
virtual ~cached_file() virtual ~cached_file()
{ {
@ -3154,7 +3154,7 @@ namespace stdex
/// \param[in] filename Filename /// \param[in] filename Filename
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// ///
inline void open(_In_ const stdex::sstring& filename, _In_ int mode) void open(_In_ const stdex::sstring& filename, _In_ int mode)
{ {
open(filename.c_str(), mode); open(filename.c_str(), mode);
} }
@ -3162,7 +3162,7 @@ namespace stdex
/// ///
/// Returns true if file has a valid handle /// Returns true if file has a valid handle
/// ///
inline operator bool() const noexcept { return m_source; } operator bool() const noexcept { return m_source; }
protected: protected:
file m_source; file m_source;
@ -3263,7 +3263,7 @@ namespace stdex
/// \param[in] filename Filename /// \param[in] filename Filename
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// ///
inline memory_file(_In_ const stdex::sstring& filename, _In_ int mode) : memory_file(filename.c_str(), mode) {} memory_file(_In_ const stdex::sstring& filename, _In_ int mode) : memory_file(filename.c_str(), mode) {}
/// ///
/// Copies content from another file /// Copies content from another file
@ -3454,7 +3454,7 @@ namespace stdex
/// \param[in] filename Filename /// \param[in] filename Filename
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// ///
inline void load(_In_ const stdex::sstring& filename, _In_ int mode) void load(_In_ const stdex::sstring& filename, _In_ int mode)
{ {
load(filename.c_str(), mode); load(filename.c_str(), mode);
} }
@ -3491,7 +3491,7 @@ namespace stdex
/// \param[in] filename Filename /// \param[in] filename Filename
/// \param[in] mode Bitwise combination of mode_t flags /// \param[in] mode Bitwise combination of mode_t flags
/// ///
inline void save(_In_ const stdex::sstring& filename, _In_ int mode) void save(_In_ const stdex::sstring& filename, _In_ int mode)
{ {
save(filename.c_str(), mode); save(filename.c_str(), mode);
} }
@ -3499,7 +3499,7 @@ namespace stdex
/// ///
/// Returns pointer to data /// Returns pointer to data
/// ///
inline const void* data() const { return m_data; } const void* data() const { return m_data; }
virtual _Success_(return != 0 || length == 0) size_t read( virtual _Success_(return != 0 || length == 0) size_t read(
_Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length) _Out_writes_bytes_to_opt_(length, return) void* data, _In_ size_t length)
@ -3540,7 +3540,7 @@ namespace stdex
/// \returns This stream /// \returns This stream
/// ///
template <class T> template <class T>
inline memory_file& read_data(_Out_ T& data) memory_file& read_data(_Out_ T& data)
{ {
#if SET_FILE_OP_TIMES #if SET_FILE_OP_TIMES
m_atime = time_point::now(); m_atime = time_point::now();
@ -3668,7 +3668,7 @@ namespace stdex
/// \returns This stream /// \returns This stream
/// ///
template <class T> template <class T>
inline memory_file& write_data(const T data) memory_file& write_data(const T data)
{ {
#if SET_FILE_OP_TIMES #if SET_FILE_OP_TIMES
m_atime = m_mtime = time_point::now(); m_atime = m_mtime = time_point::now();
@ -3706,7 +3706,7 @@ namespace stdex
/// \return This stream /// \return This stream
/// ///
template <class T> template <class T>
inline memory_file& write_str(_In_z_ const T * data) memory_file& write_str(_In_z_ const T * data)
{ {
#if SET_FILE_OP_TIMES #if SET_FILE_OP_TIMES
m_atime = m_mtime = time_point::now(); m_atime = m_mtime = time_point::now();
@ -3751,7 +3751,7 @@ namespace stdex
/// \return This stream /// \return This stream
/// ///
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline memory_file& write_str(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data) memory_file& write_str(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data)
{ {
#if SET_FILE_OP_TIMES #if SET_FILE_OP_TIMES
m_atime = m_mtime = time_point::now(); m_atime = m_mtime = time_point::now();
@ -3927,7 +3927,7 @@ namespace stdex
/// \param[in] data Data to write /// \param[in] data Data to write
/// ///
template <class T> template <class T>
inline void set(_In_ fpos_t offset, _In_ const T data) void set(_In_ fpos_t offset, _In_ const T data)
{ {
#if SET_FILE_OP_TIMES #if SET_FILE_OP_TIMES
m_atime = m_mtime = time_point::now(); m_atime = m_mtime = time_point::now();
@ -3937,19 +3937,19 @@ namespace stdex
} }
public: public:
inline void set(_In_ fpos_t offset, _In_ const int8_t data) { set<int8_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const int8_t data) { set<int8_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const int16_t data) { set<int16_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const int16_t data) { set<int16_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const int32_t data) { set<int32_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const int32_t data) { set<int32_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const int64_t data) { set<int64_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const int64_t data) { set<int64_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const uint8_t data) { set<uint8_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const uint8_t data) { set<uint8_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const uint16_t data) { set<uint16_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const uint16_t data) { set<uint16_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const uint32_t data) { set<uint32_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const uint32_t data) { set<uint32_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const uint64_t data) { set<uint64_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const uint64_t data) { set<uint64_t>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const float data) { set<float>(offset, data); } void set(_In_ fpos_t offset, _In_ const float data) { set<float>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const double data) { set<double>(offset, data); } void set(_In_ fpos_t offset, _In_ const double data) { set<double>(offset, data); }
inline void set(_In_ fpos_t offset, _In_ const char data) { set<char>(offset, data); } void set(_In_ fpos_t offset, _In_ const char data) { set<char>(offset, data); }
#ifdef _NATIVE_WCHAR_T_DEFINED #ifdef _NATIVE_WCHAR_T_DEFINED
inline void set(_In_ fpos_t offset, _In_ const wchar_t data) { set<wchar_t>(offset, data); } void set(_In_ fpos_t offset, _In_ const wchar_t data) { set<wchar_t>(offset, data); }
#endif #endif
/// ///
@ -3961,7 +3961,7 @@ namespace stdex
/// ///
protected: protected:
template <class T> template <class T>
inline void get(_In_ fpos_t offset, _Out_ T & data) void get(_In_ fpos_t offset, _Out_ T & data)
{ {
_Assume_(offset + sizeof(T) < m_size); _Assume_(offset + sizeof(T) < m_size);
data = LE2HE(*(T*)(m_data + offset)); data = LE2HE(*(T*)(m_data + offset));
@ -3971,53 +3971,53 @@ namespace stdex
} }
public: public:
inline void get(_In_ fpos_t offset, _Out_ int8_t & data) { get<int8_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ int8_t & data) { get<int8_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ int16_t & data) { get<int16_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ int16_t & data) { get<int16_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ int32_t & data) { get<int32_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ int32_t & data) { get<int32_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ int64_t & data) { get<int64_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ int64_t & data) { get<int64_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ uint8_t & data) { get<uint8_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ uint8_t & data) { get<uint8_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ uint16_t & data) { get<uint16_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ uint16_t & data) { get<uint16_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ uint32_t & data) { get<uint32_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ uint32_t & data) { get<uint32_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ uint64_t & data) { get<uint64_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ uint64_t & data) { get<uint64_t>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ float& data) { get<float>(offset, data); } void get(_In_ fpos_t offset, _Out_ float& data) { get<float>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ double& data) { get<double>(offset, data); } void get(_In_ fpos_t offset, _Out_ double& data) { get<double>(offset, data); }
inline void get(_In_ fpos_t offset, _Out_ char& data) { get<char>(offset, data); } void get(_In_ fpos_t offset, _Out_ char& data) { get<char>(offset, data); }
#ifdef _NATIVE_WCHAR_T_DEFINED #ifdef _NATIVE_WCHAR_T_DEFINED
inline void get(_In_ fpos_t offset, _Out_ wchar_t& data) { get<wchar_t>(offset, data); } void get(_In_ fpos_t offset, _Out_ wchar_t& data) { get<wchar_t>(offset, data); }
#endif #endif
inline memory_file& operator <<(_In_ const int8_t data) { return write_data(data); } memory_file& operator <<(_In_ const int8_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ int8_t & data) { return read_data(data); } memory_file& operator >>(_Out_ int8_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const int16_t data) { return write_data(data); } memory_file& operator <<(_In_ const int16_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ int16_t & data) { return read_data(data); } memory_file& operator >>(_Out_ int16_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const int32_t data) { return write_data(data); } memory_file& operator <<(_In_ const int32_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ int32_t & data) { return read_data(data); } memory_file& operator >>(_Out_ int32_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const int64_t data) { return write_data(data); } memory_file& operator <<(_In_ const int64_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ int64_t & data) { return read_data(data); } memory_file& operator >>(_Out_ int64_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const uint8_t data) { return write_data(data); } memory_file& operator <<(_In_ const uint8_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ uint8_t & data) { return read_data(data); } memory_file& operator >>(_Out_ uint8_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const uint16_t data) { return write_data(data); } memory_file& operator <<(_In_ const uint16_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ uint16_t & data) { return read_data(data); } memory_file& operator >>(_Out_ uint16_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const uint32_t data) { return write_data(data); } memory_file& operator <<(_In_ const uint32_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ uint32_t & data) { return read_data(data); } memory_file& operator >>(_Out_ uint32_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const uint64_t data) { return write_data(data); } memory_file& operator <<(_In_ const uint64_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ uint64_t & data) { return read_data(data); } memory_file& operator >>(_Out_ uint64_t & data) { return read_data(data); }
inline memory_file& operator <<(_In_ const float data) { return write_data(data); } memory_file& operator <<(_In_ const float data) { return write_data(data); }
inline memory_file& operator >>(_Out_ float& data) { return read_data(data); } memory_file& operator >>(_Out_ float& data) { return read_data(data); }
inline memory_file& operator <<(_In_ const double data) { return write_data(data); } memory_file& operator <<(_In_ const double data) { return write_data(data); }
inline memory_file& operator >>(_Out_ double& data) { return read_data(data); } memory_file& operator >>(_Out_ double& data) { return read_data(data); }
inline memory_file& operator <<(_In_ const char data) { return write_data(data); } memory_file& operator <<(_In_ const char data) { return write_data(data); }
inline memory_file& operator >>(_Out_ char& data) { return read_data(data); } memory_file& operator >>(_Out_ char& data) { return read_data(data); }
#ifdef _NATIVE_WCHAR_T_DEFINED #ifdef _NATIVE_WCHAR_T_DEFINED
inline memory_file& operator <<(_In_ const wchar_t data) { return write_data(data); } memory_file& operator <<(_In_ const wchar_t data) { return write_data(data); }
inline memory_file& operator >>(_Out_ wchar_t& data) { return read_data(data); } memory_file& operator >>(_Out_ wchar_t& data) { return read_data(data); }
#endif #endif
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline memory_file& operator >>(_Out_ std::basic_string<_Elem, _Traits, _Ax>&data) { return read_str(data); } memory_file& operator >>(_Out_ std::basic_string<_Elem, _Traits, _Ax>&data) { return read_str(data); }
template <class T> template <class T>
inline memory_file& operator <<(_In_ const T * data) { return write_str(data); } memory_file& operator <<(_In_ const T * data) { return write_str(data); }
template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>> template<class _Elem, class _Traits = std::char_traits<_Elem>, class _Ax = std::allocator<_Elem>>
inline memory_file& operator <<(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data) { return write_str(data); } memory_file& operator <<(_In_ const std::basic_string<_Elem, _Traits, _Ax>& data) { return write_str(data); }
protected: protected:
uint8_t* m_data; ///< file data uint8_t* m_data; ///< file data
@ -4120,7 +4120,7 @@ namespace stdex
/// ///
/// Returns total size of pending data in the queue /// Returns total size of pending data in the queue
/// ///
inline size_t size() const { return m_size; }; size_t size() const { return m_size; };
protected: protected:
size_t m_offset, m_size; size_t m_offset, m_size;

View File

@ -142,12 +142,12 @@ namespace stdex
/// ///
/// Returns true if object has a valid handle /// Returns true if object has a valid handle
/// ///
inline operator bool() const noexcept { return m_h != invalid_handle; } operator bool() const noexcept { return m_h != invalid_handle; }
/// ///
/// Returns object handle /// Returns object handle
/// ///
inline sys_handle get() const noexcept { return m_h; } sys_handle get() const noexcept { return m_h; }
protected: protected:
/// ///

View File

@ -70,7 +70,7 @@ namespace stdex
inline charset_id charset_from_name(_In_z_ const char* name) inline charset_id charset_from_name(_In_z_ const char* name)
{ {
struct charset_less { struct charset_less {
inline bool operator()(_In_z_ const char* a, _In_z_ const char* b) const bool operator()(_In_z_ const char* a, _In_z_ const char* b) const
{ {
return stdex::stricmp(a, b) < 0; return stdex::stricmp(a, b) < 0;
} }
@ -120,7 +120,7 @@ namespace stdex
/// <param name="name">Charset name</param> /// <param name="name">Charset name</param>
/// <returns>Charset code or `charset_id::system` if match not found</returns> /// <returns>Charset code or `charset_id::system` if match not found</returns>
template <class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>> template <class _Traits = std::char_traits<char>, class _Alloc = std::allocator<char>>
inline charset_id charset_from_name(_In_ const std::basic_string<char, _Traits, _Alloc>& name) charset_id charset_from_name(_In_ const std::basic_string<char, _Traits, _Alloc>& name)
{ {
return charset_from_name(name.c_str()); return charset_from_name(name.c_str());
} }
@ -156,8 +156,8 @@ namespace stdex
} }
#endif #endif
inline charset_id from_encoding() const { return m_from; } charset_id from_encoding() const { return m_from; }
inline charset_id to_encoding() const { return m_to; } charset_id to_encoding() const { return m_to; }
/// ///
/// Convert string and append to string /// Convert string and append to string
@ -309,7 +309,7 @@ namespace stdex
/// \param[in] src Zero-terminated string to convert /// \param[in] src Zero-terminated string to convert
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>>
inline void strcat( void strcat(
_Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst, _Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst,
_In_z_ const T_from* src) _In_z_ const T_from* src)
{ {
@ -323,7 +323,7 @@ namespace stdex
/// \param[in] src String to convert /// \param[in] src String to convert
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>, class _Traits_from = std::char_traits<T_from>, class _Alloc_from = std::allocator<T_from>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>, class _Traits_from = std::char_traits<T_from>, class _Alloc_from = std::allocator<T_from>>
inline void strcat( void strcat(
_Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst, _Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst,
_In_ const std::basic_string<T_from, _Traits_from, _Alloc_from>& src) _In_ const std::basic_string<T_from, _Traits_from, _Alloc_from>& src)
{ {
@ -338,7 +338,7 @@ namespace stdex
/// \param[in] count_src String to convert code unit limit /// \param[in] count_src String to convert code unit limit
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>>
inline void strcpy( void strcpy(
_Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst, _Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst,
_In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src) _In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
{ {
@ -353,7 +353,7 @@ namespace stdex
/// \param[in] src Zero-terminated string to convert /// \param[in] src Zero-terminated string to convert
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>>
inline void strcpy( void strcpy(
_Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst, _Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst,
_In_z_ const T_from* src) _In_z_ const T_from* src)
{ {
@ -367,7 +367,7 @@ namespace stdex
/// \param[in] src String to convert /// \param[in] src String to convert
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>, class _Traits_from = std::char_traits<T_from>, class _Alloc_from = std::allocator<T_from>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>, class _Traits_from = std::char_traits<T_from>, class _Alloc_from = std::allocator<T_from>>
inline void strcpy( void strcpy(
_Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst, _Inout_ std::basic_string<T_to, _Traits_to, _Alloc_to>& dst,
_In_ const std::basic_string<T_from, _Traits_from, _Alloc_from>& src) _In_ const std::basic_string<T_from, _Traits_from, _Alloc_from>& src)
{ {
@ -381,7 +381,7 @@ namespace stdex
/// \param[in] count_src String to convert code unit limit /// \param[in] count_src String to convert code unit limit
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>>
inline std::basic_string<T_to, _Traits_to, _Alloc_to> convert(_In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src) std::basic_string<T_to, _Traits_to, _Alloc_to> convert(_In_reads_or_z_opt_(count_src) const T_from* src, _In_ size_t count_src)
{ {
std::basic_string<T_to, _Traits_to, _Alloc_to> dst; std::basic_string<T_to, _Traits_to, _Alloc_to> dst;
strcat(dst, src, count_src); strcat(dst, src, count_src);
@ -394,7 +394,7 @@ namespace stdex
/// \param[in] src Zero-terminated string to convert /// \param[in] src Zero-terminated string to convert
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>>
inline std::basic_string<T_to, _Traits_to, _Alloc_to> convert(_In_z_ const T_from* src) std::basic_string<T_to, _Traits_to, _Alloc_to> convert(_In_z_ const T_from* src)
{ {
return convert(src, SIZE_MAX); return convert(src, SIZE_MAX);
} }
@ -405,12 +405,12 @@ namespace stdex
/// \param[in] src String to convert /// \param[in] src String to convert
/// ///
template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>, class _Traits_from = std::char_traits<T_from>, class _Alloc_from = std::allocator<T_from>> template <class _Traits_to = std::char_traits<T_to>, class _Alloc_to = std::allocator<T_to>, class _Traits_from = std::char_traits<T_from>, class _Alloc_from = std::allocator<T_from>>
inline std::basic_string<T_to, _Traits_to, _Alloc_to> convert(_In_ const std::basic_string<T_from, _Traits_from, _Alloc_from>& src) std::basic_string<T_to, _Traits_to, _Alloc_to> convert(_In_ const std::basic_string<T_from, _Traits_from, _Alloc_from>& src)
{ {
return convert(src.data(), src.size()); return convert(src.data(), src.size());
} }
inline void clear() void clear()
{ {
#ifndef _WIN32 #ifndef _WIN32
iconv(m_handle, NULL, NULL, NULL, NULL); iconv(m_handle, NULL, NULL, NULL, NULL);
@ -810,7 +810,7 @@ namespace stdex
/// \return Number of code units excluding zero terminator in the dst string after the operation. /// \return Number of code units excluding zero terminator in the dst string after the operation.
/// ///
template <class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template <class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline size_t normalizecat( size_t normalizecat(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& 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)
{ {
@ -837,7 +837,7 @@ namespace stdex
/// \return Number of code units excluding zero terminator in the dst string after the operation. /// \return Number of code units excluding zero terminator in the dst string after the operation.
/// ///
template <size_t _Size, class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template <size_t _Size, class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline size_t normalizecat( size_t normalizecat(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst,
_In_ const wchar_t (&src)[_Size]) _In_ const wchar_t (&src)[_Size])
{ {
@ -853,7 +853,7 @@ namespace stdex
/// \return Number of code units excluding zero terminator in the dst string after the operation. /// \return Number of code units excluding zero terminator in the dst string after the operation.
/// ///
template <class _Traits_dst = std::char_traits<wchar_t>, class _Alloc_dst = std::allocator<wchar_t>, class _Traits_src = std::char_traits<wchar_t>, class _Alloc_src = std::allocator<wchar_t>> template <class _Traits_dst = std::char_traits<wchar_t>, class _Alloc_dst = std::allocator<wchar_t>, class _Traits_src = std::char_traits<wchar_t>, class _Alloc_src = std::allocator<wchar_t>>
inline size_t normalizecat( size_t normalizecat(
_Inout_ std::basic_string<wchar_t, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<wchar_t, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<wchar_t, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<wchar_t, _Traits_src, _Alloc_src>& src)
{ {
@ -870,7 +870,7 @@ namespace stdex
/// \return Number of code units excluding zero terminator in the dst string after the operation. /// \return Number of code units excluding zero terminator in the dst string after the operation.
/// ///
template <class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template <class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline size_t normalize( size_t normalize(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& 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)
{ {
@ -887,7 +887,7 @@ namespace stdex
/// \return Number of code units excluding zero terminator in the dst string after the operation. /// \return Number of code units excluding zero terminator in the dst string after the operation.
/// ///
template <size_t _Size, class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template <size_t _Size, class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline size_t normalize( size_t normalize(
_Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst, _Inout_ std::basic_string<wchar_t, _Traits, _Alloc>& dst,
_In_ const wchar_t(&src)[_Size]) _In_ const wchar_t(&src)[_Size])
{ {
@ -903,7 +903,7 @@ namespace stdex
/// \return Number of code units excluding zero terminator in the dst string after the operation. /// \return Number of code units excluding zero terminator in the dst string after the operation.
/// ///
template <class _Traits_dst = std::char_traits<wchar_t>, class _Alloc_dst = std::allocator<wchar_t>, class _Traits_src = std::char_traits<wchar_t>, class _Alloc_src = std::allocator<wchar_t>> template <class _Traits_dst = std::char_traits<wchar_t>, class _Alloc_dst = std::allocator<wchar_t>, class _Traits_src = std::char_traits<wchar_t>, class _Alloc_src = std::allocator<wchar_t>>
inline size_t normalize( size_t normalize(
_Inout_ std::basic_string<wchar_t, _Traits_dst, _Alloc_dst>& dst, _Inout_ std::basic_string<wchar_t, _Traits_dst, _Alloc_dst>& dst,
_In_ const std::basic_string<wchar_t, _Traits_src, _Alloc_src>& src) _In_ const std::basic_string<wchar_t, _Traits_src, _Alloc_src>& src)
{ {
@ -933,7 +933,7 @@ namespace stdex
/// \return Normalized string /// \return Normalized string
/// ///
template <size_t _Size> template <size_t _Size>
inline std::wstring normalize(_In_ const wchar_t(&src)[_Size]) std::wstring normalize(_In_ const wchar_t(&src)[_Size])
{ {
std::wstring dst; std::wstring dst;
normalizecat(dst, src, _Size); normalizecat(dst, src, _Size);
@ -948,7 +948,7 @@ namespace stdex
/// \return Normalized string /// \return Normalized string
/// ///
template <class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>> template <class _Traits = std::char_traits<wchar_t>, class _Alloc = std::allocator<wchar_t>>
inline std::wstring normalize(_In_ const std::basic_string<wchar_t, _Traits, _Alloc>& src) std::wstring normalize(_In_ const std::basic_string<wchar_t, _Traits, _Alloc>& src)
{ {
std::wstring dst; std::wstring dst;
normalizecat(dst, src.data(), src.size()); normalizecat(dst, src.data(), src.size());

View File

@ -455,7 +455,7 @@ namespace stdex
} }
template <class T> template <class T>
inline _Success_(return!=0) bool find_first( _Success_(return!=0) bool find_first(
_In_ stdex::stream::basic_file& dat, _In_ stdex::stream::basic_file& dat,
_In_ id_t subid, _In_ id_t subid,
_In_ stdex::stream::fpos_t block_end = stdex::stream::fpos_max, _In_ stdex::stream::fpos_t block_end = stdex::stream::fpos_max,
@ -487,7 +487,7 @@ namespace stdex
} }
template <class T> template <class T>
inline _Success_(return != 0) bool read_first( _Success_(return != 0) bool read_first(
_In_ stdex::stream::basic_file& dat, _In_ stdex::stream::basic_file& dat,
_Inout_ T& content, _Inout_ T& content,
_In_ stdex::stream::fpos_t block_end = stdex::stream::fpos_max) _In_ stdex::stream::fpos_t block_end = stdex::stream::fpos_max)