perm_options.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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___FILESYSTEM_PERM_OPTIONS_H
  10. #define _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
  11. #include <__availability>
  12. #include <__config>
  13. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  14. # pragma GCC system_header
  15. #endif
  16. #if _LIBCPP_STD_VER >= 17
  17. _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
  18. enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
  19. _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
  20. return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
  21. }
  22. _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
  23. return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
  24. }
  25. _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
  26. return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
  27. }
  28. _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
  29. return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
  30. }
  31. _LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
  32. return __lhs = __lhs & __rhs;
  33. }
  34. _LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
  35. return __lhs = __lhs | __rhs;
  36. }
  37. _LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
  38. return __lhs = __lhs ^ __rhs;
  39. }
  40. _LIBCPP_END_NAMESPACE_FILESYSTEM
  41. #endif // _LIBCPP_STD_VER >= 17
  42. #endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H