150
|
1 // -*- C++ -*-
|
236
|
2 //===----------------------------------------------------------------------===//
|
150
|
3 //
|
|
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
5 // See https://llvm.org/LICENSE.txt for license information.
|
|
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
7 //
|
|
8 //===----------------------------------------------------------------------===//
|
|
9
|
|
10 #ifndef _LIBCPP_CHARCONV
|
|
11 #define _LIBCPP_CHARCONV
|
|
12
|
|
13 /*
|
|
14 charconv synopsis
|
|
15
|
|
16 namespace std {
|
|
17
|
|
18 // floating-point format for primitive numerical conversion
|
|
19 enum class chars_format {
|
|
20 scientific = unspecified,
|
|
21 fixed = unspecified,
|
|
22 hex = unspecified,
|
|
23 general = fixed | scientific
|
|
24 };
|
|
25
|
|
26 // 23.20.2, primitive numerical output conversion
|
|
27 struct to_chars_result {
|
|
28 char* ptr;
|
|
29 errc ec;
|
236
|
30 friend bool operator==(const to_chars_result&, const to_chars_result&) = default; // since C++20
|
150
|
31 };
|
|
32
|
236
|
33 constexpr to_chars_result to_chars(char* first, char* last, see below value,
|
|
34 int base = 10); // constexpr since C++23
|
|
35 to_chars_result to_chars(char* first, char* last, bool value,
|
|
36 int base = 10) = delete;
|
150
|
37
|
|
38 to_chars_result to_chars(char* first, char* last, float value);
|
|
39 to_chars_result to_chars(char* first, char* last, double value);
|
|
40 to_chars_result to_chars(char* first, char* last, long double value);
|
|
41
|
|
42 to_chars_result to_chars(char* first, char* last, float value,
|
|
43 chars_format fmt);
|
|
44 to_chars_result to_chars(char* first, char* last, double value,
|
|
45 chars_format fmt);
|
|
46 to_chars_result to_chars(char* first, char* last, long double value,
|
|
47 chars_format fmt);
|
|
48
|
|
49 to_chars_result to_chars(char* first, char* last, float value,
|
|
50 chars_format fmt, int precision);
|
|
51 to_chars_result to_chars(char* first, char* last, double value,
|
|
52 chars_format fmt, int precision);
|
|
53 to_chars_result to_chars(char* first, char* last, long double value,
|
|
54 chars_format fmt, int precision);
|
|
55
|
|
56 // 23.20.3, primitive numerical input conversion
|
|
57 struct from_chars_result {
|
|
58 const char* ptr;
|
|
59 errc ec;
|
236
|
60 friend bool operator==(const from_chars_result&, const from_chars_result&) = default; // since C++20
|
150
|
61 };
|
|
62
|
236
|
63 constexpr from_chars_result from_chars(const char* first, const char* last,
|
|
64 see below& value, int base = 10); // constexpr since C++23
|
150
|
65
|
|
66 } // namespace std
|
|
67
|
|
68 */
|
|
69
|
236
|
70 #include <__assert> // all public C++ headers provide the assertion handler
|
|
71 #include <__charconv/chars_format.h>
|
252
|
72 #include <__charconv/from_chars_integral.h>
|
236
|
73 #include <__charconv/from_chars_result.h>
|
|
74 #include <__charconv/tables.h>
|
252
|
75 #include <__charconv/to_chars.h>
|
236
|
76 #include <__charconv/to_chars_base_10.h>
|
252
|
77 #include <__charconv/to_chars_floating_point.h>
|
|
78 #include <__charconv/to_chars_integral.h>
|
236
|
79 #include <__charconv/to_chars_result.h>
|
252
|
80 #include <__charconv/traits.h>
|
173
|
81 #include <__config>
|
252
|
82 #include <__system_error/errc.h>
|
221
|
83 #include <cmath> // for log2f
|
|
84 #include <cstdint>
|
150
|
85 #include <limits>
|
|
86
|
|
87 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
236
|
88 # pragma GCC system_header
|
150
|
89 #endif
|
|
90
|
|
91 _LIBCPP_BEGIN_NAMESPACE_STD
|
|
92
|
|
93 _LIBCPP_END_NAMESPACE_STD
|
|
94
|
236
|
95 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
|
252
|
96 # include <concepts>
|
|
97 # include <cstdlib>
|
|
98 # include <cstring>
|
236
|
99 # include <iosfwd>
|
252
|
100 # include <type_traits>
|
236
|
101 #endif
|
|
102
|
221
|
103 #endif // _LIBCPP_CHARCONV
|