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__
20#define __XTD_STD_INTERNAL__
22#undef __XTD_STD_INTERNAL__
26#include "types.hpp"
27#include "string.hpp"
28#include <filesystem>
29
31namespace xtd {
42 template<typename value_t>
43 inline auto to_string(const value_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
44
55 template<>
56 inline auto to_string(const bool& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
57
68 template<>
69 inline auto to_string(const sbyte& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
70
81 template<>
82 inline auto to_string(const char& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
83
94 template<>
95 inline auto to_string(const unsigned char& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
96
107 template<>
108 inline auto to_string(const short& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
109
120 template<>
121 inline auto to_string(const unsigned short& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
122
133 template<>
134 inline auto to_string(const int& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
135
146 template<>
147 inline auto to_string(const unsigned int& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
148
159 template<>
160 inline auto to_string(const long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
161
172 template<>
173 inline auto to_string(const unsigned long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
174
185 template<>
186 inline auto to_string(const long long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
187
198 template<>
199 inline auto to_string(const unsigned long long& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
200
211 template<>
212 inline auto to_string(const float& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
213
224 template<>
225 inline auto to_string(const double& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
226
237 template<>
238 inline auto to_string(const long double& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
239
250 template<>
251 inline auto to_string(const std::chrono::system_clock::time_point& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
252
263 template<>
264 inline auto to_string(const std::tm& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
265
276 template<typename type_t, typename period_t>
277 inline auto to_string(const std::chrono::duration<type_t, period_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
278
289 template<>
290 inline auto to_string(const char8& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
291
302 template<>
303 inline auto to_string(const char16& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
304
315 template<>
316 inline auto to_string(const char32& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
317
328 template<>
329 inline auto to_string(const wchar& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
330
332 auto to_string(const char* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
333 auto to_string(const char8* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
334 auto to_string(const char16* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
335 auto to_string(const char32* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
336 auto to_string(const wchar* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
337 auto to_string(const std::string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
338 auto to_string(const xtd::string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
339 auto to_string(const std::u8string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
340 auto to_string(const std::u16string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
341 auto to_string(const std::u32string& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
342 auto to_string(const std::wstring& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
344
354 template<typename value_t>
355 inline auto to_string(const value_t& value, const xtd::string& fmt) -> xtd::string;
356
358 inline auto to_string(const char* value, const xtd::string& fmt) -> xtd::string;
359
360 template<>
361 inline auto to_string(const std::partial_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
362
363 template<>
364 inline auto to_string(const std::strong_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
365
366 template<>
367 inline auto to_string(const std::weak_ordering& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
368
369 template<typename value_t>
370 inline auto to_string(const value_t* value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
371
372 template<typename value_t>
373 inline auto to_string(value_t* const value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
374
375 template<typename type_t>
376 inline auto to_string(const std::shared_ptr<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
377
378 template<typename type_t>
379 inline auto to_string(const std::unique_ptr<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
380
381 template<>
382 inline auto to_string(const xtd::any& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
383
384 template<typename type_t>
385 inline auto to_string(const std::optional<type_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
386
387 template<>
388 inline auto to_string(const std::nullopt_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
389
390 template<>
391 inline auto to_string(const std::nullptr_t&, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
392
393 template<typename type1_t, typename type2_t>
394 inline auto to_string(const std::pair<type1_t, type2_t>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
395
396 template<typename type_t, unsigned n_t, unsigned last_t>
397 struct __xtd_tuple_stringer {
398 static auto to_string(const std::string& str, const type_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
399 };
400
401 template<typename type_t, unsigned n_t>
402 struct __xtd_tuple_stringer<type_t, n_t, n_t> {
403 static auto to_string(const std::string& str, const type_t& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
404 };
405
406 template<typename ...types_t>
407 inline auto to_string(const std::tuple<types_t ...>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
408
409 template<typename type_t, xtd::usize size>
410 inline auto to_string(const std::array<type_t, size>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
411
412 template<xtd::usize size>
413 inline auto to_string(const std::bitset<size>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
414
415 template<typename type_t, typename allocator_t>
416 inline auto to_string(const std::deque<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
417
418 template<typename type_t, typename allocator_t>
419 inline auto to_string(const std::forward_list<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
420
421 template<typename type_t>
422 inline auto to_string(const std::initializer_list<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
423
424 template<typename type_t, typename allocator_t>
425 inline auto to_string(const std::list<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
426
427 template<typename type_t, typename container_t>
428 inline auto to_string(const std::queue<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
429
430 template<typename type_t, typename container_t>
431 inline auto to_string(const std::priority_queue<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
432
433 template<typename type_t, typename container_t>
434 inline auto to_string(const std::stack<type_t, container_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
435
436 template<typename type_t>
437 inline auto to_string(const std::valarray<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
438
439 template<typename type_t, typename allocator_t>
440 inline auto to_string(const std::vector<type_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
441
442 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
443 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;
444
445 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
446 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;
447
448 template<typename key_t, typename compare_t, typename allocator_t>
449 inline auto to_string(const std::multiset<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
450
451 template<typename key_t, typename compare_t, typename allocator_t>
452 inline auto to_string(const std::set<key_t, compare_t, allocator_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
453
454 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
455 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;
456
457 template<typename key_t, typename value_t, typename compare_t, typename allocator_t>
458 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;
459
460 template<typename key_t, typename compare_t, typename allocator_t>
461 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;
462
463 template<typename key_t, typename compare_t, typename allocator_t>
464 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;
465
466 template<typename ...args_t>
467 inline auto to_string(const std::variant<args_t...>& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
468
469 template<typename type_t>
470 inline auto to_string(type_t value, const std::initializer_list<std::pair<type_t, xtd::string>>& il) -> xtd::string;
471
472 auto to_string(const std::locale& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
473
474 template<>
475 inline auto to_string(const std::filesystem::path& value, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
476
477 #if defined(__xtd__cpp_lib_ranges)
478 //template <std::ranges::range range_t>
479 //inline auto to_string(const range_t& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
480
481 //template <std::ranges::range range_t>
482 //inline auto to_string(const range_t& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
483 #endif
484
485 template<typename type_t>
486 inline auto to_string(const xtd::collections::generic::ienumerable<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
487
488 template<typename type_t>
489 inline auto to_string(const xtd::collections::generic::helpers::raw_array<type_t>& values, const xtd::string& fmt, const std::locale& loc) -> xtd::string;
490
491 template<typename type_t, typename string_t>
492 inline auto to_string(type_t value, const std::map<type_t, string_t, std::greater<type_t>>& values) -> string_t;
493
494 template<typename type_t, typename string_t>
495 inline auto to_string(type_t value, const std::map<type_t, string_t>& values) -> string_t;
497}
498
499#define __XTD_TO_STRING_INTERNAL__
500#include "to_string_.hpp"
501#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
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:342
Contains xtd::register_any_stringer and xtd::unregister_any_stringer method.
Contains xtd::string alias.
Contains xtd::to_string methods.
Contains xtd fundamental types.