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