xtd 1.0.0
Loading...
Searching...
No Matches
to_string.hpp
Go to the documentation of this file.
1
4#pragma once
6#define __XTD_CORE_INTERNAL__
19#undef __XTD_CORE_INTERNAL__
22#include "iterable.hpp"
24#include "textual.hpp"
25#include "types.hpp"
26#include "string.hpp"
27#include <filesystem>
28#if __cpp_lib_mdspan
29#include <mdspan>
30#endif
31
32
34namespace xtd {
35 /*
46 template<typename value_t>
47 requires (requires (const xtd::raw_type<value_t>& value, const xtd::string& fmt) {{value.to_string(fmt)} -> xtd::textual;})
48 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
49
60 template<typename value_t>
61 requires (!requires (const xtd::raw_type<value_t>& value, const xtd::string& fmt) {{value.to_string(fmt)} -> xtd::textual;} && requires (const xtd::raw_type<value_t>& value) {{value.to_string()} -> xtd::textual;})
62 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
63 */
64
75 template<typename value_t>
76 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
77
88 template<>
89 inline auto to_string(const bool& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
90
101 template<>
102 inline auto to_string(const sbyte& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
103
114 template<>
115 inline auto to_string(const char& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
116
127 template<>
128 inline auto to_string(const unsigned char& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
129
140 template<>
141 inline auto to_string(const short& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
142
153 template<>
154 inline auto to_string(const unsigned short& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
155
166 template<>
167 inline auto to_string(const int& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
168
179 template<>
180 inline auto to_string(const unsigned int& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
181
192 template<>
193 inline auto to_string(const long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
194
205 template<>
206 inline auto to_string(const unsigned long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
207
218 template<>
219 inline auto to_string(const long long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
220
231 template<>
232 inline auto to_string(const unsigned long long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
233
244 template<>
245 inline auto to_string(const float& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
246
257 template<>
258 inline auto to_string(const double& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
259
270 template<>
271 inline auto to_string(const long double& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
272
283 template<>
284 inline auto to_string(const std::chrono::system_clock::time_point& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
285
296 template<>
297 inline auto to_string(const std::tm& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
298
309 template<typename type_t, typename period_t>
310 inline auto to_string(const std::chrono::duration<type_t, period_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
311
322 template<>
323 inline auto to_string(const char8& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
324
335 template<>
336 inline auto to_string(const char16& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
337
348 template<>
349 inline auto to_string(const char32& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
350
361 template<>
362 inline auto to_string(const wchar& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
363
365 auto to_string(const char* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
366 auto to_string(const char8* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
367 auto to_string(const char16* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
368 auto to_string(const char32* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
369 auto to_string(const wchar* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
370 auto to_string(const std::string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
371 auto to_string(const xtd::string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
372 auto to_string(const std::u8string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
373 auto to_string(const std::u16string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
374 auto to_string(const std::u32string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
375 auto to_string(const std::wstring& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
377
387 template<typename value_t>
388 inline auto to_string(const value_t& value, const xtd::string& fmt) -> xtd::string;
389
391 inline auto to_string(const char* value, const xtd::string& fmt) -> xtd::string;
392
393 template<>
394 inline auto to_string(const std::partial_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
395
396 template<>
397 inline auto to_string(const std::strong_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
398
399 template<>
400 inline auto to_string(const std::weak_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
401
402 template<typename value_t>
403 inline auto to_string(const value_t* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
404
405 template<typename value_t>
406 inline auto to_string(value_t* const value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
407
408 template<typename type_t>
409 inline auto to_string(const std::shared_ptr<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
410
411 template<typename type_t>
412 inline auto to_string(const std::unique_ptr<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
413
414 template<>
415 inline auto to_string(const xtd::any& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
416
417 template<typename type_t>
418 inline auto to_string(const std::optional<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
419
420 template<>
421 inline auto to_string(const std::nullopt_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
422
423 template<>
424 inline auto to_string(const std::nullptr_t&, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
425
426 template<typename type1_t, typename type2_t>
427 inline auto to_string(const std::pair<type1_t, type2_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
428
429 template<typename type_t, unsigned n_t, unsigned last_t>
430 struct __xtd_tuple_stringer {
431 static auto to_string(const std::string& str, const type_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
432 };
433
434 template<typename type_t, unsigned n_t>
435 struct __xtd_tuple_stringer<type_t, n_t, n_t> {
436 static auto to_string(const std::string& str, const type_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
437 };
438
439 template<typename ...types_t>
440 inline auto to_string(const std::tuple<types_t ...>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
441
442 template<typename char_t, typename traits_t>
443 inline auto to_string(const std::basic_string_view<char_t, traits_t>& chars, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
444
445 template<typename type_t, xtd::usize size>
446 inline auto to_string(const std::array<type_t, size>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
447
448 template<xtd::usize size>
449 inline auto to_string(const std::bitset<size>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
450
451 template<typename type_t, typename allocator_t>
452 inline auto to_string(const std::deque<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
453
454 template<typename type_t, typename allocator_t>
455 inline auto to_string(const std::forward_list<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
456
457 template<typename type_t>
458 inline auto to_string(const std::initializer_list<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
459
460 template<typename type_t, typename allocator_t>
461 inline auto to_string(const std::list<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
462
463 template<typename type_t, typename container_t>
464 inline auto to_string(const std::queue<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
465
466 template<typename type_t, typename container_t>
467 inline auto to_string(const std::priority_queue<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
468
469 template<typename type_t, typename container_t>
470 inline auto to_string(const std::stack<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
471
472 template<typename type_t>
473 inline auto to_string(const std::valarray<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
474
475 template<typename type_t, typename allocator_t>
476 inline auto to_string(const std::vector<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
477
478 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
479 inline auto to_string(const std::map<key_t, value_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
480
481 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
482 inline auto to_string(const std::multimap<key_t, value_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
483
484 template<typename key_t, typename compare_t, typename allocator_t>
485 inline auto to_string(const std::multiset<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
486
487 template<typename key_t, typename compare_t, typename allocator_t>
488 inline auto to_string(const std::set<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
489
490 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
491 inline auto to_string(const std::unordered_map<key_t, value_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
492
493 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
494 inline auto to_string(const std::unordered_multimap<key_t, value_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
495
496 template<typename key_t, typename compare_t, typename allocator_t>
497 inline auto to_string(const std::unordered_multiset<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
498
499 template<typename key_t, typename compare_t, typename allocator_t>
500 inline auto to_string(const std::unordered_set<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
501
502 template<typename ...args_t>
503 inline auto to_string(const std::variant<args_t...>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
504
505#if __cpp_lib_mdspan
506 template<typename type_t, typename extents_t, typename layout_policy_t = std::layout_right, typename accessor_policy_t = std::default_accessor<type_t>>
507 inline auto to_string(const std::mdspan<type_t, extents_t, layout_policy_t, accessor_policy_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
508#endif
509
510 template<typename type_t>
511 inline auto to_string(type_t value, const std::initializer_list<std::pair<type_t, xtd::string>>& il) -> xtd::string;
512
513 auto to_string(const std::locale& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
514
515 template<>
516 inline auto to_string(const std::filesystem::path& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
517
518 template<typename type_t>
519 inline auto to_string(const xtd::collections::generic::ienumerable<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
520
521 template<typename type_t>
522 inline auto to_string(const xtd::collections::generic::helpers::raw_array<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
523
524 template<typename type_t, typename string_t>
525 inline auto to_string(type_t value, const std::map<type_t, string_t, std::greater<type_t>>& values) -> string_t;
526
527 template<typename type_t, typename string_t>
528 inline auto to_string(type_t value, const std::map<type_t, string_t>& values) -> string_t;
530}
531
532#define __XTD_TO_STRING_INTERNAL__
533#include "to_string_.hpp"
534#undef __XTD_TO_STRING_INTERNAL__
Contains generic stream output methods.
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
std::int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.hpp:23
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
std::any any
Represents the any alias on std::any.
Definition any.hpp:24
Contains xtd::iterable concept.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
auto to_string() const noexcept -> xtd::string override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:354
Contains xtd::register_any_stringer and xtd::unregister_any_stringer method.
Contains xtd::string alias.
Contains xtd::textual concept.
Contains xtd::to_string methods.
Contains xtd fundamental types.