perm_options.h 2.0 KB

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