xref: /freebsd-src/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 753f127f3ace09432b2baeffd71a308760641a62)
10eae32dcSDimitry Andric // -*- C++ -*-
20eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
30eae32dcSDimitry Andric //
40eae32dcSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50eae32dcSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
60eae32dcSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70eae32dcSDimitry Andric //
80eae32dcSDimitry Andric //===----------------------------------------------------------------------===//
90eae32dcSDimitry Andric 
100eae32dcSDimitry Andric #ifndef _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
110eae32dcSDimitry Andric #define _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
120eae32dcSDimitry Andric 
130eae32dcSDimitry Andric #include <__availability>
140eae32dcSDimitry Andric #include <__config>
150eae32dcSDimitry Andric 
1681ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1781ad6265SDimitry Andric #  pragma GCC system_header
1881ad6265SDimitry Andric #endif
1981ad6265SDimitry Andric 
200eae32dcSDimitry Andric #ifndef _LIBCPP_CXX03_LANG
210eae32dcSDimitry Andric 
220eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
230eae32dcSDimitry Andric 
240eae32dcSDimitry Andric _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
250eae32dcSDimitry Andric 
260eae32dcSDimitry Andric enum class _LIBCPP_ENUM_VIS copy_options : unsigned short {
270eae32dcSDimitry Andric   none = 0,
280eae32dcSDimitry Andric   skip_existing = 1,
290eae32dcSDimitry Andric   overwrite_existing = 2,
300eae32dcSDimitry Andric   update_existing = 4,
310eae32dcSDimitry Andric   recursive = 8,
320eae32dcSDimitry Andric   copy_symlinks = 16,
330eae32dcSDimitry Andric   skip_symlinks = 32,
340eae32dcSDimitry Andric   directories_only = 64,
350eae32dcSDimitry Andric   create_symlinks = 128,
360eae32dcSDimitry Andric   create_hard_links = 256,
370eae32dcSDimitry Andric   __in_recursive_copy = 512,
380eae32dcSDimitry Andric };
390eae32dcSDimitry Andric 
400eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
41*753f127fSDimitry Andric inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
42*753f127fSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
43*753f127fSDimitry Andric                                    static_cast<unsigned short>(__rhs));
440eae32dcSDimitry Andric }
450eae32dcSDimitry Andric 
460eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
47*753f127fSDimitry Andric inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
48*753f127fSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
49*753f127fSDimitry Andric                                    static_cast<unsigned short>(__rhs));
500eae32dcSDimitry Andric }
510eae32dcSDimitry Andric 
520eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
53*753f127fSDimitry Andric inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
54*753f127fSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
55*753f127fSDimitry Andric                                    static_cast<unsigned short>(__rhs));
560eae32dcSDimitry Andric }
570eae32dcSDimitry Andric 
580eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
59*753f127fSDimitry Andric inline constexpr copy_options operator~(copy_options __lhs) {
60*753f127fSDimitry Andric   return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
610eae32dcSDimitry Andric }
620eae32dcSDimitry Andric 
630eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
64*753f127fSDimitry Andric inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
65*753f127fSDimitry Andric   return __lhs = __lhs & __rhs;
660eae32dcSDimitry Andric }
670eae32dcSDimitry Andric 
680eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
69*753f127fSDimitry Andric inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
70*753f127fSDimitry Andric   return __lhs = __lhs | __rhs;
710eae32dcSDimitry Andric }
720eae32dcSDimitry Andric 
730eae32dcSDimitry Andric _LIBCPP_INLINE_VISIBILITY
74*753f127fSDimitry Andric inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
75*753f127fSDimitry Andric   return __lhs = __lhs ^ __rhs;
760eae32dcSDimitry Andric }
770eae32dcSDimitry Andric 
780eae32dcSDimitry Andric _LIBCPP_AVAILABILITY_FILESYSTEM_POP
790eae32dcSDimitry Andric 
800eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_FILESYSTEM
810eae32dcSDimitry Andric 
820eae32dcSDimitry Andric #endif // _LIBCPP_CXX03_LANG
830eae32dcSDimitry Andric 
840eae32dcSDimitry Andric #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
85