123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- #ifndef BOOST_NOWIDE_CONVERT_HPP_INCLUDED
- #define BOOST_NOWIDE_CONVERT_HPP_INCLUDED
- #include <boost/nowide/detail/is_string_container.hpp>
- #include <boost/nowide/utf/convert.hpp>
- #include <string>
- namespace boost {
- namespace nowide {
-
-
-
-
-
-
-
- inline char* narrow(char* output, size_t output_size, const wchar_t* begin, const wchar_t* end)
- {
- return utf::convert_buffer(output, output_size, begin, end);
- }
-
-
-
-
-
-
-
- inline char* narrow(char* output, size_t output_size, const wchar_t* source)
- {
- return narrow(output, output_size, source, source + utf::strlen(source));
- }
-
-
-
-
-
-
-
- inline wchar_t* widen(wchar_t* output, size_t output_size, const char* begin, const char* end)
- {
- return utf::convert_buffer(output, output_size, begin, end);
- }
-
-
-
-
-
-
-
- inline wchar_t* widen(wchar_t* output, size_t output_size, const char* source)
- {
- return widen(output, output_size, source, source + utf::strlen(source));
- }
-
-
-
-
-
-
-
- template<typename T_Char, typename = detail::requires_wide_char<T_Char>>
- inline std::string narrow(const T_Char* s, size_t count)
- {
- return utf::convert_string<char>(s, s + count);
- }
-
-
-
-
-
-
- template<typename T_Char, typename = detail::requires_wide_char<T_Char>>
- inline std::string narrow(const T_Char* s)
- {
- return narrow(s, utf::strlen(s));
- }
-
-
-
-
-
-
- template<typename StringOrStringView, typename = detail::requires_wide_string_container<StringOrStringView>>
- inline std::string narrow(const StringOrStringView& s)
- {
- return utf::convert_string<char>(s.data(), s.data() + s.size());
- }
-
-
-
-
-
-
-
- template<typename T_Char, typename = detail::requires_narrow_char<T_Char>>
- inline std::wstring widen(const T_Char* s, size_t count)
- {
- return utf::convert_string<wchar_t>(s, s + count);
- }
-
-
-
-
-
-
- template<typename T_Char, typename = detail::requires_narrow_char<T_Char>>
- inline std::wstring widen(const T_Char* s)
- {
- return widen(s, utf::strlen(s));
- }
-
-
-
-
-
-
- template<typename StringOrStringView, typename = detail::requires_narrow_string_container<StringOrStringView>>
- inline std::wstring widen(const StringOrStringView& s)
- {
- return utf::convert_string<wchar_t>(s.data(), s.data() + s.size());
- }
- }
- }
- #endif
|