copy_options.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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_COPY_OPTIONS_H
  10. #define _LIBCPP___FILESYSTEM_COPY_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. enum class copy_options : unsigned short {
  19. none = 0,
  20. skip_existing = 1,
  21. overwrite_existing = 2,
  22. update_existing = 4,
  23. recursive = 8,
  24. copy_symlinks = 16,
  25. skip_symlinks = 32,
  26. directories_only = 64,
  27. create_symlinks = 128,
  28. create_hard_links = 256,
  29. __in_recursive_copy = 512,
  30. };
  31. _LIBCPP_INLINE_VISIBILITY
  32. inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
  33. return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
  34. static_cast<unsigned short>(__rhs));
  35. }
  36. _LIBCPP_INLINE_VISIBILITY
  37. inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
  38. return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
  39. static_cast<unsigned short>(__rhs));
  40. }
  41. _LIBCPP_INLINE_VISIBILITY
  42. inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
  43. return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
  44. static_cast<unsigned short>(__rhs));
  45. }
  46. _LIBCPP_INLINE_VISIBILITY
  47. inline constexpr copy_options operator~(copy_options __lhs) {
  48. return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
  49. }
  50. _LIBCPP_INLINE_VISIBILITY
  51. inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
  52. return __lhs = __lhs & __rhs;
  53. }
  54. _LIBCPP_INLINE_VISIBILITY
  55. inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
  56. return __lhs = __lhs | __rhs;
  57. }
  58. _LIBCPP_INLINE_VISIBILITY
  59. inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
  60. return __lhs = __lhs ^ __rhs;
  61. }
  62. _LIBCPP_END_NAMESPACE_FILESYSTEM
  63. #endif // _LIBCPP_CXX03_LANG
  64. #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H