10#include <initializer_list>
22#include <unordered_map>
23#include <unordered_set>
29template<
class type_t>
struct __tunit_is_printable : std::false_type {};
30template<>
struct __tunit_is_printable<bool> : std::true_type {};
31template<>
struct __tunit_is_printable<char> : std::true_type {};
32template<>
struct __tunit_is_printable<signed char> : std::true_type {};
33template<>
struct __tunit_is_printable<unsigned char> : std::true_type {};
34template<>
struct __tunit_is_printable<wchar_t> : std::true_type {};
35template<>
struct __tunit_is_printable<char8_t> : std::true_type {};
36template<>
struct __tunit_is_printable<char16_t> : std::true_type {};
37template<>
struct __tunit_is_printable<char32_t> : std::true_type {};
38template<>
struct __tunit_is_printable<short> : std::true_type {};
39template<>
struct __tunit_is_printable<unsigned short> : std::true_type {};
40template<>
struct __tunit_is_printable<int> : std::true_type {};
41template<>
struct __tunit_is_printable<unsigned int> : std::true_type {};
42template<>
struct __tunit_is_printable<long> : std::true_type {};
43template<>
struct __tunit_is_printable<unsigned long> : std::true_type {};
44template<>
struct __tunit_is_printable<long long> : std::true_type {};
45template<>
struct __tunit_is_printable<unsigned long long> : std::true_type {};
46template<>
struct __tunit_is_printable<const char*> : std::true_type {};
47template<>
struct __tunit_is_printable<const wchar_t*> : std::true_type {};
48template<>
struct __tunit_is_printable<float> : std::true_type {};
49template<>
struct __tunit_is_printable<double> : std::true_type {};
50template<>
struct __tunit_is_printable<long double> : std::true_type {};
51template<>
struct __tunit_is_printable<std::string> : std::true_type {};
52template<>
struct __tunit_is_printable<
xtd::ustring> : std::true_type {};
53template<>
struct __tunit_is_printable<std::u8string> : std::true_type {};
54template<>
struct __tunit_is_printable<std::u16string> : std::true_type {};
55template<>
struct __tunit_is_printable<std::u32string> : std::true_type {};
56template<>
struct __tunit_is_printable<std::wstring> : std::true_type {};
58template<
typename char_t,
typename char_traits_t,
typename value_t>
59static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os,
const value_t& value, std::true_type) {
63template<
typename char_t,
typename char_traits_t,
typename value_t>
64static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os, value_t* value, std::true_type) {
68template<
typename char_t,
typename char_traits_t,
typename value_t>
69static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os,
const value_t* value, std::true_type) {
73template<
typename char_t,
typename char_traits_t,
typename value_t>
74static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os,
const value_t& value, std::false_type) {
75 size_t size =
sizeof(value) > 32 ? 32 : sizeof(value);
76 os <<
size <<
"-byte object <";
77 for (
size_t index = 0; index !=
size; index++)
78 os << (index != 0 ? (index % 2 == 0 ?
" " :
"-") :
"") << std::hex << std::setiosflags(std::ios_base::uppercase) << std::setw(2) << std::setfill(
'0') << static_cast<int>(reinterpret_cast<const unsigned char*>(&value)[index]) << std::resetiosflags(std::ios_base::dec) << std::dec;
79 os << (
size <
sizeof(value) ?
"-..." :
"") <<
">";
82template<
typename char_t,
typename char_traits_t,
typename value_t>
83static void __print(std::basic_ostream<char_t, char_traits_t>& os,
const value_t& value) {
84 __tunit_print_value(os, value, __tunit_is_printable<value_t>());
87template<
typename char_t,
typename char_traits_t,
typename value_t>
88static void __print(std::basic_ostream<char_t, char_traits_t>& os, value_t* value) {
89 __tunit_print_value(os, value, __tunit_is_printable<value_t>());
92template<
typename char_t,
typename char_traits_t,
typename value_t>
93static void __print(std::basic_ostream<char_t, char_traits_t>& os,
const value_t* value) {
94 __tunit_print_value(os, value, __tunit_is_printable<value_t>());
97template <
typename char_t,
typename char_traits_t,
typename value_t>
98struct __tunit_value_printer {
99 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const value_t* & value) {
102 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const value_t*
const & value) {
105 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const value_t& value) {
110template <
typename char_t,
typename char_traits_t>
111struct __tunit_value_printer<char_t, char_traits_t, std::exception> {
112 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::exception& value) {
113 os <<
"exception: " << value.what();
117template <
typename char_t,
typename char_traits_t,
typename value_t>
118struct __tunit_value_printer<char_t, char_traits_t, std::optional<value_t>> {
119 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::optional<value_t>& value) {
120 if (!value.has_value())
124 __tunit_value_printer<char_t, char_traits_t, value_t>::print(os, value.value());
130template <
typename char_t,
typename char_traits_t>
131struct __tunit_value_printer<char_t, char_traits_t, std::string> {
132 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::string& value) {
133 os <<
"\"" << value <<
"\"";
137template <
typename char_t,
typename char_traits_t>
138struct __tunit_value_printer<char_t, char_traits_t,
xtd::ustring> {
139 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::string& value) {
140 os <<
"\"" << value <<
"\"";
144template <
typename char_t,
typename char_traits_t>
145struct __tunit_value_printer<char_t, char_traits_t, std::u8string> {
146 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::u8string& value) {
147 __tunit_value_printer<char_t, char_traits_t, char8_t>::print(os, value.c_str());
151template <
typename char_t,
typename char_traits_t>
152struct __tunit_value_printer<char_t, char_traits_t, std::u16string> {
153 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::u16string& value) {
154 __tunit_value_printer<char_t, char_traits_t, char16_t>::print(os, value.c_str());
158template <
typename char_t,
typename char_traits_t>
159struct __tunit_value_printer<char_t, char_traits_t, std::u32string> {
160 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::u32string& value) {
161 __tunit_value_printer<char_t, char_traits_t, char32_t>::print(os, value.c_str());
165template <
typename char_t,
typename char_traits_t>
166struct __tunit_value_printer<char_t, char_traits_t, std::wstring> {
167 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::wstring& value) {
168 __tunit_value_printer<char_t, char_traits_t, wchar_t>::print(os, value.c_str());
172template <
typename char_t,
typename char_traits_t>
173struct __tunit_value_printer<char_t, char_traits_t, const char*> {
174 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char*
const & value) {
175 os <<
"\"" << value <<
"\"";
178 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char* & value) {
179 os <<
"\"" << value <<
"\"";
182 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char value) {
187template <
typename char_t,
typename char_traits_t>
188struct __tunit_value_printer<char_t, char_traits_t, char> {
189 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char*
const & value) {
190 os <<
"\"" << value <<
"\"";
193 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char* & value) {
194 os <<
"\"" << value <<
"\"";
197 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char value) {
202template <
typename char_t,
typename char_traits_t>
203struct __tunit_value_printer<char_t, char_traits_t, const char8_t*> {
204 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char8_t*
const & value) {
206 for (
size_t index = 0; value[index] != L
'\0'; index++)
207 __tunit_value_printer<char_t, char_traits_t, char8_t>::print(os, value[index]);
211 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char8_t* & value) {
213 for (
size_t index = 0; value[index] != L
'\0'; index++)
214 __tunit_value_printer<char_t, char_traits_t, char8_t>::print(os, value[index]);
218 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char8_t value) {
220 os << static_cast<char>(value);
222 os <<
"\\x" << std::hex << static_cast<int>(value);
226template <
typename char_t,
typename char_traits_t>
227struct __tunit_value_printer<char_t, char_traits_t, char8_t> {
228 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char8_t*
const & value) {
230 for (
size_t index = 0; value[index] != L
'\0'; index++)
231 __tunit_value_printer<char_t, char_traits_t, char8_t>::print(os, value[index]);
235 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char8_t* & value) {
237 for (
size_t index = 0; value[index] != L
'\0'; index++)
238 __tunit_value_printer<char_t, char_traits_t, char8_t>::print(os, value[index]);
242 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char8_t value) {
243 os << static_cast<char>(value);
247template <
typename char_t,
typename char_traits_t>
248struct __tunit_value_printer<char_t, char_traits_t, const char16_t*> {
249 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char16_t*
const & value) {
251 for (
size_t index = 0; value[index] != L
'\0'; index++)
252 __tunit_value_printer<char_t, char_traits_t, char16_t>::print(os, value[index]);
256 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char16_t* & value) {
258 for (
size_t index = 0; value[index] != L
'\0'; index++)
259 __tunit_value_printer<char_t, char_traits_t, char16_t>::print(os, value[index]);
263 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char16_t value) {
265 os << static_cast<char>(value);
267 os <<
"\\x" << std::hex << static_cast<int>(value);
271template <
typename char_t,
typename char_traits_t>
272struct __tunit_value_printer<char_t, char_traits_t, char16_t> {
273 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char16_t*
const & value) {
275 for (
size_t index = 0; value[index] != L
'\0'; index++)
276 __tunit_value_printer<char_t, char_traits_t, char16_t>::print(os, value[index]);
280 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char16_t* & value) {
282 for (
size_t index = 0; value[index] != L
'\0'; index++)
283 __tunit_value_printer<char_t, char_traits_t, char16_t>::print(os, value[index]);
287 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char16_t value) {
289 os << static_cast<char>(value);
291 os <<
"\\x" << std::hex << static_cast<int>(value);
295template <
typename char_t,
typename char_traits_t>
296struct __tunit_value_printer<char_t, char_traits_t, const char32_t*> {
297 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char32_t*
const & value) {
299 for (
size_t index = 0; value[index] != L
'\0'; index++)
300 __tunit_value_printer<char_t, char_traits_t, char32_t>::print(os, value[index]);
304 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char32_t* & value) {
306 for (
size_t index = 0; value[index] != L
'\0'; index++)
307 __tunit_value_printer<char_t, char_traits_t, char32_t>::print(os, value[index]);
311 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char32_t value) {
313 os << static_cast<char>(value);
315 os <<
"\\x" << std::hex << static_cast<int>(value);
319template <
typename char_t,
typename char_traits_t>
320struct __tunit_value_printer<char_t, char_traits_t, char32_t> {
321 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char32_t*
const & value) {
323 for (
size_t index = 0; value[index] != L
'\0'; index++)
324 __tunit_value_printer<char_t, char_traits_t, char32_t>::print(os, value[index]);
328 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const char32_t* & value) {
330 for (
size_t index = 0; value[index] != L
'\0'; index++)
331 __tunit_value_printer<char_t, char_traits_t, char32_t>::print(os, value[index]);
335 static void print(std::basic_ostream<char_t, char_traits_t>& os,
char32_t value) {
337 os << static_cast<char>(value);
339 os <<
"\\x" << std::hex << static_cast<int>(value);
343template <
typename char_t,
typename char_traits_t>
344struct __tunit_value_printer<char_t, char_traits_t, const wchar_t*> {
345 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const wchar_t*
const & value) {
347 for (
size_t index = 0; value[index] != L
'\0'; index++)
348 __tunit_value_printer<char_t, char_traits_t, wchar_t>::print(os, value[index]);
352 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const wchar_t* & value) {
354 for (
size_t index = 0; value[index] != L
'\0'; index++)
355 __tunit_value_printer<char_t, char_traits_t, wchar_t>::print(os, value[index]);
359 static void print(std::basic_ostream<char_t, char_traits_t>& os,
wchar_t value) {
361 os << static_cast<char>(value);
363 os <<
"\\x" << std::hex << static_cast<int>(value);
367template <
typename char_t,
typename char_traits_t>
368struct __tunit_value_printer<char_t, char_traits_t, wchar_t> {
369 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const wchar_t*
const & value) {
371 for (
size_t index = 0; value[index] != L
'\0'; index++)
372 __tunit_value_printer<char_t, char_traits_t, wchar_t>::print(os, value[index]);
376 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const wchar_t* & value) {
378 for (
size_t index = 0; value[index] != L
'\0'; index++)
379 __tunit_value_printer<char_t, char_traits_t, wchar_t>::print(os, value[index]);
383 static void print(std::basic_ostream<char_t, char_traits_t>& os,
wchar_t value) {
385 os << static_cast<char>(value);
387 os <<
"\\x" << std::hex << static_cast<int>(value);
391template <
typename char_t,
typename char_traits_t,
typename type1_t,
typename type2_t>
392struct __tunit_value_printer<char_t, char_traits_t, std::pair<type1_t, type2_t>> {
393 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::pair<type1_t, type2_t>& value) {
395 __tunit_value_printer<char_t, char_traits_t, type1_t>::print(os, value.first);
397 __tunit_value_printer<char_t, char_traits_t, type2_t>::print(os, value.second);
402template<
typename char_t,
typename char_traits_t,
typename type_t,
unsigned N,
unsigned Last>
403struct __tuple_printer {
404 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const type_t& value) {
405 __tunit_value_printer<char_t, char_traits_t, typename std::tuple_element<N, type_t>::type>::print(os, std::get<N>(value));
407 __tuple_printer<char_t, char_traits_t, type_t, N + 1, Last>::print(os, value);
411template<
typename char_t,
typename char_traits_t,
typename type_t,
unsigned N>
412struct __tuple_printer<char_t, char_traits_t, type_t, N, N> {
413 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const type_t& value) {
414 __tunit_value_printer<char_t, char_traits_t, typename std::tuple_element<N, type_t>::type>::print(os, std::get<N>(value));
418template <
typename char_t,
typename char_traits_t,
typename ... Types>
419struct __tunit_value_printer<char_t, char_traits_t, std::tuple<Types ...>> {
420 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::tuple<Types ...>& value) {
422 __tuple_printer<char_t, char_traits_t, std::tuple<Types ...>, 0,
sizeof...(Types) - 1>::print(os, value);
427template <
typename char_t,
typename char_traits_t>
428struct __tunit_value_printer<char_t, char_traits_t, std::tuple<>> {
429 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::tuple<>&) {
434template <
typename char_t,
typename char_traits_t,
typename Iterator>
435std::basic_ostream<char_t, char_traits_t>& __print_sequence_container(std::basic_ostream<char_t, char_traits_t>& os,
const Iterator& begin,
const Iterator& end) {
438 for (Iterator it = begin; it !=
end; ++it) {
439 if (!first) os <<
", ";
440 __tunit_value_printer<char_t, char_traits_t, typename std::iterator_traits<Iterator>::value_type>::print(os, *it);
446template <
typename char_t,
typename char_traits_t,
typename value_t,
size_t Size>
447struct __tunit_value_printer<char_t, char_traits_t, std::array<value_t, Size>> {
448 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::array<value_t, Size>& values) {
449 __print_sequence_container(os, values.begin(), values.end());
453template <
typename char_t,
typename char_traits_t,
typename value_t>
454struct __tunit_value_printer<char_t, char_traits_t, std::deque<value_t>> {
455 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::deque<value_t>& values) {
456 __print_sequence_container(os, values.begin(), values.end());
460template <
typename char_t,
typename char_traits_t,
typename value_t>
461struct __tunit_value_printer<char_t, char_traits_t, std::forward_list<value_t>> {
462 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::forward_list<value_t>& values) {
463 __print_sequence_container(os, values.begin(), values.end());
467template <
typename char_t,
typename char_traits_t,
typename value_t>
468struct __tunit_value_printer<char_t, char_traits_t, std::list<value_t>> {
469 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::list<value_t>& values) {
470 __print_sequence_container(os, values.begin(), values.end());
474template <
typename char_t,
typename char_traits_t,
typename value_t>
475struct __tunit_value_printer<char_t, char_traits_t, std::initializer_list<value_t>> {
476 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::initializer_list<value_t>& values) {
477 __print_sequence_container(os, values.begin(), values.end());
481template <
typename char_t,
typename char_traits_t,
typename value_t>
482struct __tunit_value_printer<char_t, char_traits_t, std::vector<value_t>> {
483 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::vector<value_t>& values) {
484 __print_sequence_container(os, values.begin(), values.end());
488template <
typename char_t,
typename char_traits_t,
typename Iterator>
489std::basic_ostream<char_t, char_traits_t>& __print_associative_container(std::basic_ostream<char_t, char_traits_t>& os,
const Iterator& begin,
const Iterator& end) {
492 for (Iterator it = begin; it !=
end; ++it) {
493 if (!first) os <<
", ";
494 __tunit_value_printer<char_t, char_traits_t, typename std::iterator_traits<Iterator>::value_type>::print(os, *it);
500template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
501struct __tunit_value_printer<char_t, char_traits_t, std::map<Key, value_t>> {
502 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::map<Key, value_t>& values) {
503 __print_associative_container(os, values.begin(), values.end());
507template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
508struct __tunit_value_printer<char_t, char_traits_t, std::multimap<Key, value_t>> {
509 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::multimap<Key, value_t>& values) {
510 __print_associative_container(os, values.begin(), values.end());
514template <
typename char_t,
typename char_traits_t,
typename value_t>
515struct __tunit_value_printer<char_t, char_traits_t, std::multiset<value_t>> {
516 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::multiset<value_t>& values) {
517 __print_associative_container(os, values.begin(), values.end());
521template <
typename char_t,
typename char_traits_t,
typename value_t>
522struct __tunit_value_printer<char_t, char_traits_t, std::set<value_t>> {
523 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::set<value_t>& values) {
524 __print_associative_container(os, values.begin(), values.end());
528template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
529struct __tunit_value_printer<char_t, char_traits_t, std::unordered_map<Key, value_t>> {
530 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::unordered_map<Key, value_t>& values) {
531 __print_associative_container(os, values.begin(), values.end());
535template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
536struct __tunit_value_printer<char_t, char_traits_t, std::unordered_multimap<Key, value_t>> {
537 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::unordered_multimap<Key, value_t>& values) {
538 __print_associative_container(os, values.begin(), values.end());
542template <
typename char_t,
typename char_traits_t,
typename value_t>
543struct __tunit_value_printer<char_t, char_traits_t, std::unordered_multiset<value_t>> {
544 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::unordered_multiset<value_t>& values) {
545 __print_associative_container(os, values.begin(), values.end());
549template <
typename char_t,
typename char_traits_t,
typename value_t>
550struct __tunit_value_printer<char_t, char_traits_t, std::unordered_set<value_t>> {
551 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const std::unordered_set<value_t>& values) {
552 __print_associative_container(os, values.begin(), values.end());
556template <
typename char_t,
typename char_traits_t,
typename type_t>
557std::basic_ostream<char_t, char_traits_t>& operator<<(std::basic_ostream<char_t, char_traits_t>& os,
const type_t& value) {
558 __tunit_value_printer<char_t, char_traits_t, type_t>::print(os, value);
562template <
typename char_t,
typename char_traits_t,
typename type_t>
563std::basic_ostream<char_t, char_traits_t>& operator<<(std::basic_ostream<char_t, char_traits_t>& os,
const type_t* value) {
564 __tunit_value_printer<char_t, char_traits_t, type_t>::print(os, value);
568template <
typename char_t,
typename char_traits_t,
typename type_t>
569std::basic_ostream<char_t, char_traits_t>& operator<<(std::basic_ostream<char_t, char_traits_t>& os, type_t* value) {
570 __tunit_value_printer<char_t, char_traits_t, type_t>::print(os, value);
574inline std::string __tunit_codepoint_to_string(
char32_t codepoint) {
576 if (codepoint < 0x80) {
577 result.push_back(
static_cast<char>(codepoint));
578 }
else if (codepoint < 0x800) {
579 result.push_back(
static_cast<char>((codepoint >> 6) | 0xc0));
580 result.push_back(
static_cast<char>((codepoint & 0x3f) | 0x80));
581 }
else if (codepoint < 0x10000) {
582 result.push_back(
static_cast<char>((codepoint >> 12) | 0xe0));
583 result.push_back(
static_cast<char>(((codepoint >> 6) & 0x3f) | 0x80));
584 result.push_back(
static_cast<char>((codepoint & 0x3f) | 0x80));
586 result.push_back(
static_cast<char>((codepoint >> 18) | 0xf0));
587 result.push_back(
static_cast<char>(((codepoint >> 12) & 0x3f) | 0x80));
588 result.push_back(
static_cast<char>(((codepoint >> 6) & 0x3f) | 0x80));
589 result.push_back(
static_cast<char>((codepoint & 0x3f) | 0x80));
594inline std::string __tunit_to_string(
const char8_t& value) {
595 std::stringstream ss;
596 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
600inline std::string __tunit_to_string(
const char16_t& value) {
601 std::stringstream ss;
602 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
606inline std::string __tunit_to_string(
const char32_t& value) {
607 std::stringstream ss;
608 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
612inline std::string __tunit_to_string(
const wchar_t& value) {
613 std::stringstream ss;
614 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
618inline std::string __tunit_to_string(
const std::string& value) {
619 std::stringstream ss;
620 ss <<
"\"" << value <<
"\"";
624inline std::string __tunit_to_string(
const xtd::ustring& value) {
625 std::stringstream ss;
626 ss <<
"\"" << value <<
"\"";
630inline std::string __tunit_to_string(
const std::u8string& value) {
631 std::stringstream ss;
632 ss <<
"\"" << value <<
"\"";
636inline std::string __tunit_to_string(
const std::u16string& value) {
639 for (
auto codepoint : value)
640 result += __tunit_codepoint_to_string(codepoint);
645inline std::string __tunit_to_string(
const std::u32string& value) {
648 for (
auto codepoint : value)
649 result += __tunit_codepoint_to_string(codepoint);
654inline std::string __tunit_to_string(
const std::wstring& value) {
657 for (
auto codepoint : value)
658 result += __tunit_codepoint_to_string(codepoint);
663inline std::string __tunit_to_string(
const char* value) {
664 std::stringstream ss;
665 ss <<
"\"" << value <<
"\"";
669inline std::string __tunit_to_string(
const char8_t* value) {
670 return __tunit_to_string(std::u8string(value));
673inline std::string __tunit_to_string(
const char16_t* value) {
674 return __tunit_to_string(std::u16string(value));
677inline std::string __tunit_to_string(
const char32_t* value) {
678 return __tunit_to_string(std::u32string(value));
681inline std::string __tunit_to_string(
const wchar_t* value) {
682 return __tunit_to_string(std::wstring(value));
685template <
typename value_t>
686inline std::string __tunit_to_string(
const value_t& value) {
687 std::stringstream ss;
692template <
typename value_t>
693inline std::string __tunit_to_string(
const value_t* value) {
694 std::stringstream ss;
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
size_t size
Represents a size of any object in bytes.
Definition types.h:171
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::ustring class.