Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:27

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___FILESYSTEM_PERMS_H
0011 #define _LIBCPP___CXX03___FILESYSTEM_PERMS_H
0012 
0013 #include <__cxx03/__config>
0014 
0015 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0016 #  pragma GCC system_header
0017 #endif
0018 
0019 #if _LIBCPP_STD_VER >= 17
0020 
0021 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
0022 
0023 // On Windows, these permission bits map to one single readonly flag per
0024 // file, and the executable bit is always returned as set. When setting
0025 // permissions, as long as the write bit is set for either owner, group or
0026 // others, the readonly flag is cleared.
0027 enum class perms : unsigned {
0028   none = 0,
0029 
0030   owner_read  = 0400,
0031   owner_write = 0200,
0032   owner_exec  = 0100,
0033   owner_all   = 0700,
0034 
0035   group_read  = 040,
0036   group_write = 020,
0037   group_exec  = 010,
0038   group_all   = 070,
0039 
0040   others_read  = 04,
0041   others_write = 02,
0042   others_exec  = 01,
0043   others_all   = 07,
0044 
0045   all = 0777,
0046 
0047   set_uid    = 04000,
0048   set_gid    = 02000,
0049   sticky_bit = 01000,
0050   mask       = 07777,
0051   unknown    = 0xFFFF,
0052 };
0053 
0054 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
0055   return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
0056 }
0057 
0058 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
0059   return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
0060 }
0061 
0062 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
0063   return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
0064 }
0065 
0066 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
0067   return static_cast<perms>(~static_cast<unsigned>(__lhs));
0068 }
0069 
0070 _LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
0071 
0072 _LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
0073 
0074 _LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
0075 
0076 _LIBCPP_END_NAMESPACE_FILESYSTEM
0077 
0078 #endif // _LIBCPP_STD_VER >= 17
0079 
0080 #endif // _LIBCPP___CXX03___FILESYSTEM_PERMS_H