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
30namespace xtd {
41 template<class value_t>
42 requires (requires (const xtd::raw_type<value_t>& value, const xtd::string& fmt) {{value.to_string(fmt)} -> xtd::textual;})
43 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
44
55 template<class value_t>
56 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;})
57 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
58
69 template<typename value_t>
70 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
71
82 template<>
83 inline auto to_string(const bool& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
84
95 template<>
96 inline auto to_string(const sbyte& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
97
108 template<>
109 inline auto to_string(const char& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
110
121 template<>
122 inline auto to_string(const unsigned char& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
123
134 template<>
135 inline auto to_string(const short& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
136
147 template<>
148 inline auto to_string(const unsigned short& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
149
160 template<>
161 inline auto to_string(const int& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
162
173 template<>
174 inline auto to_string(const unsigned int& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
175
186 template<>
187 inline auto to_string(const long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
188
199 template<>
200 inline auto to_string(const unsigned long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
201
212 template<>
213 inline auto to_string(const long long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
214
225 template<>
226 inline auto to_string(const unsigned long long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
227
238 template<>
239 inline auto to_string(const float& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
240
251 template<>
252 inline auto to_string(const double& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
253
264 template<>
265 inline auto to_string(const long double& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
266
277 template<>
278 inline auto to_string(const std::chrono::system_clock::time_point& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
279
290 template<>
291 inline auto to_string(const std::tm& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
292
303 template<typename type_t, typename period_t>
304 inline auto to_string(const std::chrono::duration<type_t, period_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
305
316 template<>
317 inline auto to_string(const char8& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
318
329 template<>
330 inline auto to_string(const char16& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
331
342 template<>
343 inline auto to_string(const char32& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
344
355 template<>
356 inline auto to_string(const wchar& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
357
359 auto to_string(const char* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
360 auto to_string(const char8* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
361 auto to_string(const char16* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
362 auto to_string(const char32* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
363 auto to_string(const wchar* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
364 auto to_string(const std::string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
365 auto to_string(const xtd::string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
366 auto to_string(const std::u8string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
367 auto to_string(const std::u16string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
368 auto to_string(const std::u32string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
369 auto to_string(const std::wstring& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
371
381 template<typename value_t>
382 inline auto to_string(const value_t& value, const xtd::string& fmt) -> xtd::string;
383
385 inline auto to_string(const char* value, const xtd::string& fmt) -> xtd::string;
386
387 template<>
388 inline auto to_string(const std::partial_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
389
390 template<>
391 inline auto to_string(const std::strong_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
392
393 template<>
394 inline auto to_string(const std::weak_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
395
396 template<typename value_t>
397 inline auto to_string(const value_t* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
398
399 template<typename value_t>
400 inline auto to_string(value_t* const value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
401
402 template<typename type_t>
403 inline auto to_string(const std::shared_ptr<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
404
405 template<typename type_t>
406 inline auto to_string(const std::unique_ptr<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
407
408 template<>
409 inline auto to_string(const xtd::any& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
410
411 template<typename type_t>
412 inline auto to_string(const std::optional<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
413
414 template<>
415 inline auto to_string(const std::nullopt_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
416
417 template<>
418 inline auto to_string(const std::nullptr_t&, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
419
420 template<typename type1_t, typename type2_t>
421 inline auto to_string(const std::pair<type1_t, type2_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
422
423 template<typename type_t, unsigned n_t, unsigned last_t>
424 struct __xtd_tuple_stringer {
425 static auto to_string(const std::string& str, const type_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
426 };
427
428 template<typename type_t, unsigned n_t>
429 struct __xtd_tuple_stringer<type_t, n_t, n_t> {
430 static auto to_string(const std::string& str, const type_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
431 };
432
433 template<typename ...types_t>
434 inline auto to_string(const std::tuple<types_t ...>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
435
436 template<typename type_t, xtd::usize size>
437 inline auto to_string(const std::array<type_t, size>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
438
439 template<xtd::usize size>
440 inline auto to_string(const std::bitset<size>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
441
442 template<typename type_t, typename allocator_t>
443 inline auto to_string(const std::deque<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
444
445 template<typename type_t, typename allocator_t>
446 inline auto to_string(const std::forward_list<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
447
448 template<typename type_t>
449 inline auto to_string(const std::initializer_list<type_t>& 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::list<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
453
454 template<typename type_t, typename container_t>
455 inline auto to_string(const std::queue<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
456
457 template<typename type_t, typename container_t>
458 inline auto to_string(const std::priority_queue<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
459
460 template<typename type_t, typename container_t>
461 inline auto to_string(const std::stack<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
462
463 template<typename type_t>
464 inline auto to_string(const std::valarray<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
465
466 template<typename type_t, typename allocator_t>
467 inline auto to_string(const std::vector<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
468
469 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
470 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;
471
472 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
473 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;
474
475 template<typename key_t, typename compare_t, typename allocator_t>
476 inline auto to_string(const std::multiset<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
477
478 template<typename key_t, typename compare_t, typename allocator_t>
479 inline auto to_string(const std::set<key_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::unordered_map<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 value_t, typename compare_t, typename allocator_t>
485 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;
486
487 template<typename key_t, typename compare_t, typename allocator_t>
488 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;
489
490 template<typename key_t, typename compare_t, typename allocator_t>
491 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;
492
493 template<typename ...args_t>
494 inline auto to_string(const std::variant<args_t...>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
495
496 template<typename type_t>
497 inline auto to_string(type_t value, const std::initializer_list<std::pair<type_t, xtd::string>>& il) -> xtd::string;
498
499 auto to_string(const std::locale& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
500
501 template<>
502 inline auto to_string(const std::filesystem::path& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
503
504 template<typename type_t>
505 inline auto to_string(const xtd::collections::generic::ienumerable<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
506
507 template<typename type_t>
508 inline auto to_string(const xtd::collections::generic::helpers::raw_array<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
509
510 template<typename type_t, typename string_t>
511 inline auto to_string(type_t value, const std::map<type_t, string_t, std::greater<type_t>>& values) -> string_t;
512
513 template<typename type_t, typename string_t>
514 inline auto to_string(type_t value, const std::map<type_t, string_t>& values) -> string_t;
516}
517
518#define __XTD_TO_STRING_INTERNAL__
519#include "to_string_.hpp"
520#undef __XTD_TO_STRING_INTERNAL__
Definition textual.hpp:16
Contains generic stream output methods.
@ value
Represnets the constant operator precedence (42).
Definition operator_precedence.hpp:30
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
std::remove_cvref_t< value_t > raw_type
Represents a raw type alias equivalent to std::remove_cvref_t<value_t>.
Definition raw_type.hpp:25
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:341
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.