9 #include <forward_list>
10 #include <initializer_list>
20 #include <type_traits>
22 #include <unordered_map>
23 #include <unordered_set>
29 template<
class type_t>
struct __tunit_is_printable : std::false_type {};
30 template<>
struct __tunit_is_printable<bool> : std::true_type {};
31 template<>
struct __tunit_is_printable<char> : std::true_type {};
32 template<>
struct __tunit_is_printable<signed char> : std::true_type {};
33 template<>
struct __tunit_is_printable<unsigned char> : std::true_type {};
34 template<>
struct __tunit_is_printable<wchar_t> : std::true_type {};
35 template<>
struct __tunit_is_printable<char8_t> : std::true_type {};
36 template<>
struct __tunit_is_printable<char16_t> : std::true_type {};
37 template<>
struct __tunit_is_printable<char32_t> : std::true_type {};
38 template<>
struct __tunit_is_printable<short> : std::true_type {};
39 template<>
struct __tunit_is_printable<unsigned short> : std::true_type {};
40 template<>
struct __tunit_is_printable<int> : std::true_type {};
41 template<>
struct __tunit_is_printable<unsigned int> : std::true_type {};
42 template<>
struct __tunit_is_printable<long> : std::true_type {};
43 template<>
struct __tunit_is_printable<unsigned long> : std::true_type {};
44 template<>
struct __tunit_is_printable<long long> : std::true_type {};
45 template<>
struct __tunit_is_printable<unsigned long long> : std::true_type {};
46 template<>
struct __tunit_is_printable<const char*> : std::true_type {};
47 template<>
struct __tunit_is_printable<const wchar_t*> : std::true_type {};
48 template<>
struct __tunit_is_printable<float> : std::true_type {};
49 template<>
struct __tunit_is_printable<double> : std::true_type {};
50 template<>
struct __tunit_is_printable<long double> : std::true_type {};
51 template<>
struct __tunit_is_printable<std::string> : std::true_type {};
52 template<>
struct __tunit_is_printable<
xtd::ustring> : std::true_type {};
53 template<>
struct __tunit_is_printable<std::u8string> : std::true_type {};
54 template<>
struct __tunit_is_printable<std::u16string> : std::true_type {};
55 template<>
struct __tunit_is_printable<std::u32string> : std::true_type {};
56 template<>
struct __tunit_is_printable<std::wstring> : std::true_type {};
58 template<
typename char_t,
typename char_traits_t,
typename value_t>
59 static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os,
const value_t& value, std::true_type) {
63 template<
typename char_t,
typename char_traits_t,
typename value_t>
64 static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os, value_t* value, std::true_type) {
68 template<
typename char_t,
typename char_traits_t,
typename value_t>
69 static void __tunit_print_value(std::basic_ostream<char_t, char_traits_t>& os,
const value_t* value, std::true_type) {
73 template<
typename char_t,
typename char_traits_t,
typename value_t>
74 static 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) ?
"-..." :
"") <<
">";
82 template<
typename char_t,
typename char_traits_t,
typename value_t>
83 static 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>());
87 template<
typename char_t,
typename char_traits_t,
typename value_t>
88 static 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>());
92 template<
typename char_t,
typename char_traits_t,
typename value_t>
93 static 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>());
97 template <
typename char_t,
typename char_traits_t,
typename value_t>
98 struct __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) {
110 template <
typename char_t,
typename char_traits_t>
111 struct __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();
117 template <
typename char_t,
typename char_traits_t,
typename value_t>
118 struct __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());
130 template <
typename char_t,
typename char_traits_t>
131 struct __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 <<
"\"";
137 template <
typename char_t,
typename char_traits_t>
138 struct __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 <<
"\"";
144 template <
typename char_t,
typename char_traits_t>
145 struct __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());
151 template <
typename char_t,
typename char_traits_t>
152 struct __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());
158 template <
typename char_t,
typename char_traits_t>
159 struct __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());
165 template <
typename char_t,
typename char_traits_t>
166 struct __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());
172 template <
typename char_t,
typename char_traits_t>
173 struct __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) {
187 template <
typename char_t,
typename char_traits_t>
188 struct __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) {
202 template <
typename char_t,
typename char_traits_t>
203 struct __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);
226 template <
typename char_t,
typename char_traits_t>
227 struct __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);
247 template <
typename char_t,
typename char_traits_t>
248 struct __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);
271 template <
typename char_t,
typename char_traits_t>
272 struct __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);
295 template <
typename char_t,
typename char_traits_t>
296 struct __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);
319 template <
typename char_t,
typename char_traits_t>
320 struct __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);
343 template <
typename char_t,
typename char_traits_t>
344 struct __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);
367 template <
typename char_t,
typename char_traits_t>
368 struct __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);
391 template <
typename char_t,
typename char_traits_t,
typename type1_t,
typename type2_t>
392 struct __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);
402 template<
typename char_t,
typename char_traits_t,
typename type_t,
unsigned N,
unsigned Last>
403 struct __tuple_printer {
404 static void print(std::basic_ostream<char_t, char_traits_t>& os,
const type_t& value) {
407 __tuple_printer<char_t, char_traits_t, type_t, N + 1, Last>::print(os, value);
411 template<
typename char_t,
typename char_traits_t,
typename type_t,
unsigned N>
412 struct __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) {
418 template <
typename char_t,
typename char_traits_t,
typename ... Types>
419 struct __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);
427 template <
typename char_t,
typename char_traits_t>
428 struct __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<>&) {
434 template <
typename char_t,
typename char_traits_t,
typename Iterator>
435 std::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);
446 template <
typename char_t,
typename char_traits_t,
typename value_t,
size_t Size>
447 struct __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());
453 template <
typename char_t,
typename char_traits_t,
typename value_t>
454 struct __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());
460 template <
typename char_t,
typename char_traits_t,
typename value_t>
461 struct __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());
467 template <
typename char_t,
typename char_traits_t,
typename value_t>
468 struct __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());
474 template <
typename char_t,
typename char_traits_t,
typename value_t>
475 struct __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());
481 template <
typename char_t,
typename char_traits_t,
typename value_t>
482 struct __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());
488 template <
typename char_t,
typename char_traits_t,
typename Iterator>
489 std::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);
500 template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
501 struct __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());
507 template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
508 struct __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());
514 template <
typename char_t,
typename char_traits_t,
typename value_t>
515 struct __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());
521 template <
typename char_t,
typename char_traits_t,
typename value_t>
522 struct __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());
528 template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
529 struct __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());
535 template <
typename char_t,
typename char_traits_t,
typename Key,
typename value_t>
536 struct __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());
542 template <
typename char_t,
typename char_traits_t,
typename value_t>
543 struct __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());
549 template <
typename char_t,
typename char_traits_t,
typename value_t>
550 struct __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());
556 template <
typename char_t,
typename char_traits_t,
typename type_t>
557 std::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);
562 template <
typename char_t,
typename char_traits_t,
typename type_t>
563 std::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);
568 template <
typename char_t,
typename char_traits_t,
typename type_t>
569 std::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);
574 inline 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));
594 inline std::string __tunit_to_string(
const char8_t& value) {
595 std::stringstream ss;
596 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
600 inline std::string __tunit_to_string(
const char16_t& value) {
601 std::stringstream ss;
602 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
606 inline std::string __tunit_to_string(
const char32_t& value) {
607 std::stringstream ss;
608 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
612 inline std::string __tunit_to_string(
const wchar_t& value) {
613 std::stringstream ss;
614 ss <<
"\"" << __tunit_codepoint_to_string(value) <<
"\"";
618 inline std::string __tunit_to_string(
const std::string& value) {
619 std::stringstream ss;
620 ss <<
"\"" << value <<
"\"";
624 inline std::string __tunit_to_string(
const xtd::ustring& value) {
625 std::stringstream ss;
626 ss <<
"\"" << value <<
"\"";
630 inline std::string __tunit_to_string(
const std::u8string& value) {
631 std::stringstream ss;
632 ss <<
"\"" << value <<
"\"";
636 inline std::string __tunit_to_string(
const std::u16string& value) {
639 for (
auto codepoint : value)
640 result += __tunit_codepoint_to_string(codepoint);
645 inline std::string __tunit_to_string(
const std::u32string& value) {
648 for (
auto codepoint : value)
649 result += __tunit_codepoint_to_string(codepoint);
654 inline std::string __tunit_to_string(
const std::wstring& value) {
657 for (
auto codepoint : value)
658 result += __tunit_codepoint_to_string(codepoint);
663 inline std::string __tunit_to_string(
const char* value) {
664 std::stringstream ss;
665 ss <<
"\"" << value <<
"\"";
669 inline std::string __tunit_to_string(
const char8_t* value) {
670 return __tunit_to_string(std::u8string(value));
673 inline std::string __tunit_to_string(
const char16_t* value) {
674 return __tunit_to_string(std::u16string(value));
677 inline std::string __tunit_to_string(
const char32_t* value) {
678 return __tunit_to_string(std::u32string(value));
681 inline std::string __tunit_to_string(
const wchar_t* value) {
682 return __tunit_to_string(std::wstring(value));
685 template <
typename value_t>
686 inline std::string __tunit_to_string(
const value_t& value) {
687 std::stringstream ss;
692 template <
typename value_t>
693 inline 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
std::type_info type
Stores information about a type.
Definition: types.h:179
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::ustring class.