xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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 <__config>
140eae32dcSDimitry Andric 
1581ad6265SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1681ad6265SDimitry Andric #  pragma GCC system_header
1781ad6265SDimitry Andric #endif
1881ad6265SDimitry Andric 
195f757f3fSDimitry Andric #if _LIBCPP_STD_VER >= 17
200eae32dcSDimitry Andric 
210eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
220eae32dcSDimitry Andric 
235f757f3fSDimitry Andric enum class copy_options : unsigned short {
240eae32dcSDimitry Andric   none                = 0,
250eae32dcSDimitry Andric   skip_existing       = 1,
260eae32dcSDimitry Andric   overwrite_existing  = 2,
270eae32dcSDimitry Andric   update_existing     = 4,
280eae32dcSDimitry Andric   recursive           = 8,
290eae32dcSDimitry Andric   copy_symlinks       = 16,
300eae32dcSDimitry Andric   skip_symlinks       = 32,
310eae32dcSDimitry Andric   directories_only    = 64,
320eae32dcSDimitry Andric   create_symlinks     = 128,
330eae32dcSDimitry Andric   create_hard_links   = 256,
340eae32dcSDimitry Andric   __in_recursive_copy = 512,
350eae32dcSDimitry Andric };
360eae32dcSDimitry Andric 
37*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
38*cb14a3feSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) & static_cast<unsigned short>(__rhs));
390eae32dcSDimitry Andric }
400eae32dcSDimitry Andric 
41*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
42*cb14a3feSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) | static_cast<unsigned short>(__rhs));
430eae32dcSDimitry Andric }
440eae32dcSDimitry Andric 
45*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
46*cb14a3feSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^ static_cast<unsigned short>(__rhs));
470eae32dcSDimitry Andric }
480eae32dcSDimitry Andric 
49*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline constexpr copy_options operator~(copy_options __lhs) {
50753f127fSDimitry Andric   return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
510eae32dcSDimitry Andric }
520eae32dcSDimitry Andric 
53*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
54753f127fSDimitry Andric   return __lhs = __lhs & __rhs;
550eae32dcSDimitry Andric }
560eae32dcSDimitry Andric 
57*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
58753f127fSDimitry Andric   return __lhs = __lhs | __rhs;
590eae32dcSDimitry Andric }
600eae32dcSDimitry Andric 
61*cb14a3feSDimitry Andric _LIBCPP_HIDE_FROM_ABI inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
62753f127fSDimitry Andric   return __lhs = __lhs ^ __rhs;
630eae32dcSDimitry Andric }
640eae32dcSDimitry Andric 
650eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_FILESYSTEM
660eae32dcSDimitry Andric 
675f757f3fSDimitry Andric #endif // _LIBCPP_STD_VER >= 17
680eae32dcSDimitry Andric 
690eae32dcSDimitry Andric #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
70