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