xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
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 #if _LIBCPP_STD_VER >= 17
21 
22 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23 
24 enum class copy_options : unsigned short {
25   none                = 0,
26   skip_existing       = 1,
27   overwrite_existing  = 2,
28   update_existing     = 4,
29   recursive           = 8,
30   copy_symlinks       = 16,
31   skip_symlinks       = 32,
32   directories_only    = 64,
33   create_symlinks     = 128,
34   create_hard_links   = 256,
35   __in_recursive_copy = 512,
36 };
37 
38 _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
39   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
40 }
41 
42 _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
43   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
44 }
45 
46 _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
47   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
48 }
49 
50 _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
51   return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
52 }
53 
54 _LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
55   return __lhs = __lhs & __rhs;
56 }
57 
58 _LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
59   return __lhs = __lhs | __rhs;
60 }
61 
62 _LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
63   return __lhs = __lhs ^ __rhs;
64 }
65 
66 _LIBCPP_END_NAMESPACE_FILESYSTEM
67 
68 #endif // _LIBCPP_STD_VER >= 17
69 
70 #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
71