xref: /freebsd/contrib/llvm-project/libcxx/include/__filesystem/perm_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_PERM_OPTIONS_H
11 #define _LIBCPP___FILESYSTEM_PERM_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 perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 };
25 
26 _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
27   return static_cast<perm_options>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
28 }
29 
30 _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
31   return static_cast<perm_options>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
32 }
33 
34 _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
35   return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
36 }
37 
38 _LIBCPP_HIDE_FROM_ABI inline constexpr perm_options operator~(perm_options __lhs) {
39   return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
40 }
41 
42 _LIBCPP_HIDE_FROM_ABI inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
43   return __lhs = __lhs & __rhs;
44 }
45 
46 _LIBCPP_HIDE_FROM_ABI inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
47   return __lhs = __lhs | __rhs;
48 }
49 
50 _LIBCPP_HIDE_FROM_ABI inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
51   return __lhs = __lhs ^ __rhs;
52 }
53 
54 _LIBCPP_END_NAMESPACE_FILESYSTEM
55 
56 #endif // _LIBCPP_STD_VER >= 17
57 
58 #endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
59