directory_options.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_DIRECTORY_OPTIONS_H
  10. #define _LIBCPP___FILESYSTEM_DIRECTORY_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. #ifndef _LIBCPP_CXX03_LANG
  17. _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
  18. _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
  19. enum class _LIBCPP_ENUM_VIS directory_options : unsigned char {
  20. none = 0,
  21. follow_directory_symlink = 1,
  22. skip_permission_denied = 2
  23. };
  24. _LIBCPP_INLINE_VISIBILITY
  25. inline constexpr directory_options operator&(directory_options _LHS,
  26. directory_options _RHS) {
  27. return static_cast<directory_options>(static_cast<unsigned char>(_LHS) &
  28. static_cast<unsigned char>(_RHS));
  29. }
  30. _LIBCPP_INLINE_VISIBILITY
  31. inline constexpr directory_options operator|(directory_options _LHS,
  32. directory_options _RHS) {
  33. return static_cast<directory_options>(static_cast<unsigned char>(_LHS) |
  34. static_cast<unsigned char>(_RHS));
  35. }
  36. _LIBCPP_INLINE_VISIBILITY
  37. inline constexpr directory_options operator^(directory_options _LHS,
  38. directory_options _RHS) {
  39. return static_cast<directory_options>(static_cast<unsigned char>(_LHS) ^
  40. static_cast<unsigned char>(_RHS));
  41. }
  42. _LIBCPP_INLINE_VISIBILITY
  43. inline constexpr directory_options operator~(directory_options _LHS) {
  44. return static_cast<directory_options>(~static_cast<unsigned char>(_LHS));
  45. }
  46. _LIBCPP_INLINE_VISIBILITY
  47. inline directory_options& operator&=(directory_options& _LHS,
  48. directory_options _RHS) {
  49. return _LHS = _LHS & _RHS;
  50. }
  51. _LIBCPP_INLINE_VISIBILITY
  52. inline directory_options& operator|=(directory_options& _LHS,
  53. directory_options _RHS) {
  54. return _LHS = _LHS | _RHS;
  55. }
  56. _LIBCPP_INLINE_VISIBILITY
  57. inline directory_options& operator^=(directory_options& _LHS,
  58. directory_options _RHS) {
  59. return _LHS = _LHS ^ _RHS;
  60. }
  61. _LIBCPP_AVAILABILITY_FILESYSTEM_POP
  62. _LIBCPP_END_NAMESPACE_FILESYSTEM
  63. #endif // _LIBCPP_CXX03_LANG
  64. #endif // _LIBCPP___FILESYSTEM_DIRECTORY_OPTIONS_H