xref: /openbsd-src/gnu/llvm/libcxx/include/__filesystem/copy_options.h (revision 4bdff4bed0e3d54e55670334c7d0077db4170f86)
1*4bdff4beSrobert // -*- C++ -*-
2*4bdff4beSrobert //===----------------------------------------------------------------------===//
3*4bdff4beSrobert //
4*4bdff4beSrobert // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*4bdff4beSrobert // See https://llvm.org/LICENSE.txt for license information.
6*4bdff4beSrobert // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*4bdff4beSrobert //
8*4bdff4beSrobert //===----------------------------------------------------------------------===//
9*4bdff4beSrobert 
10*4bdff4beSrobert #ifndef _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
11*4bdff4beSrobert #define _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
12*4bdff4beSrobert 
13*4bdff4beSrobert #include <__availability>
14*4bdff4beSrobert #include <__config>
15*4bdff4beSrobert 
16*4bdff4beSrobert #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17*4bdff4beSrobert #  pragma GCC system_header
18*4bdff4beSrobert #endif
19*4bdff4beSrobert 
20*4bdff4beSrobert #ifndef _LIBCPP_CXX03_LANG
21*4bdff4beSrobert 
22*4bdff4beSrobert _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23*4bdff4beSrobert 
24*4bdff4beSrobert _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
25*4bdff4beSrobert 
26*4bdff4beSrobert enum class _LIBCPP_ENUM_VIS copy_options : unsigned short {
27*4bdff4beSrobert   none = 0,
28*4bdff4beSrobert   skip_existing = 1,
29*4bdff4beSrobert   overwrite_existing = 2,
30*4bdff4beSrobert   update_existing = 4,
31*4bdff4beSrobert   recursive = 8,
32*4bdff4beSrobert   copy_symlinks = 16,
33*4bdff4beSrobert   skip_symlinks = 32,
34*4bdff4beSrobert   directories_only = 64,
35*4bdff4beSrobert   create_symlinks = 128,
36*4bdff4beSrobert   create_hard_links = 256,
37*4bdff4beSrobert   __in_recursive_copy = 512,
38*4bdff4beSrobert };
39*4bdff4beSrobert 
40*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
41*4bdff4beSrobert inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
42*4bdff4beSrobert   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
43*4bdff4beSrobert                                    static_cast<unsigned short>(__rhs));
44*4bdff4beSrobert }
45*4bdff4beSrobert 
46*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
47*4bdff4beSrobert inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
48*4bdff4beSrobert   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
49*4bdff4beSrobert                                    static_cast<unsigned short>(__rhs));
50*4bdff4beSrobert }
51*4bdff4beSrobert 
52*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
53*4bdff4beSrobert inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
54*4bdff4beSrobert   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
55*4bdff4beSrobert                                    static_cast<unsigned short>(__rhs));
56*4bdff4beSrobert }
57*4bdff4beSrobert 
58*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
59*4bdff4beSrobert inline constexpr copy_options operator~(copy_options __lhs) {
60*4bdff4beSrobert   return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
61*4bdff4beSrobert }
62*4bdff4beSrobert 
63*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
64*4bdff4beSrobert inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
65*4bdff4beSrobert   return __lhs = __lhs & __rhs;
66*4bdff4beSrobert }
67*4bdff4beSrobert 
68*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
69*4bdff4beSrobert inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
70*4bdff4beSrobert   return __lhs = __lhs | __rhs;
71*4bdff4beSrobert }
72*4bdff4beSrobert 
73*4bdff4beSrobert _LIBCPP_INLINE_VISIBILITY
74*4bdff4beSrobert inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
75*4bdff4beSrobert   return __lhs = __lhs ^ __rhs;
76*4bdff4beSrobert }
77*4bdff4beSrobert 
78*4bdff4beSrobert _LIBCPP_AVAILABILITY_FILESYSTEM_POP
79*4bdff4beSrobert 
80*4bdff4beSrobert _LIBCPP_END_NAMESPACE_FILESYSTEM
81*4bdff4beSrobert 
82*4bdff4beSrobert #endif // _LIBCPP_CXX03_LANG
83*4bdff4beSrobert 
84*4bdff4beSrobert #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
85