xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 753f127f3ace09432b2baeffd71a308760641a62)
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 
10 #ifndef _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
11 #define _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
12 
13 #include <__availability>
14 #include <__config>
15 
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 #  pragma GCC system_header
18 #endif
19 
20 #ifndef _LIBCPP_CXX03_LANG
21 
22 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23 
24 _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
25 
26 enum class _LIBCPP_ENUM_VIS copy_options : unsigned short {
27   none = 0,
28   skip_existing = 1,
29   overwrite_existing = 2,
30   update_existing = 4,
31   recursive = 8,
32   copy_symlinks = 16,
33   skip_symlinks = 32,
34   directories_only = 64,
35   create_symlinks = 128,
36   create_hard_links = 256,
37   __in_recursive_copy = 512,
38 };
39 
40 _LIBCPP_INLINE_VISIBILITY
41 inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
42   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
43                                    static_cast<unsigned short>(__rhs));
44 }
45 
46 _LIBCPP_INLINE_VISIBILITY
47 inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
48   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
49                                    static_cast<unsigned short>(__rhs));
50 }
51 
52 _LIBCPP_INLINE_VISIBILITY
53 inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
54   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
55                                    static_cast<unsigned short>(__rhs));
56 }
57 
58 _LIBCPP_INLINE_VISIBILITY
59 inline constexpr copy_options operator~(copy_options __lhs) {
60   return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
61 }
62 
63 _LIBCPP_INLINE_VISIBILITY
64 inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
65   return __lhs = __lhs & __rhs;
66 }
67 
68 _LIBCPP_INLINE_VISIBILITY
69 inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
70   return __lhs = __lhs | __rhs;
71 }
72 
73 _LIBCPP_INLINE_VISIBILITY
74 inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
75   return __lhs = __lhs ^ __rhs;
76 }
77 
78 _LIBCPP_AVAILABILITY_FILESYSTEM_POP
79 
80 _LIBCPP_END_NAMESPACE_FILESYSTEM
81 
82 #endif // _LIBCPP_CXX03_LANG
83 
84 #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
85