formatter.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  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. #ifndef _LIBCPP___FORMAT_FORMATTER_H
  10. #define _LIBCPP___FORMAT_FORMATTER_H
  11. #include <__availability>
  12. #include <__config>
  13. #include <__format/format_fwd.h>
  14. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  15. # pragma GCC system_header
  16. #endif
  17. _LIBCPP_BEGIN_NAMESPACE_STD
  18. #if _LIBCPP_STD_VER > 17
  19. /// The default formatter template.
  20. ///
  21. /// [format.formatter.spec]/5
  22. /// If F is a disabled specialization of formatter, these values are false:
  23. /// - is_default_constructible_v<F>,
  24. /// - is_copy_constructible_v<F>,
  25. /// - is_move_constructible_v<F>,
  26. /// - is_copy_assignable<F>, and
  27. /// - is_move_assignable<F>.
  28. template <class _Tp, class _CharT>
  29. struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter {
  30. formatter() = delete;
  31. formatter(const formatter&) = delete;
  32. formatter& operator=(const formatter&) = delete;
  33. };
  34. # if _LIBCPP_STD_VER > 20
  35. template <class _Tp>
  36. _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) {
  37. if constexpr (requires { __formatter.set_debug_format(); })
  38. __formatter.set_debug_format();
  39. }
  40. # endif // _LIBCPP_STD_VER > 20
  41. #endif // _LIBCPP_STD_VER > 17
  42. _LIBCPP_END_NAMESPACE_STD
  43. #endif // _LIBCPP___FORMAT_FORMATTER_H