// // Copyright (c) 2022-2023 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_LOCALE_DETAIL_ENCODING_HPP_INCLUDED #define BOOST_LOCALE_DETAIL_ENCODING_HPP_INCLUDED #include #include #include #include #include /// \cond INTERNAL namespace boost { namespace locale { namespace conv { namespace detail { template class BOOST_SYMBOL_VISIBLE charset_converter { public: using char_out_type = CharOut; using char_in_type = CharIn; using string_type = std::basic_string; virtual ~charset_converter() = default; virtual string_type convert(const CharIn* begin, const CharIn* end) = 0; string_type convert(const boost::basic_string_view& text) { return convert(text.data(), text.data() + text.length()); } }; using narrow_converter = charset_converter; template using utf_encoder = charset_converter; template using utf_decoder = charset_converter; enum class conv_backend { Default, IConv, ICU, WinAPI }; template BOOST_LOCALE_DECL std::unique_ptr> make_utf_encoder(const std::string& charset, method_type how, conv_backend impl = conv_backend::Default); template BOOST_LOCALE_DECL std::unique_ptr> make_utf_decoder(const std::string& charset, method_type how, conv_backend impl = conv_backend::Default); BOOST_LOCALE_DECL std::unique_ptr make_narrow_converter(const std::string& src_encoding, const std::string& target_encoding, method_type how, conv_backend impl = conv_backend::Default); }}}} // namespace boost::locale::conv::detail /// \endcond #endif