blob: c3e2900d30255f230da458f82ec022a47fe7cf5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include <unicode.h>
#include <string>
// output operators must be in same namespace as the type itself
namespace std {
#ifdef __cpp_char8_t
std::ostream& operator<<(std::ostream& os, std::basic_string<utf8_t> const& s);
#endif
std::ostream& operator<<(std::ostream& os, std::basic_string<char16_t> const& s);
std::ostream& operator<<(std::ostream& os, std::basic_string<char32_t> const& s);
} // namespace std
template<typename From, typename To>
std::basic_string<To> std_convert(const std::basic_string<From>& s);
template<>
std::basic_string<utf8_t> std_convert<utf8_t, utf8_t>(const std::basic_string<utf8_t>& s);
template<>
std::basic_string<char16_t> std_convert<utf8_t, char16_t>(const std::basic_string<utf8_t>& s);
template<>
std::basic_string<char32_t> std_convert<utf8_t, char32_t>(const std::basic_string<utf8_t>& s);
template<>
std::basic_string<utf8_t> std_convert<char16_t, utf8_t>(const std::basic_string<char16_t>& s);
template<>
std::basic_string<char16_t> std_convert<char16_t, char16_t>(const std::basic_string<char16_t>& s);
template<>
std::basic_string<char32_t> std_convert<char16_t, char32_t>(const std::basic_string<char16_t>& s);
template<>
std::basic_string<utf8_t> std_convert<char32_t, utf8_t>(const std::basic_string<char32_t>& s);
template<>
std::basic_string<char16_t> std_convert<char32_t, char16_t>(const std::basic_string<char32_t>& s);
template<>
std::basic_string<char32_t> std_convert<char32_t, char32_t>(const std::basic_string<char32_t>& s);
|