copy_options.h 2.4 KB

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