1*4bdff4beSrobert // -*- C++ -*-
2*4bdff4beSrobert //===----------------------------------------------------------------------===//
3*4bdff4beSrobert //
4*4bdff4beSrobert // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*4bdff4beSrobert // See https://llvm.org/LICENSE.txt for license information.
6*4bdff4beSrobert // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*4bdff4beSrobert //
8*4bdff4beSrobert //===----------------------------------------------------------------------===//
9*4bdff4beSrobert 
10*4bdff4beSrobert #ifndef _LIBCPP___CHARCONV_CHARS_FORMAT_H
11*4bdff4beSrobert #define _LIBCPP___CHARCONV_CHARS_FORMAT_H
12*4bdff4beSrobert 
13*4bdff4beSrobert #include <__config>
14*4bdff4beSrobert #include <__utility/to_underlying.h>
15*4bdff4beSrobert 
16*4bdff4beSrobert #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17*4bdff4beSrobert #  pragma GCC system_header
18*4bdff4beSrobert #endif
19*4bdff4beSrobert 
20*4bdff4beSrobert _LIBCPP_BEGIN_NAMESPACE_STD
21*4bdff4beSrobert 
22*4bdff4beSrobert #if _LIBCPP_STD_VER > 14
23*4bdff4beSrobert 
24*4bdff4beSrobert enum class _LIBCPP_ENUM_VIS chars_format
25*4bdff4beSrobert {
26*4bdff4beSrobert     scientific = 0x1,
27*4bdff4beSrobert     fixed = 0x2,
28*4bdff4beSrobert     hex = 0x4,
29*4bdff4beSrobert     general = fixed | scientific
30*4bdff4beSrobert };
31*4bdff4beSrobert 
32*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format
33*4bdff4beSrobert operator~(chars_format __x) {
34*4bdff4beSrobert   return chars_format(~_VSTD::__to_underlying(__x));
35*4bdff4beSrobert }
36*4bdff4beSrobert 
37*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format
38*4bdff4beSrobert operator&(chars_format __x, chars_format __y) {
39*4bdff4beSrobert   return chars_format(_VSTD::__to_underlying(__x) &
40*4bdff4beSrobert                       _VSTD::__to_underlying(__y));
41*4bdff4beSrobert }
42*4bdff4beSrobert 
43*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format
44*4bdff4beSrobert operator|(chars_format __x, chars_format __y) {
45*4bdff4beSrobert   return chars_format(_VSTD::__to_underlying(__x) |
46*4bdff4beSrobert                       _VSTD::__to_underlying(__y));
47*4bdff4beSrobert }
48*4bdff4beSrobert 
49*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format
50*4bdff4beSrobert operator^(chars_format __x, chars_format __y) {
51*4bdff4beSrobert   return chars_format(_VSTD::__to_underlying(__x) ^
52*4bdff4beSrobert                       _VSTD::__to_underlying(__y));
53*4bdff4beSrobert }
54*4bdff4beSrobert 
55*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format&
56*4bdff4beSrobert operator&=(chars_format& __x, chars_format __y) {
57*4bdff4beSrobert   __x = __x & __y;
58*4bdff4beSrobert   return __x;
59*4bdff4beSrobert }
60*4bdff4beSrobert 
61*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format&
62*4bdff4beSrobert operator|=(chars_format& __x, chars_format __y) {
63*4bdff4beSrobert   __x = __x | __y;
64*4bdff4beSrobert   return __x;
65*4bdff4beSrobert }
66*4bdff4beSrobert 
67*4bdff4beSrobert inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format&
68*4bdff4beSrobert operator^=(chars_format& __x, chars_format __y) {
69*4bdff4beSrobert   __x = __x ^ __y;
70*4bdff4beSrobert   return __x;
71*4bdff4beSrobert }
72*4bdff4beSrobert 
73*4bdff4beSrobert #endif // _LIBCPP_STD_VER > 14
74*4bdff4beSrobert 
75*4bdff4beSrobert _LIBCPP_END_NAMESPACE_STD
76*4bdff4beSrobert 
77*4bdff4beSrobert #endif // _LIBCPP___CHARCONV_CHARS_FORMAT_H
78