xref: /freebsd-src/contrib/llvm-project/libcxx/include/__filesystem/copy_options.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
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 
20*5f757f3fSDimitry Andric #if _LIBCPP_STD_VER >= 17
210eae32dcSDimitry Andric 
220eae32dcSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
230eae32dcSDimitry Andric 
24*5f757f3fSDimitry Andric enum class copy_options : unsigned short {
250eae32dcSDimitry Andric   none = 0,
260eae32dcSDimitry Andric   skip_existing = 1,
270eae32dcSDimitry Andric   overwrite_existing = 2,
280eae32dcSDimitry Andric   update_existing = 4,
290eae32dcSDimitry Andric   recursive = 8,
300eae32dcSDimitry Andric   copy_symlinks = 16,
310eae32dcSDimitry Andric   skip_symlinks = 32,
320eae32dcSDimitry Andric   directories_only = 64,
330eae32dcSDimitry Andric   create_symlinks = 128,
340eae32dcSDimitry Andric   create_hard_links = 256,
350eae32dcSDimitry Andric   __in_recursive_copy = 512,
360eae32dcSDimitry Andric };
370eae32dcSDimitry Andric 
38*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
39753f127fSDimitry Andric inline constexpr copy_options operator&(copy_options __lhs, copy_options __rhs) {
40753f127fSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) &
41753f127fSDimitry Andric                                    static_cast<unsigned short>(__rhs));
420eae32dcSDimitry Andric }
430eae32dcSDimitry Andric 
44*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
45753f127fSDimitry Andric inline constexpr copy_options operator|(copy_options __lhs, copy_options __rhs) {
46753f127fSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) |
47753f127fSDimitry Andric                                    static_cast<unsigned short>(__rhs));
480eae32dcSDimitry Andric }
490eae32dcSDimitry Andric 
50*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
51753f127fSDimitry Andric inline constexpr copy_options operator^(copy_options __lhs, copy_options __rhs) {
52753f127fSDimitry Andric   return static_cast<copy_options>(static_cast<unsigned short>(__lhs) ^
53753f127fSDimitry Andric                                    static_cast<unsigned short>(__rhs));
540eae32dcSDimitry Andric }
550eae32dcSDimitry Andric 
56*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
57753f127fSDimitry Andric inline constexpr copy_options operator~(copy_options __lhs) {
58753f127fSDimitry Andric   return static_cast<copy_options>(~static_cast<unsigned short>(__lhs));
590eae32dcSDimitry Andric }
600eae32dcSDimitry Andric 
61*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
62753f127fSDimitry Andric inline copy_options& operator&=(copy_options& __lhs, copy_options __rhs) {
63753f127fSDimitry Andric   return __lhs = __lhs & __rhs;
640eae32dcSDimitry Andric }
650eae32dcSDimitry Andric 
66*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
67753f127fSDimitry Andric inline copy_options& operator|=(copy_options& __lhs, copy_options __rhs) {
68753f127fSDimitry Andric   return __lhs = __lhs | __rhs;
690eae32dcSDimitry Andric }
700eae32dcSDimitry Andric 
71*5f757f3fSDimitry Andric _LIBCPP_HIDE_FROM_ABI
72753f127fSDimitry Andric inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
73753f127fSDimitry Andric   return __lhs = __lhs ^ __rhs;
740eae32dcSDimitry Andric }
750eae32dcSDimitry Andric 
760eae32dcSDimitry Andric _LIBCPP_END_NAMESPACE_FILESYSTEM
770eae32dcSDimitry Andric 
78*5f757f3fSDimitry Andric #endif // _LIBCPP_STD_VER >= 17
790eae32dcSDimitry Andric 
800eae32dcSDimitry Andric #endif // _LIBCPP___FILESYSTEM_COPY_OPTIONS_H
81