xref: /freebsd-src/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
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