xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
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 #ifndef _LIBCPP_CXX03_LANG
17 
18 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
19 
20 _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
21 
22 enum class _LIBCPP_ENUM_VIS copy_options : unsigned short {
23   none = 0,
24   skip_existing = 1,
25   overwrite_existing = 2,
26   update_existing = 4,
27   recursive = 8,
28   copy_symlinks = 16,
29   skip_symlinks = 32,
30   directories_only = 64,
31   create_symlinks = 128,
32   create_hard_links = 256,
33   __in_recursive_copy = 512,
34 };
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 
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 
48 _LIBCPP_INLINE_VISIBILITY
49 inline constexpr copy_options operator^(copy_options _LHS, copy_options _RHS) {
50   return static_cast<copy_options>(static_cast<unsigned short>(_LHS) ^
51                                    static_cast<unsigned short>(_RHS));
52 }
53 
54 _LIBCPP_INLINE_VISIBILITY
55 inline constexpr copy_options operator~(copy_options _LHS) {
56   return static_cast<copy_options>(~static_cast<unsigned short>(_LHS));
57 }
58 
59 _LIBCPP_INLINE_VISIBILITY
60 inline copy_options& operator&=(copy_options& _LHS, copy_options _RHS) {
61   return _LHS = _LHS & _RHS;
62 }
63 
64 _LIBCPP_INLINE_VISIBILITY
65 inline copy_options& operator|=(copy_options& _LHS, copy_options _RHS) {
66   return _LHS = _LHS | _RHS;
67 }
68 
69 _LIBCPP_INLINE_VISIBILITY
70 inline copy_options& operator^=(copy_options& _LHS, copy_options _RHS) {
71   return _LHS = _LHS ^ _RHS;
72 }
73 
74 _LIBCPP_AVAILABILITY_FILESYSTEM_POP
75 
76 _LIBCPP_END_NAMESPACE_FILESYSTEM
77 
78 #endif // _LIBCPP_CXX03_LANG
79 
80 #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
81