2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FILESYSTEM_PERMS_H
11 #define _LIBCPP___FILESYSTEM_PERMS_H
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 # pragma GCC system_header
19 #if _LIBCPP_STD_VER >= 17
21 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23 // On Windows, these permission bits map to one single readonly flag per
24 // file, and the executable bit is always returned as set. When setting
25 // permissions, as long as the write bit is set for either owner, group or
26 // others, the readonly flag is cleared.
27 enum class perms
: unsigned {
54 _LIBCPP_HIDE_FROM_ABI
inline constexpr perms
operator&(perms __lhs
, perms __rhs
) {
55 return static_cast<perms
>(static_cast<unsigned>(__lhs
) & static_cast<unsigned>(__rhs
));
58 _LIBCPP_HIDE_FROM_ABI
inline constexpr perms
operator|(perms __lhs
, perms __rhs
) {
59 return static_cast<perms
>(static_cast<unsigned>(__lhs
) | static_cast<unsigned>(__rhs
));
62 _LIBCPP_HIDE_FROM_ABI
inline constexpr perms
operator^(perms __lhs
, perms __rhs
) {
63 return static_cast<perms
>(static_cast<unsigned>(__lhs
) ^ static_cast<unsigned>(__rhs
));
66 _LIBCPP_HIDE_FROM_ABI
inline constexpr perms
operator~(perms __lhs
) {
67 return static_cast<perms
>(~static_cast<unsigned>(__lhs
));
70 _LIBCPP_HIDE_FROM_ABI
inline perms
& operator&=(perms
& __lhs
, perms __rhs
) { return __lhs
= __lhs
& __rhs
; }
72 _LIBCPP_HIDE_FROM_ABI
inline perms
& operator|=(perms
& __lhs
, perms __rhs
) { return __lhs
= __lhs
| __rhs
; }
74 _LIBCPP_HIDE_FROM_ABI
inline perms
& operator^=(perms
& __lhs
, perms __rhs
) { return __lhs
= __lhs
^ __rhs
; }
76 _LIBCPP_END_NAMESPACE_FILESYSTEM
78 #endif // _LIBCPP_STD_VER >= 17
80 #endif // _LIBCPP___FILESYSTEM_PERMS_H