copy_options.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 <__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 copy_options : unsigned short {
  18. none = 0,
  19. skip_existing = 1,
  20. overwrite_existing = 2,
  21. update_existing = 4,
  22. recursive = 8,
  23. copy_symlinks = 16,
  24. skip_symlinks = 32,
  25. directories_only = 64,
  26. create_symlinks = 128,
  27. create_hard_links = 256,
  28. __in_recursive_copy = 512,
  29. };
  30. _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
  31. return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
  32. }
  33. _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
  34. return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
  35. }
  36. _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
  37. return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
  38. }
  39. _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
  40. return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
  41. }
  42. _LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
  43. return __lhs = __lhs & __rhs;
  44. }
  45. _LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
  46. return __lhs = __lhs | __rhs;
  47. }
  48. _LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
  49. return __lhs = __lhs ^ __rhs;
  50. }
  51. _LIBCPP_END_NAMESPACE_FILESYSTEM
  52. #endif // _LIBCPP_STD_VER >= 17
  53. #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H