xref: /freebsd/contrib/llvm-project/libcxx/include/__format/formatter.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1349cc55cSDimitry Andric // -*- C++ -*-
2349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
3349cc55cSDimitry Andric //
4349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
6349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7349cc55cSDimitry Andric //
8349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
9349cc55cSDimitry Andric 
10349cc55cSDimitry Andric #ifndef _LIBCPP___FORMAT_FORMATTER_H
11349cc55cSDimitry Andric #define _LIBCPP___FORMAT_FORMATTER_H
12349cc55cSDimitry Andric 
13349cc55cSDimitry Andric #include <__config>
14*0fca6ea1SDimitry Andric #include <__fwd/format.h>
15349cc55cSDimitry Andric 
16349cc55cSDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17349cc55cSDimitry Andric #  pragma GCC system_header
18349cc55cSDimitry Andric #endif
19349cc55cSDimitry Andric 
20349cc55cSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
21349cc55cSDimitry Andric 
2206c3fb27SDimitry Andric #if _LIBCPP_STD_VER >= 20
23349cc55cSDimitry Andric 
2404eeddc0SDimitry Andric /// The default formatter template.
2504eeddc0SDimitry Andric ///
2604eeddc0SDimitry Andric /// [format.formatter.spec]/5
2704eeddc0SDimitry Andric /// If F is a disabled specialization of formatter, these values are false:
2804eeddc0SDimitry Andric /// - is_default_constructible_v<F>,
2904eeddc0SDimitry Andric /// - is_copy_constructible_v<F>,
3004eeddc0SDimitry Andric /// - is_move_constructible_v<F>,
3104eeddc0SDimitry Andric /// - is_copy_assignable<F>, and
3204eeddc0SDimitry Andric /// - is_move_assignable<F>.
33349cc55cSDimitry Andric template <class _Tp, class _CharT>
3406c3fb27SDimitry Andric struct _LIBCPP_TEMPLATE_VIS formatter {
3504eeddc0SDimitry Andric   formatter()                            = delete;
3604eeddc0SDimitry Andric   formatter(const formatter&)            = delete;
3704eeddc0SDimitry Andric   formatter& operator=(const formatter&) = delete;
38349cc55cSDimitry Andric };
39349cc55cSDimitry Andric 
4006c3fb27SDimitry Andric #  if _LIBCPP_STD_VER >= 23
41349cc55cSDimitry Andric 
42bdd1243dSDimitry Andric template <class _Tp>
__set_debug_format(_Tp & __formatter)43bdd1243dSDimitry Andric _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) {
44bdd1243dSDimitry Andric   if constexpr (requires { __formatter.set_debug_format(); })
45bdd1243dSDimitry Andric     __formatter.set_debug_format();
46bdd1243dSDimitry Andric }
47349cc55cSDimitry Andric 
4806c3fb27SDimitry Andric #  endif // _LIBCPP_STD_VER >= 23
4906c3fb27SDimitry Andric #endif   // _LIBCPP_STD_VER >= 20
50349cc55cSDimitry Andric 
51349cc55cSDimitry Andric _LIBCPP_END_NAMESPACE_STD
52349cc55cSDimitry Andric 
53349cc55cSDimitry Andric #endif // _LIBCPP___FORMAT_FORMATTER_H
54