diff --git a/include/stdex/sgml.hpp b/include/stdex/sgml.hpp index b82614191..f3741d58f 100644 --- a/include/stdex/sgml.hpp +++ b/include/stdex/sgml.hpp @@ -173,6 +173,28 @@ namespace stdex } } + /// + /// Convert SGML string to Unicode (UTF-16 on Windows) and append to string + /// + /// \param[inout] dst String to append Unicode to + /// \param[in] src SGML string + /// \param[in] skip Bitwise flag of stdex::sgml_* constants that list SGML entities to skip converting + /// \param[in] offset Logical starting offset of source and destination strings. Unused when map parameter is nullptr. + /// \param[out] map The vector to append index mapping between source and destination string to. + /// + /// \return Unicode string + /// + template + inline void sgml2str( + _Inout_ std::wstring& dst, + _In_ const std::basic_string& src, + _In_ int skip = 0, + _In_ const mapping& offset = mapping(0, 0), + _Inout_opt_ mapping_vector* map = nullptr) + { + sgml2str(dst, src.data(), src.size(), skip, offset, map); + } + /// /// Convert SGML string to Unicode string (UTF-16 on Windows) /// @@ -196,6 +218,26 @@ namespace stdex return dst; } + /// + /// Convert SGML string to Unicode string (UTF-16 on Windows) + /// + /// \param[in] src SGML string + /// \param[in] skip Bitwise flag of stdex::sgml_* constants that list SGML entities to skip converting + /// \param[in] offset Logical starting offset of source and destination strings. Unused when map parameter is nullptr. + /// \param[out] map The vector to append index mapping between source and destination string to. + /// + /// \return Unicode string + /// + template + inline std::wstring sgml2str( + _In_ const std::basic_string& src, + _In_ int skip = 0, + _In_ const mapping& offset = mapping(0, 0), + _Inout_opt_ mapping_vector* map = nullptr) + { + return sgml2str(src.c_str(), src.size(), skip, offset, map); + } + /// \cond internal inline const char* chr2sgml(_In_reads_or_z_(count) const wchar_t* entity, _In_ size_t count) { @@ -329,6 +371,21 @@ namespace stdex } } + /// + /// Convert Unicode string (UTF-16 on Windows) to SGML and append to string + /// + /// \param[inout] dst String to append SGML to + /// \param[in] src Unicode string + /// \param[in] what Bitwise flag of stdex::sgml_* constants that force extra characters otherwise not converted to SGML + /// + inline void str2sgml( + _Inout_ std::string& dst, + _In_ const std::wstring& src, + _In_ size_t what = 0) + { + str2sgml(dst, src.c_str(), src.size(), what); + } + /// /// Convert Unicode string (UTF-16 on Windows) to SGML string /// @@ -347,4 +404,19 @@ namespace stdex str2sgml(dst, src, count_src, what); return dst; } + + /// + /// Convert Unicode string (UTF-16 on Windows) to SGML string + /// + /// \param[in] src Unicode string + /// \param[in] what Bitwise flag of stdex::sgml_* constants that force extra characters otherwise not converted to SGML + /// + /// \return SGML string + /// + inline std::string str2sgml( + _In_ const std::wstring& src, + _In_ size_t what = 0) + { + return str2sgml(src.c_str(), src.size(), what); + } }