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 #ifndef _LIBCPP_CXX03_LANG
21 
22 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23 
24 enum class _LIBCPP_ENUM_VIS perm_options : unsigned char {
25   replace = 1,
26   add = 2,
27   remove = 4,
28   nofollow = 8
29 };
30 
31 _LIBCPP_INLINE_VISIBILITY
32 inline constexpr perm_options operator&(perm_options __lhs, perm_options __rhs) {
33   return static_cast<perm_options>(static_cast<unsigned>(__lhs) &
34                                    static_cast<unsigned>(__rhs));
35 }
36 
37 _LIBCPP_INLINE_VISIBILITY
38 inline constexpr perm_options operator|(perm_options __lhs, perm_options __rhs) {
39   return static_cast<perm_options>(static_cast<unsigned>(__lhs) |
40                                    static_cast<unsigned>(__rhs));
41 }
42 
43 _LIBCPP_INLINE_VISIBILITY
44 inline constexpr perm_options operator^(perm_options __lhs, perm_options __rhs) {
45   return static_cast<perm_options>(static_cast<unsigned>(__lhs) ^
46                                    static_cast<unsigned>(__rhs));
47 }
48 
49 _LIBCPP_INLINE_VISIBILITY
50 inline constexpr perm_options operator~(perm_options __lhs) {
51   return static_cast<perm_options>(~static_cast<unsigned>(__lhs));
52 }
53 
54 _LIBCPP_INLINE_VISIBILITY
55 inline perm_options& operator&=(perm_options& __lhs, perm_options __rhs) {
56   return __lhs = __lhs & __rhs;
57 }
58 
59 _LIBCPP_INLINE_VISIBILITY
60 inline perm_options& operator|=(perm_options& __lhs, perm_options __rhs) {
61   return __lhs = __lhs | __rhs;
62 }
63 
64 _LIBCPP_INLINE_VISIBILITY
65 inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
66   return __lhs = __lhs ^ __rhs;
67 }
68 
69 _LIBCPP_END_NAMESPACE_FILESYSTEM
70 
71 #endif // _LIBCPP_CXX03_LANG
72 
73 #endif // _LIBCPP___FILESYSTEM_PERM_OPTIONS_H
74